3

Trying to connect to my PSQL database on my CentOS VM from my Mac using pgAdmin3. Getting the following error:

Access to database denied
The server doesn't grant access to the database: the server reports 
FATAL: no pg_hba.conf entry for host "172.16.30.1", user "gpadmin", database "postgres", SSL off 

The VM's IP address is 172.16.30.139 and hence I'm using it as a host. I have added the following into my pg_hba.conf file:

local all     gpadmin     ident
#host all     gpadmin     127.0.0.1/28      trust
#host all     gpadmin     192.168.249.131/32    trust
local gpperfmon   gpmon                             md5
host     all     all     192.168.2.109   md5

Where 192.168.2.109 is my Macs internal IP address.

Any help would be appreciated.

Edit:

I also ran a tcpdump and then tried connecting and see the following logs (but I don't know how to read them):

11:00:03.740455 IP 172.16.30.1.58043 > 172.16.30.139.postgres: S 3397342885:3397342885(0) win 65535 <mss 1460,nop,wscale 3,nop,nop,timestamp 837321186 0,sackOK,eol>
11:00:03.740500 IP 172.16.30.139.postgres > 172.16.30.1.58043: S 3408844558:3408844558(0) ack 3397342886 win 5792 <mss 1460,sackOK,timestamp 74855527 837321186,nop,wscale 7>
11:00:03.740630 IP 172.16.30.1.58043 > 172.16.30.139.postgres: . ack 1 win 65535 <nop,nop,timestamp 837321186 74855527>
11:00:03.740650 IP 172.16.30.1.58043 > 172.16.30.139.postgres: P 1:9(8) ack 1 win 65535 <nop,nop,timestamp 837321186 74855527>
11:00:03.740660 IP 172.16.30.139.postgres > 172.16.30.1.58043: . ack 9 win 46 <nop,nop,timestamp 74855527 837321186>
11:00:03.744513 IP 172.16.30.139.postgres > 172.16.30.1.58043: P 1:2(1) ack 9 win 46 <nop,nop,timestamp 74855531 837321186>
11:00:03.744740 IP 172.16.30.1.58043 > 172.16.30.139.postgres: . ack 2 win 65535 <nop,nop,timestamp 837321190 74855531>
11:00:03.744816 IP 172.16.30.1.58043 > 172.16.30.139.postgres: P 9:88(79) ack 2 win 65535 <nop,nop,timestamp 837321190 74855531>
11:00:03.746083 IP 172.16.30.139.postgres > 172.16.30.1.58043: P 2:148(146) ack 88 win 46 <nop,nop,timestamp 74855533 837321190>
11:00:03.746318 IP 172.16.30.1.58043 > 172.16.30.139.postgres: . ack 148 win 65535 <nop,nop,timestamp 837321191 74855533>
11:00:03.749231 IP 172.16.30.139.postgres > 172.16.30.1.58043: F 148:148(0) ack 88 win 46 <nop,nop,timestamp 74855536 837321191>
11:00:03.749471 IP 172.16.30.1.58043 > 172.16.30.139.postgres: . ack 149 win 65535 <nop,nop,timestamp 837321194 74855536>
mlevit
  • 131
  • 4

1 Answers1

3

192.168.2.109 may be your mac's address on your internal network, but 172.16.30.1 is the mac's address on the virtual network that it uses to communicate with the VM, and that's the address you need to configure in pg_hba.conf.

DerfK
  • 19,313
  • 2
  • 35
  • 51
  • @mlevit This is exactly right (in fact if you run `ifconfig` on your Mac you will even see a (virtual) interface with the IP `172.16.30.1`, which is created by your VM software...). – voretaq7 Aug 01 '12 at 15:34