I'm running DD-WRT firmware on my router, version DD-WRT v24-sp2 (12/12/11) std.
I'm trying to port forward http
traffic on port 80 to my PC's local IP, 192.168.2.97, and although I can browse my hosted site on my LAN, when I try from a remote IP offsite I get "The Connection has timed out".
Could someone please have a look at the iptables dump linked here and help me find the proper iptables syntax to use to enable port forwarding to work properly? I'm very new to iptables and am lost on how to craft the necessary syntax.
EDIT output of netstat -ano | find "80"
from the web server (Windows 7 running IIS):
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
TCP 192.168.2.97:1869 207.46.124.39:80 ESTABLISHED 3860
TCP 192.168.2.97:43794 74.125.229.36:80 TIME_WAIT 0
TCP [::]:80 [::]:0 LISTENING 4
UDP 127.0.0.1:48000 *:* 3132
UDP 127.0.0.1:48001 *:* 2420
EDIT output of iptables -t nat -L
from the DD-WRT command prompt:
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
DNAT icmp -- anywhere my.wan.ip to:192.168.2.1
DNAT tcp -- anywhere my.wan.ip tcp dpt:www to:192.168.2.97:80
DNAT tcp -- anywhere my.wan.ip tcp dpt:www to:192.168.2.97
TRIGGER 0 -- anywhere my.wan.ip TRIGGER type:dnat match:0 relate:0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT 0 -- 192.168.2.0/24 anywhere to:my.wan.ip
RETURN 0 -- anywhere anywhere PKTTYPE = broadcast
EDIT output of iptables -t nat -vnL
from DD-WRT interface:
Chain PREROUTING (policy ACCEPT 165K packets, 18M bytes)
pkts bytes target prot opt in out source destination
38 47952 DNAT icmp -- * * 0.0.0.0/0 my.wan.ip to:192.168.2.1
0 0 DNAT tcp -- * * 0.0.0.0/0 my.wan.ip tcp dpt:80 to:192.168.2.97:80
0 0 DNAT tcp -- * * 0.0.0.0/0 my.wan.ip tcp dpt:80 to:192.168.2.97
47056 6024K TRIGGER 0 -- * * 0.0.0.0/0 my.wan.ip TRIGGER type:dnat match:0 relate:0
Chain OUTPUT (policy ACCEPT 4753 packets, 418K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 4753 packets, 418K bytes)
pkts bytes target prot opt in out source destination
87913 10M SNAT 0 -- * vlan2 192.168.2.0/24 0.0.0.0/0 to:my.wan.ip
0 0 RETURN 0 -- * br0 0.0.0.0/0 0.0.0.0/0 PKTTYPE = broadcast
EDIT output of route
from DD-WRT Command prompt:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
74.178.55.1 * 255.255.255.255 UH 0 0 0 vlan2
192.168.2.0 * 255.255.255.0 U 0 0 0 br0
74.178.55.0 * 255.255.255.0 U 0 0 0 vlan2
169.254.0.0 * 255.255.0.0 U 0 0 0 br0
239.0.0.0 * 255.0.0.0 U 0 0 0 br0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default adsl-74-178-55- 0.0.0.0 UG 0 0 0 vlan2
CONCLUSION: I've had it with DD-WRT.
I've bricked and unbricked my Buffalo WZR-HP-G300NH2 dozens of times now. Tried numerous suggestions below. Posted on the DD-WRT forum and got met with mostly dead air. Looked at other alternative firmwares like OpenWRT, Gargoyle, HyperWRT, Tomato. Of these, OpenWRT with Gargoyle looked promising, but Gargoyle specifically does not support my router (the WZR-HP-G300NH is supported, but not the WZR-HP-G300NH2).
The furthest I've come so far is with getting OpenWRT and Luci (a web management add-on) installed, after wading through hundreds of forum posts trying to find solutions or workarounds to numerous build and config and other errors only to be met with terse, unhelpful posts in response to questions similar to mine along the way like "just recompile with {some library or option or config which seems perfectly conventional to the developer but not a newbie}" or "just try {doing the obvious which you've probably already tried, which I can do in my sleep but don't particularly care to elaborate on}".
Apparently I did something wrong, because following this and trying to apply some configuration changes through Luci, the router has bricked again after a reboot. If I feel like it, I'll try yet again to reflash it, and see what I need to do to avoid the situation again, and hopefully end up with a functional router or at least a switch I can use.
In the meantime I've gone ahead and bought another router, and I'm hoping that the factory firmware will do the seemingly simple task of port forwarding. Thanks to kce and all those who took a stab at this.