Last modified 5 years ago Last modified on 2013-02-05 04:50:57

Linuxhints

Share internet from eth1 (that has an internet ip) to eth0 (whose ip we set to 192.168.2.1 below).

sudo ip link set dev eth0 up
sudo ip addr add 192.168.2.1/24 dev eth0
sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o eth1 -s 192.168.2.0/24 -j MASQUERADE