I am trying to configure my router to redirect all outgoing web traffic to a server on my LAN. I have configured the server to listen on port 8080 and setup a rewrite rule so that all requests return a page. I'm trying to configure the firewall to redirect the packets, but I'm a noob with iptables. Here's the rule I'm trying to use:
iptables -t nat -A prerouting_lan -p tcp -s 192.168.1.251 --dport 80 -j DNAT --to-destinatio
n 192.168.1.100:8080
I think I'm just missing something simple due to a lack of understanding of netfilter.
My nat table is basically stock, except 3 ports forwarded from the wan.
root@OpenWrt:~# iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
zone_wan_prerouting all -- anywhere anywhere
zone_lan_prerouting all -- anywhere anywhere
prerouting_rule all -- anywhere anywhere
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
postrouting_rule all -- anywhere anywhere
zone_wan_nat all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain postrouting_rule (1 references)
target prot opt source destination
Chain prerouting_lan (1 references)
target prot opt source destination
LOG tcp -- pyro.lan anywhere tcp dpt:80 LOG level warning
LOG tcp -- pyro.lan anywhere tcp dpt:80 LOG level warning
Chain prerouting_rule (1 references)
target prot opt source destination
Chain prerouting_wan (1 references)
target prot opt source destination
Chain zone_lan_nat (0 references)
target prot opt source destination
MASQUERADE all -- anywhere anywhere
Chain zone_lan_prerouting (1 references)
target prot opt source destination
prerouting_lan all -- anywhere anywhere
Chain zone_wan_nat (1 references)
target prot opt source destination
MASQUERADE all -- anywhere anywhere
Chain zone_wan_prerouting (1 references)
target prot opt source destination
prerouting_wan all -- anywhere anywhere
DNAT tcp -- anywhere anywhere tcp dpt:80 to:192.168.1.100:80
DNAT tcp -- anywhere anywhere tcp dpt:443 to:192.168.1.100:443
DNAT tcp -- anywhere anywhere tcp dpt:22 to:192.168.1.100:22