BBB File /usr/local/sbin/setiptables

From Wiki
Jump to navigationJump to search

When the WiFi is in AP mode, and if you want to pass traffic betwixt the wireless and wired network, you'll need some iptables rules. These rules forward any and all traffic, as my firewall handles any necessary filtering.

sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -F FORWARD
iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT