Configure NAT on Raspberry Pi
|In this blog we will see how to setup NAT on Raspberry Pi between eth0 and wlan0
sudo nano /etc/sysctl.conf
add the following line at the end of the file
net.ipv4.ip_forward=1
run the following to setup the bridge between wlan0 and eth0
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
run sudo nano /etc/network/interfaces and add
up iptables-restore < /etc/iptables.ipv4.nat
at the very end
@Source : adafruit
2 Comments
thanks man , helped out
couldn’t figure out how to enable NAT on pi, this saved my day