Re: Cannot connect from local network to my postgresql server

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: dlefebvre <dlefebvre(at)synotis(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Cannot connect from local network to my postgresql server
Date: 2015-04-09 13:28:34
Message-ID: 55267E82.5030601@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/09/2015 03:00 AM, dlefebvre wrote:
> Hi,
>
> I use ubuntu 14.01 and i install a postgresql 9.3 server. I want to connect
> an other pc from local network to this server. But the server seems to only
> listen on localhost.
>
> There is the conf files :
>
> pg_hba.conf :
>
> # TYPE DATABASE USER ADDRESS METHOD
>
> # IPv4 local connections:
> host all all 127.0.0.1/32
> @authmethodhost@
> # IPv6 local connections:
> host all all ::1/128
> @authmethodhost@
> # Allow replication connections from localhost, by a user with the
> # replication privilege.
> #local replication @default_username@
> @authmethodlocal@
> #host replication @default_username@ 127.0.0.1/32
> @authmethodhost@
> #host replication @default_username@ ::1/128
> @authmethodhost@
>
> host all all 192.168.1.127 255.255.255.0 md5
>
> (192.168.1.127 is the ip of the pc i want to connect)
>
> postgresql.conf (with the only lines i changed) :
>
> # - Connection Settings -
>
> tcpip_socket = true
>
> listen_addresses = '*' # what IP address(es) to listen on;
> # comma-separated list of addresses;
> # defaults to 'localhost'; use '*' for all
> # (change requires restart)
> port = 5432 # (change requires restart)
>
> my iptables are setup :
>
> :~$ sudo iptables -L
> [sudo] password for dlefebvre:
> Chain INPUT (policy ACCEPT)
> target prot opt source destination
> ACCEPT tcp -- anywhere anywhere tcp
> dpt:postgresql
>
> Chain FORWARD (policy ACCEPT)
> target prot opt source destination
>
> Chain OUTPUT (policy ACCEPT)
> target prot opt source destination
> ACCEPT tcp -- anywhere anywhere tcp
> dpt:postgresql
> :~$
>
> and so, using netstat it seems like the server only listen on localhost :
>
> :~$ netstat -lt
> Active Internet connections (only servers)
> Proto Recv-Q Send-Q Local Address Foreign Address State
> tcp 0 0 dlefebvre-ubuntu:domain *:* LISTEN
> tcp 0 0 localhost:ipp *:* LISTEN
> tcp 0 0 localhost:postgresql *:* LISTEN
> tcp6 0 0 ip6-localhost:ipp [::]:* LISTEN
> :~$
>
> Logs dosen't show any errors and of course the server is running, i can
> access in localhost without any trouble.
>
> I google all link i could found, every people who had the same issue made
> mistake in configuration file. I think i am not, this is why i request your
> help.
>
> Thanks for your time, i stay avaible if you need any more information.

So did you restart Postgres after making the changes to postgresql.conf?

Are you sure you are working on the correct postgresql.conf file?

Or to put it another way is there more than one instance of Postgres on
the machine?

What error do you get on the remote client end when you try to connect?

>
> Cheers, Damien Lefebvre.
>
>
>
>
> --
> View this message in context: http://postgresql.nabble.com/Cannot-connect-from-local-network-to-my-postgresql-server-tp5845229.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc-André Goderre 2015-04-09 13:40:16 Using array_agg in pgr_kdisjkstrpath()
Previous Message Glyn Astill 2015-04-09 12:43:56 Re: unexpected (to me) sorting order