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!

3 Answers 3


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?


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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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