Im using a 3G USB huawei modem to get access to the internet, therefore, i have an active ppp interface addressed. I want to share this access with my wlan interface so that every device that will get connected to my wifi hotspot will get access to the internet too. How can i do that? Thanks


In ubuntu 14 or ubuntu 15, you can use this command : - first, you activate routing :

sudo echo 1 > /proc/sys/net/ipv4/ip_forward

- second, you write a dynamic translation rule source IP address.

sudo iptables -A POSTROUTING -t nat -s address/mask -o internet_interface -j MASQUERADE

where adress/mask is a address range who don't have the internet access, and then internet_interface is the interface who have the internet access. Example of this rule :

sudo iptables -A POSTROUTING -t nat -s -o ppp0 -j MASQUERADE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.