Monday, December 01, 2008

iptables command for port forwarding config in dd-wrt

i'v installed DD-WRT v24 SP1 in Linksys WRT350N, but the port forwarding from webpage doesn't work,so i had to login the console to set the rule:

Port Forwarding to a specific LAN IP


Port Forwarding can be accomplished from within the web interface here.
However, the very same thing can be done a bit differently (tested and
working), via command line. --u3gyxap: Example with port 443 and IP
192.168.1.2

iptables -t nat -I PREROUTING -p tcp -d $(nvram get wan_ipaddr) --dport 443 -j DNAT --to 192.168.1.2:443

iptables -I FORWARD -p tcp -d 192.168.1.2 --dport 443 -j ACCEPT

http://www.dd-wrt.com/wiki/index.php/Iptables