Search This Blog

Saturday, August 17, 2013

dd-wrt NAT with several subnets behind

If you have a complex lab at home and you would like to setup dd-wrt routing do not forget to enable nat for all subnets, as by default dd-wrt will only take care of the one directly connected.
Here is example of my script that adds 10.10.10.0 subnet to the internet nat, script also contains openvpn related commands:
iptables -I INPUT 1 -p udp --dport 1194 -j ACCEPT
iptables -I FORWARD 1 --source 192.168.66.0/24 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
iptables -t nat -I POSTROUTING -o `get_wanface` --source 10.10.10.0/24 -j SNAT --to `nvram get wan_ipaddr`

No comments: