I have a VM with IP address 192.168.0.192 running postgreSQL.

If I specify

listen_addresses = '*'


then I can connect from another VM at 192.168.0.191 and from localhost.

But I can't seem to use a list to tell postgreSQL to use those two addresses.  If I change listen_addresses to a list:

listen_addresses = '192.168.0.191, localhost'


then I can no longer connect from 192.168.0.191.

I notice that almost all examples on stackexchange set listen_addresses to '*'.  Is this because the list form does not work?

Yes, listen_addresses can be set to a list of addresses on the local host to bind to for listening.

In your example:


  listen_addresses = '192.168.0.191, localhost'


If the local machine has IP 192.168.0.192, you should specify that IP, not the remote host 192.168.0.191 IP. PostgreSQL cannot bind to the IP address of a remote host.

You're not saying "who is allowed to connect", you're saying "which interfaces should PostgreSQL accept connections on". The "who's allowed to connect" bit is next, and is configured in pg_hba.conf.

So: Try '192.168.0.192, localhost'. Or just *, since you probably actually want to listen on all network interfaces.
