Enabling Internet Connection Sharing on the Raspberry Pi

On my mother's Raspberry Pi the internet is accessed using a Mifi dongle which is tethered to the Pi using the USB cable.

Once the internet connection was working from the Pi itself I was able to share the internet using the following commands.

iptables --flush -t nat

 # Now we will do Masquerading ie. we are doing NAT.
iptables --table nat --append POSTROUTING --out-interface wwan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

Note: The above instructions could be added to a script file.

Resources

Tags:
Source:
1451hrs.txt
Published:
30-12-2015 14:51