After we installed and configure PostgreSQL properly, it is no problem to access locally, however when we access through network , we hit following error message.

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host “10.0.0.6″ and accepting TCP/IP connections on port 5432?

It is because PostgreSQL disable network access by default. It is require to do some configuration to make it work.

1) Please access postgresql.conf file.

PostgreSQL-Network-Access-1

2) Modified it and uncomment listen_addresses field and put ‘*’ to indicate allow access from all network address.

PostgreSQL-Network-Access-2

3) Please access pg_hba.conf and put this line , 10.0.0.0 is my network, please change it accordingly

host all all 10.0.0.0/24 trust

PostgreSQL-Network-Access-3

Please access PostgreSQL documentation to understand what inside pg_hba.conf and how to configure it
http://www.postgresql.org/docs/8.2/interactive/auth-pg-hba-conf.html

After all done, PostgreSQL is ready to access through network, actually i find out this feature is very useful, because it can restrict network access from specified ip address or network.

This article was posted in PostgreSQL category.