share connection between personal computers

14 Dec 2010

Wireless to wired

$ sudo ifconfig eth0
$ sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

Wired to wireless

$ sudo iwconfig wlan0 mode ad-hoc
$ sudo iwconfig wlan0 essid proxywlan
$ sudo ifconfig wlan0 up
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

After completing any of the previous steps (and if no dhcp daemon has been set up) the client machine will require to be configured manually, eg: