Postgresql connection refused
        Posted  
        
            by 
                Jonathan
            
        on Super User
        
        See other posts from Super User
        
            or by Jonathan
        
        
        
        Published on 2014-08-19T20:41:42Z
        Indexed on 
            2014/08/19
            22:23 UTC
        
        
        Read the original article
        Hit count: 340
        
postgresql
I'm trying to remotely connect to my postgresql database. I have two virtual machines set up both running ubuntu 14.04. I am trying to connect to the second vm using the first vm using
psql -h 10.0.1.23 -U postgres -d postgres
But I receive the error:
Could not connect to server: Connection refused
    Is the server running on host "10.0.1.23" and accepting
    TCP/IP connections on port 5432?
I have changed the pg_hba.conf and added
host all all 10.0.1.64/24 md5
host all all * md5
host all all 0.0.0.0/0 md5
And changed the postgresql.conf listen_address=" * "
In an attempt to allow all incoming connections. I have also tried to change the firewall settings, but I am unsure of whether or not the ports are properly listening for the connection.
Edit: Output of
netstat -an | grep -E '^tcp[^6].*LISTEN'
tcp   0   0 127.0.1.1:53   0.0.0.0:*    LISTEN
tcp   0   0 0.0.0.0:22     0.0.0.0:*    LISTEN
tcp   0   0 127.0.0.1:631  0.0.0.0:*    LISTEN
tcp   0   0 0.0.0.0:23     0.0.0.0:*    LISTEN
tcp   0   0 127.0.0.1:5432 0.0.0.0:*    LISTEN
© Super User or respective owner