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

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

where 123.45.67.89 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
add comment

3 Answers

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
add comment

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
add comment

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
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.