Wednesday, August 22, 2012

Port Forwarding on DD-WRT Not Working?

This is really for my own benefit, so chill out. If I post it here I am much less likely of forgetting just what in the hell has gone wrong.

For those of us running DD-WRT firmware in our routers, port forwarding can be a complete pain in the ass if you do not know what you are doing. And let us be clear up front, I do not know what I am doing with IPTABLES! That shit is completely foreign to me and I would consider myself a pretty well-rounded geek.

So here is the trouble. You just installed or re-flash dd-wrt, this includes the version of dd-wrt that is running on the Buffalo routers by the way, and lo and behold your port forwards are not working. WTF?!? I thoguht this shit is supposed to be awesome, etc., etc. bitch bitch bitch.

The issue is that a port forward is from WAN to LAN, and that is actually working just fine for you. Go ahead an NMap yourself if you think I am crazy. But dd-wrt does not allow port forwarding on the loopback, so your nifty port forward is essentially lost at the router.

This is how to fix this.
  1. telnet  into your router (alternatively you could goto the Administration tab in the webgui and then to the Commands box)
    telnet 192.168.11.1
  2. Enter the following into the prompt:
    iptables -y nat -I POSTROUTING -o br0 -s 192.168.11.0/24 -d 192.168.11.0/24 -j MASQUERADE
    Remember to change the line above to match your local network path.
  3. Hit enter and close telnet.
  4. Voila! Your port forwards are working!
Basically all the above actually does is force a loopback into.... fuck it I don't know what the hell it does, but it works. And this might help someone else who has this fun little problem in the future.

No comments:

Post a Comment