[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Port forwarding with ipmasq and iptables



Hi,

I'm running debian woody on my gateway with the ipmasq package installed
and I need to do some port forwarding to a machine on my LAN. So I
created a file /etc/ipmasq/rules/F10portf.rul

---F10portf.rul---
ipnm_cache ppp0

$IPTABLES -A PREROUTING -t nat -p tcp -d $IPOFIF --dport <port> -j DNAT
--to-destination 10.0.0.2:<port>

$IPTABLES -A FORWARD -p tcp -d $IPOFIF --dport <port> -m sate --state
NEW -j ACCEPT
---/F10portf.rul---

where <port> is the number of the port that needs to be forwarded, ppp0
is my external interface and 10.0.0.2 is the machine on the LAN that
needs to have the port forwarded to it. From the gateway I can connect
to 10.0.0.2 on port <port>. What's wrong with my rules? I haven't
changed anything about the default ipmasq setup (after the debconf
questions) other than adding that .rul file. Using iptables -L and
iptables -t nat -L I can see that these rules are being added to their
respective chains without issue.

Thanks in advance for any help.



Reply to: