Linux Gateway Nat

Sharing a internet connection from a wireless to a local net (ethernet)

Gateway basic configuration

sudo -s
echo "nameserver 208.67.222.222" >/etc/resolv.conf
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT
iptables --table nat --flush
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
ifconfig eth0 192.168.0.1 up

Client basic configuration

ifconfig eth0 192.168.0.7 up
route add default gw 192.168.0.1
echo "nameserver 208.67.222.222" >/etc/resolv.conf
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.