Can't connect to PostgreSQL server running in Vagrant from host
I believe the reason you could not connect is that technically 10.0.0.0
is the network address of the range 10.0.0.0/8
(and 10.255.255.255
is the broadcast address and should also not work). The first address of each range is the network address and is not allowed to be a routable host (similarly 192.168.0.0
should fail in the same way since it's a 16-bit block).
In addition to forwarding port 5432 to another port on my host machine in my Vagrantfile, I added the following to my pg_hba.conf file in my vagrant machine, restarted postgresql, and it finally allowed me to connect from the host:
host all all 0.0.0.0/0 md5
I found the suggestion here: https://github.com/laravel/framework/issues/11339