Reputation: 11
I can't get remote access to my PostgreSQL server in Ubuntu16.04 VM instance in google cloud from my laptop. I've added my laptop IP to pg_hba.conf in Google Cloud and tried both "md5" and "Trust" methods:
#IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all [mylocalIP]/32 md5
Furthermore I've tried both * and [mylocalIP] in postgresql.conf:
# - Connection Settings
listen_addresses = '*' # what IP address(es) to listen on;
In google cloud firewall i've following setup
default-allow-http http-server IP ranges: 0.0.0.0/0 tcp:80 Allow 1000 default
default-allow-https https-server IP ranges: 0.0.0.0/0 tcp:443 Allow 1000 default
default-allow-psql Apply to all IP ranges: 0.0.0.0/0 tcp:5432Allow 1000 default
Laptop Apply to all IP ranges: [mylocalIP]/32 all Allow 1000 default
Also I can putty to my Google Cloud VM instance with SSH key, so I can have some remote connection.
I think this is Google Cloud firewall issue cause I can use remote connection to my postgreSQL server in my local VM (win 2012 server) with following setup without problems.
Thanks in advance!
Upvotes: 1
Views: 1100
Reputation: 1
In your pg_hba.conf file, try adding the line
host all all 0.0.0.0/0 md5
Your firewall rules appear to be correct. You only need the rule tcp:5432
for ip ranges 0.0.0.0/0
Upvotes: 0