Re: Connect to Postgres problems

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Christine Penner <christine(at)ingenioussoftware(dot)com>
Cc: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Connect to Postgres problems
Date: 2010-02-02 03:17:25
Message-ID: 4B679945.2010901@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christine Penner wrote:
> I'm having trouble getting a connection to Postgres to work from
> outside of my local network. It was working fine at one point. Then I
> had to change IP addresses and I can't get it to work. This is what
> I've done.
>
> On the computer with Postgres installed I have this in the pg_hba.conf
> file:
> host all all 207.6.93.152/32 md5

This will only allow the host at 207.6.93.152 to connect. If you're
trying to reach the database from any other system, that won't work.

> I know the user name and password etc are correct because I can
> connect locally using the same stuff. The only things that have
> changed since it was working is IP addresses. I confirmed they are
> right. Also when trying to get it working I noticed that the port
> forwarding got disabled somehow so I set that up again but still no luck.

Generally the troubleshooting works like this:

1) Confirm psql connects from the host (with the default, sockets based
connection)
2) Confirm psql connects using TCP/IP on that same host. So "psql -h
<server ip>" on the server itself. If that doesn't work, probably an
issue with listen_addresses or pg_hba.conf
3) Connect to the database from another host on the same local network.
If this fails, check pg_hba.conf again, and make sure the server's
firewall is configured to allow connections to the port
4) Connect from an outside network. Now any problem you have should be
limited to just being related to things like port forwarding.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yan Cheng Cheok 2010-02-02 03:38:19 Use Trigger to Remove Table itself when there is no row after delete
Previous Message Ivan Sergio Borgonovo 2010-02-02 01:11:13 reducing result set of tsvector @@ tsquery avoiding to use ts_rank