Iptables – fwbuilder: port forwarding incoming 222 port requests to a local machine 22 port

forwardingfwbuilderiptablesnat;port

I am using fwbuilder to setup my iptables rules for a public server. The idea is to forward external requests from the 222 port to a local machine's ssh port. The settings i used are:

NAT section

Original Src: Any

Original Dst: public ip (internet)

Original Srv: tcp 222

Translated Src: Original

Translated Dst: local machine ip

Translated Srv: tcp 22

Action: Translate

Options: empty

Comment: empty

The corresponding iptables rule is:

$IPTABLES -t nat -A PREROUTING -p tcp -m tcp --sport 222 -d X.X.X.X --dport 22 -j DNAT --to-destination X.X.X.X:22

This setting does nothing. Does anyone knows how to do a simple port forwarding with fwbuilder ?

Thanks in advance.

Best Answer

It looks like the problem is that when you created the TCP service for port 222 you set the source port of the TCP object to be 222, what you need is to have the destination port set to 222. Make sure to set the source port back to 0 (start and end value).

There is an example of this configuration in our Users Guide here:

http://www.fwbuilder.org/4.0/docs/users_guide/ch08s03s03.html