Here is the output of the netstat
command on ubuntu 14.04 server:
admin@ibm-testbox:~$ netstat -tulnp | grep 5432
(No info could be read for "-p": geteuid()=1000 but you should be root.)
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
It seems that the port 5432 is listening to tcp traffic on loopback. The server ibm-testbox
is behind a firewall and port forwarding is used to route the public traffic to the server. But we still can not make connection to the postgres server:
PG::ConnectionBad (could not connect to server: Connection refused (0x0000274D/10061)
Is the port 5432 open?
You have to check the listening address. As you can see it is only listening on that port via the localhost IP (
127.0.0.1:5432
).The port is not open for external connections, which is the default setup and the most secure for most cases.