DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Connections and Authentication / Connection Settings

listen_addresses

Sets the host name or IP address(es) to listen to.

  • Default: localhost
  • Type: string
  • Applies: Restart required

In plain words

A server can have several network addresses (loopback, LAN, public). listen_addresses lists the ones where PostgreSQL waits for TCP connections. The default localhost means only programs on the same machine can connect over TCP.

To let other machines connect, set it to * (all interfaces) or to specific IP addresses, restart, and then allow them in pg_hba.conf.

For DBAs and operators

The value is a comma-separated list of host names or IP addresses. * means all IPv4 and IPv6 interfaces, 0.0.0.0 all IPv4 only, :: all IPv6. An empty string disables TCP completely: only Unix-domain sockets work. The server starts if it can bind at least one listed address; failures for others are only logged, e.g. LOG: could not bind IPv4 address "10.0.0.9": Cannot assign requested address followed by WARNING: could not create listen socket for "10.0.0.9". Successful binds are logged at startup: LOG: listening on IPv4 address "0.0.0.0", port 5432.

Support pitfalls

  • Connection refused from a remote client almost always means the server is not listening on that interface (or a firewall), not an authentication problem. Check with ss -ltnp | grep 5432.
  • no pg_hba.conf entry for host … means the opposite: the TCP connection arrived, but no pg_hba.conf line matched.
  • Listening on a virtual/floating IP (e.g. a VIP managed by keepalived) that is not yet present at startup gives only a warning; the server will not bind it later without a restart. Using * avoids this.

listen_addresses is a coarse network filter; real access control is pg_hba.conf plus firewall rules.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then restart the server.

See it in context

Postmaster Client authentication Wire protocol Server startup sequence

Related parameters

port unix_socket_directories max_connections ssl

All Connections and Authentication parameters