Cannot connect from local network to my postgresql server

From: dlefebvre <dlefebvre(at)synotis(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cannot connect from local network to my postgresql server
Date: 2015-04-09 10:00:50
Message-ID: 1428573650368-5845229.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Deole, Pushkar (Pushkar) 2015-04-09 11:03:30 Regarding bytea column in Posgresql
Previous Message Rob Sargent 2015-04-09 03:28:07 Re: Finding values of bind variables