Turn on IP forwarding¶
echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward
Add a routing rule for forwarding internet¶
If you want to forward traffic from ethernet
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
If you want to forward traffic from antenna
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
Save the iptables rules¶
Install the iptables-persistent package
sudo apt-get install iptables-persistent
Using this command to give you root user privileges
sudo su
Type this command to save the rules
iptables-save > /etc/iptables/rules.v4