I'm trying to setup a simple port forwarding firewall and I can't make the basic non-firewall configuration to work. I have setup the iptables script as follows
#!/bin/sh # interfaces LAN="eth1" WAN="eth0" # enable forwarding echo 1 > /proc/sys/net/ipv4/ip_forward # delete all existing rules to start from scratch iptables -F iptables -t nat -F iptables -t mangle -F iptables -X # accept everything iptables -A INPUT -j ACCEPT iptables -A FORWARD -j ACCEPT iptables -A OUTPUT -j ACCEPT # port forwarding to local machine iptables -t nat -A PREROUTING -i $WAN -p tcp --dport 80 -j DNAT --to 192.168.1.96 # masquerade iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
This script will not firewall anything but it should redirect port 80 on the gateway machine to my internal machine 192.168.1.96. This is not working. The problem is that I can't get from the outside into the inside machine. I don't even know how to start debugging. Any hints on where to look?