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 have this rule on my iptables:

iptables -A INPUT -i eth0 -p tcp --dport 5432 -s -j ACCEPT

where is the client ip that i want to connect to my db server. can you please tell me what's the problem? this still won't allow me to connect. When i try to stop my firewall or flush the rules, i can be able to remotely connect to postgresql.

Please help. THanks!

share|improve this question

Do you have a rule for keeping state? For example '-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT'

Do you connect to the server over the eth0 interface?

share|improve this answer

There can be a rule above this one that drops that kind of packets. Please check it or show full iptables ruleset.

share|improve this answer

Thanks for all the responses. I;ve fixed it via '-I' instead of '-A' . It seems that the order of rules in iptables matter.

Hope this will help somebody in the future.

share|improve this answer

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.