Connecting to an external database with pgAdmin III

This line:

 host    all             all             192.168.0.0/24          md5

will let through connections from IPs matching 192.168.0.X where X is any byte.

The IP address of your error message being 192.168.108.161, it does not match this pattern because 108 is not 0.

To enable addresses like 192.168.X.Y, you'd need a /16 instead of /24 meaning that the first 16 bits only are fixed.

Like this:

 host    all             all             192.168.0.0/16          md5

Don't forget to reload Postgresql. From the official docs, use pg_ctl reload. If that doesn't work, then there are other ways to do it listed in this question.


Two things come to mind.

  1. The first is to make sure the server is listening on the network interface. By default it only listens on local host. Edit your postgresql.conf file and change:

    listen_addresses = 'localhost'
    

    To look like this instead:

    listen_addresses = '*'
    
  2. If you're connecting remotely then your postgres user needs a password. By default there is no password associated with that account so only local trust based login works. For remote password login (eg. md5 in pg_hba.conf`) to work either add a password or create a new user with a password.

Also, instead of using host in pg_hba.conf consider using hostssl to require that remote connections use SSL. Otherwise the username/password credentials are sent over the wire in plain text.