Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Do you have also have the corresponding rule in your INPUT chain? –  Scott Pack Jan 19 '11 at 20:58
    
No, I have nothing more for this rule in the automatically generated iptables script. –  gandalfos Jan 19 '11 at 22:48
add comment

2 Answers 2

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

share|improve this answer
    
You were completely right! Combined with vadimk suggestion, now it works! Many thanks. –  gandalfos Jan 21 '11 at 13:35
add comment

Note that you also need to add a policy rule to permit tcp 22 to your local machine. Put object that represents your machine in "Destination " of this rule and object that represents ssh in "Service". The Users Guide chapter linked in the previous answer has an example.

share|improve this answer
    
Thanks for your advise, it works! –  gandalfos Jan 21 '11 at 13:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.