My laptop is on the LAN (with address of 192.168.0.2) and it can ping 192.168.0.1 but it cannot ping
www.google.com
I want to use p1p1 (a.k.a. eth1) as 192.168.0.1 and route everything from 192.168.0.2 through eth0 to access internet but cannot figure out how to add simple NAT commands to iptables script ...
====================================
on Fedora release 16 (Verne)................ there is no "service iptables save" command (the original post is old from 2008)
Code:
[root@ezcorean sysconfig]# service iptables save
Redirecting to /bin/systemctl save iptables.service
Unknown operation save
[root@ezcorean sysconfig]#
I have enabled
Code:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
in /etc/sysctl.conf
however, I still do not know how to add the rule
Code:
-t nat -A POSTROUTING -o eth0 -j MASQUERADE
to /etc/sysconfig/iptables
If I do so, /var/log/messages says:
"Line 13 seems to have a -t table option." and it fails to start iptables.
However, if I run
Code:
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
I can access the internet from my laptop as described above.
I suppose I should just add
Code:
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
to /etc/rc.local ??