Postgres Remote Access
127.0.0.1 is the localhost address.
Your listen_addresses line is commented out (with a #), so it defaults to the localhost address.
So your postmaster 9323 postgres 3u IPv4 2875987353 TCP 127.0.0.1:5432 (LISTEN )
line is what would be expected.
If you want to be able to connect remotely, you need to modify the listen_addresses
line, and modify pg_hba.conf.
You should have a look at http://www.postgresql.org/docs/9.1/static/runtime-config-connection.html and http://www.postgresql.org/docs/9.1/static/auth-pg-hba-conf.html
- Find out your IP address by running
ifconfig eth0
(assuming that you're usingeth0
; otherwise substitute your network interface foreth0
above.) Look at the "inet addr" value. Remember this value. - Edit
postgresql.conf
, go to thelisten_addresses
line, and make it look something like:listen_addresses = 'localhost,192.168.1.66'
(Remember to replace 192.168.1.66 with your "inet addr" value from above.) - Restart Postgres via
sudo /etc/init.d/postgresql-8.4 restart
- Ensure that you have connectivity from your source (remote) system to your Postgres server via
telnet your.ip.addr.ess 5432
. - If you do have network connectivity and still cannot connect, then I recommend reading the pg-hba-conf link from @hmallett.
This line means that postgres will accept local connections:
postmaster 9323 postgres 3u IPv4 2875987353 TCP 127.0.0.1:5432 (LISTEN
You need either to set the listen line in your config file to 0.0.0.0
or your interface IP address.