remote postgresql 9.3 login using pgadmin3 and a public network server to connect to LAN-only machine I want to connect to a machine running postgresql 9.3. The machine itself is not reachable via a direct IP but is in a LAN with another machine with a public IP address.

My current approach is:

changing postgresql.conf:

/..../ 
listen_addresses = '*'
port = 5432
/..../


adding to pg_hba.conf:

/..../
host    all        all        192.168.59.1/24       trust
/..../


(of cause restarting the postgres service)

connecting to the public server via:

ssh -L 9999:192.168.59.130:5432 user@theip


which works just fine (I am logged in without any error message)

But when I try to connect pgadmin3 using:

name: randomName
Host: 127.0.0.1
Port: 9999
Service:
Maintenance DB: postgres
Username: postgres
Pasword: *********
Colour:
Group: Servers


I get:
Server doesn't listen ....

checking sudo netstat -tulpn shows:

tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      8860/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN      8860/postgres


Therefore postgres seems to listen for LAN addresses though I get a "do not listen".

How do I fix that?
changing

host    all        all        192.168.59.1/24       trust


to

host    all        all        samenet       trust


did the trick for me. Though the difference between the two stays a secret for me.