Always forget how to route traffic from a router I'm configuring over an Ethernet cable to the Internet over wifi, so here are the steps for my reference next time... maybe it will help someone else also.

On the router:

route add default gw (the eth0 IP of the Linux box)

On the Linux box:

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

That should do it, unless I've forgotten a step.

Back to blog or home page

last updated 2012-09-26 02:03:37. served from tektonic.jcomeau.com