1

Scenario:

Using DDwrt on a linksys router. I want to port forward a specific public IP address to internal IP 192.168.0.20 port 80 using IPtables. Not sure how to do this any help would be appreciated.

Munky
  • 13

1 Answers1

4

Something like:

iptables -t nat -A PREROUTING -d <public-ip> -i <wan-interface> -j DNAT --to 192.168.0.20

should work. If you want to forward only TCP port 80 on the public IP, you can do:

iptables -t nat -A PREROUTING -p tcp --dport 80 -d <public-ip> -i <wan-interface> -j DNAT --to 192.168.0.20:80
Falcon Momot
  • 25,584