Postgresql – Connecting to a remote Postgres 9.1 DB

postgresql-9.1remoteUbuntu

I am running Postgres 9.1 on Ubuntu.
I have host all all my.ip.address/32 md5
set in pg_hba.conf and listen_addresses= '*' set in postgresql.conf.
Running show listen_addresses shows '*'
Running sudo netstat -ltnp | grep postgres shows

tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      28899/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN      28899/postgres

However, I sill cannot connect to the DB using pgAdmin III on my machine that is located at "my.ip.address".
What could I have missed in the set up?

Thank you.

Best Answer

You have to configure the following two files

pg_hba.conf

host all all 0.0.0.0/0 md5

postgresql.conf

listen_addresses='*'

Make sure to restart postgres service after changing the files.

You have to check if the port 5432 is open: http://www.yougetsignal.com/tools/open-ports/

If it's not then add a rule to your iptables:

iptables -A INPUT -s 0/0 -p tcp --dport 5432 -j ACCEPT

0/0: If you want anybody to access it. You can change it to a specific IP address or range of IP addresses.