Header Shadow Image

DD-WRT Port Forwarding Fix

On DD-WRT, the port forwarding logic may not work at all.  A fix for this is to use the following few lines in Administration — Commands — Firewall to enable port forwarding (NOTICE: Your forwarding rules should work out of the box.  Test your forwarding rules with a page like this via an external source before you start adjusting below. ):

# Enable NAT rules.
insmod ipt_mark 
insmod xt_mark 
iptables -t mangle -A PREROUTING -i ! `get_wanface` -d `nvram get wan_ipaddr` -j MARK –set-mark 0xd001 
iptables -t mangle -A PREROUTING -j CONNMARK –save-mark 
iptables -t nat -A POSTROUTING -m mark –mark 0xd001 -j MASQUERADE 

The result should be as follows:

Port Forwarding Example



Leave a Reply

You must be logged in to post a comment.

  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License