1

I have configured Postgres to accept network connections from anywhere:

In pg_hga.conf:

host all all 0.0.0.0/0 md5

In postgresql.conf:

listen_addresses = '*'

I can see the server is listening

vagrant@vagrant-ubuntu-trusty-64:~$ sudo netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name <snip> tcp 0 0 0.0.0.0:5433 0.0.0.0:* LISTEN 1570/postgres

I've configured iptables to allow incoming TCP connections to 5433

vagrant@vagrant-ubuntu-trusty-64:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:5433

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

From an ssh session in the VM, I can run telnet 10.0.2.15 5433 and it works. I can also connect with the full psql client. From my host, if I run the same telnet command or the same psql command, I can't connect.

What can be wrong and what can I check?

1

The network adapter of your VM is by default in NAT mode. This means you can't ssh/telnet/etc to you VM from outside of it. Switch to Bridged in the VM settings and it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.