LKBEN11152: Howto make shure postgres will listen on the network


This article has not been checked!

LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False

Author: Wim Peeters - Keskon GmbH & Co. KG


Symptom

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

Cause

none

Solution

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

/etc/postgresql/8.3/main/

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!

About the Author

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 in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.

Disclaimer:

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!