LKBEN11152: Howto make shure postgres will listen on the network


Postgresql listens per default on localhost. To change this you need to configure it in postgresql.conf




On a debian system you will find your configuration files in e.g.


As you can see, the path depends on the version of postgres you are using. To make postgres listen on all your network cards you will have to change the default configuration which only listens on localhost connections.

You should look for the listen_addresses and port entries.

To make postgres listen on all your ip addresses you will have to set listen_addresses to:

listen_addresses = '*'
port = 5432

You could also change the default port to listen on! If you try to make a connection, it will probably be refused. Your error message has changed, but it does not work yet. This is due to the default pg_hba.conf. You will have to make changes here too!


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.

Latest update: 31/12/2020 | Comment: