Datasheet

sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 22 -j REDIRECT --to-ports 22
Type the following to route all DNS (UDP port 53) from interface wlan0 to internal port 53 (DNSPort in our torrc)
sudo iptables -t nat -A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53
Type the following to route all TCP traffic from interface wlan0 to port 9040 (TransPort in our torrc)
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040
Next you can check that the ip tables are right with
sudo iptables -t nat -L
If all is good, we'll save it to our old NAT save file
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
It will automatically get loaded when the networking is set up on reboot (as we did in the last tutorial on making a Pi
access point)
© Adafruit Industries https://learn.adafruit.com/onion-pi Page 11 of 16