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

Re: port forward with the ipmasq package and Iptables

> How do I forward port a port on the external IP to the same port on an
> internal IP?  I am using the ipmasq package and Iptables.  I'm willing
> to abandon the ipmasq package.

Create the file /etc/ipmasq/rules/F10portfw.rul or some similar name (I
think it just needs to begin with "F") and put something similar to the
below inside it:


$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -p tcp --dport 515 -m state \
$IPTABLES -A PREROUTING -t nat -p tcp -d $EXTIP --dport 515 \
        -j DNAT --to $PRINTERIP:515

And run:
/etc/init.d/ipmasq restart

The ipmasq package offers ways to pull in all the interface names and
addresses as variables and even loop over multiple external interfaces,
which are all documented in the ipmasq-rule manual page, but I'm not
interested in learning them.

Tom Goulet				mail: uid0@em.ca
UID0 Unix Consulting			web:  em.ca/uid0/

Reply to: