Re: port forward with the ipmasq package and Iptables
On Tuesday 29 April 2003 09:40, Tom Goulet (UID0) wrote:
> 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.
You shouldn't need the ipmasq package, NAT has been built into iptables for
A rule like this should do the trick:
iptables -t nat -A PREROUTING -p tcp -d $external-ip --dport $external-port \
-j DNAT --to $internal-ip:$internal-port
You will probably need a rule like this as well:
iptables -t nat -A POSTROUTING -o $external-ip -s $internal-ip -j MASQUERADE
$internal-ip in the last one can be changed to the network range, and will
allow general NAT for that network.