PDA

View Full Version : [ubuntu] iptables ics for ceartain ips only



sebkinne
April 1st, 2011, 01:59 AM
10chars

uRock
April 1st, 2011, 02:01 AM
Moved to Security Discussions sub-forum.

Ocxic
April 1st, 2011, 02:46 AM
sudo iptables -A POSTROUTING -t nat -j MASQUERADE
should be:
sudo iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE
where "-o eth1" is the interface connected to your internet connection.

just replace 192.168.1.0/24 with the IP of the computer you want to have access, others will be ignored.

sebkinne
April 1st, 2011, 03:04 AM
10chars

Ocxic
April 1st, 2011, 03:25 AM
your iptables-save command still has this rule in it:
-A POSTROUTING -o eth0 -j MASQUERADE

be sure to remove it

sebkinne
April 1st, 2011, 03:53 AM
10chars

Ocxic
April 1st, 2011, 03:59 AM
you want to masquerade the internet to provide NAT translation for your network, you don't need to masquerade wlan0 so remove that one.

and i just figured it out: use this

iptables -t nat -A POSTROUTING -s 192.168.1.10 -o eth0 -j MASQUERADE

and remove other rules for masquerading./ the above rule should only provide NAT for the ip you specify.

sebkinne
April 1st, 2011, 03:59 AM
Thanks!
That command worked, just as I needed it :)

Best,
Sebkinne