Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't get iptables port forwarding to work. I think I have it set up correctly on the gateway, but I'm now doubting if the target machine might be the problem. If I set up forwarding from machine A on the Internet to machine C on the lan, with machine B being the gateway, would machine C's firewall then have to allow connections from the ip of B, or of A or..?

share|improve this question
unless you provide your iptables ruleset, nobody can objectively help you. – Olipro Jan 17 '12 at 18:35
are you sure its forwarding? is the iptables counter incrementing? does a tcpdump show the packet after it leaves machine B? Also as Khaled asked in an answer, we need to know how youre forwarding. – Patrick Jan 17 '12 at 23:24
up vote 0 down vote accepted

This is depends on your firewall rules. If you are doing SNATing, then you need to allow this IP (NATed IP). If you are just forwarding the packet without doing SNAT, you need to allow the original sender IP.

share|improve this answer
thanks..with tcpdump I saw that it was indeed arriving at C, so opened the firewall there and it works now. – datadevil Jan 18 '12 at 10:02

Your Answer


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.