Getting "network unreachable" when connecting to postgres from external

Hi all, I’m really enjoying the Fly experience so far!!

I’m having a little trouble connecting directly to my Postgres DB though. I was hoping to do a little testing by changing the DB directly so followed the instructions here:

I (think I) followed the instructions diligently but when I come to connect to the database using the psql command, I get the following error:

psql: error: connection to server at "holy-sunset-516-db.fly.dev" (IPv6 address), port 5432 failed: Network is unreachable
	Is the server running on that host and accepting TCP/IP connections?

Does anyone have any suggestions what I could have done wrong?

Hi @dnnrly—perhaps you’ve already checked this, but did you add an IPv4 address to your app (see fly ips list)? I don’t see one in the DNS for holy-sunset-516-db.fly.dev, and if you have IPv4-only Internet access you might see a “network unreachable” error like this.

(Also note that for non-HTTP apps like Postgres, you’ll need a dedicated IPv4 address, not a shared IPv4 address.)

I hadn’t checked this - I had stupidly assumed that one of the largest ISPs in the UK (who shall remain Very naMeless) supported IPv6. A very long article on the internet explained that I was wrong in this assumption. I was avoiding IPv4 as this has a cost implication that I’m trying to avoid right now.

Thanks for pointing me in the right direction!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.