On Mon Jun 30, 2008 at 05:29:58PM +0530, Rony wrote:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE I believe this can be done by GUI tools too but never looked into them.
Wow I didn't know it was that simple, only one line. Since the internet device and the LAN device is not mentioned in your command line, does the system assume internet device as the one which has default route and the LAN is the one that matches subnet?
You need not mention the device cos NAT handles all the request originating from 192.168.0.0/24 and Masquerade's them. Iptables will take care of the NAT tables. So, no need to specify interfaces.
- Enable ip forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward This will allow packets to pass b/w interfaces.
Just curious to know, after IP forwarding eth1 (internet) does your host OS have access to the net?
Yes, after the above steps, both the PC's are online. Only the requests originating from 192.168.0.0/24(in this case) are forwarded, not the others. But, this method has a drawback that the PC doing the forwarding needs to stay online when other PC's need to go online. So, this isn't the ideal setup in most cases but it will work fine in my case since my PC is on 24/7.