We are trying to access (server1)postgresql port 5432 on a different server(server 2) but we are not able to reach it.

Checking done:

  • port 5432 running/listening postgresql.conf
  • listening address okay:listen_addresses = '*'
  • pg_hba.conf also good: host all all md5

  • firewall is also okay since packet trace results shows that server1 has been reached but denied by the server/application/db

  • Firewalld is off and allowed tcp on port 5432 in iptables.

Any other suggestions or possible cause why can't we establish the connection?

  • What is the error that you received? – Michael Hampton May 23 at 0:35
  • The telnet only shows us that it's only trying to connect. But we had a tcpdump running on server1(postgresql server) and there was a hit but the connection is not establishing. – faolores May 23 at 0:51
  • 1
    If the connection isn't establishing there's something wrong at the network or firewall level. Also try to telnet localhost 5432 from server1 to make sure postgresql is working without the network in the middle. – chicks May 23 at 1:31
  • 1
    Yup, I did that earlier, connection to itself is working properly. I've been thinking of the network too but its able to reach my server when traced via tcpdump. – faolores May 23 at 1:38
  • 1
    @chicks comment is on target, but also try telnet (server1 IP) 5432 from server1 to ensure it is listening on the public IP. If that is good, then turn the firewalld/iptables/whatever off temporarily, or set it to pass everything. Then test again. If it works, then the problem is your firewalld/iptables/whatever. – Jim L. May 23 at 23:25

Your Answer

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

Browse other questions tagged or ask your own question.