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

 

Cheers,
TK

Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

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

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

 

0
Would love your thoughts, please comment.x
()
x
The IT Development and Technology Mini Vault | MicroDevSys.com
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.