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

Port forwarding with ipmasq


I'm running debian woody on my gateway with the ipmasq package installed
and I need to do some port forwarding. For instance, I need to forward
some ports for BitTorrent running on a box on my LAN so I created a file

ipnm_cache ppp0
btPorts="6881 6882"

for port in $btPorts;
    $IPTABLES -A PREROUTING -t nat -p tcp -d $IPOFIF/$NMOFIF --dport $port
        -j DNAT --to-destination$port
    $IPTABLES -A FORWARD -p tcp -d $IPOFIF/$NMOFIF --dport $port -m
        state --state NEW,ESTABLISHED,RELATED -j ACCEPT

Where ppp0 is my external interface and is the box on the LAN
that is running the BitTorrent client. From the gateway I can connect to on port 6881. However if I try using the IP of my external
interface then I get connection refused. What's wrong with my rules? I
haven't changed anything about the default ipmasq setup other than
adding that .rul file and masquerading is working fine, it's just port
forwarding that is having problems. 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: