Thread: Cannot connect from local network to my postgresql server
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.
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.klaver@aklaver.com
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.
I'm running 9.3.6 on Fedora 21 x86_64.
There is the conf files :
pg_hba.conf :
<snip>
Mine looks about the same.
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)
I have this commented out entirely in my configuration. I.e>
#listen_address = 'localhost"
port = 5432 # (change requires restart)
my iptables are setup :
As best as I can tell, this looks OK.
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
:~$
My netstat -lt shows
<quote>
netstat -lt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:postgres 0.0.0.0:* LISTEN
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:postgres [::]:* LISTEN
</quote>
Note that my entry for postgres shows 0.0.0.0:* instead of *:*
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.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
If you sent twitter messages while exploring, are you on a textpedition?
He's about as useful as a wax frying pan.
10 to the 12th power microphones = 1 Megaphone
Maranatha! <><
John McKown
He's about as useful as a wax frying pan.
10 to the 12th power microphones = 1 Megaphone
Maranatha! <><
John McKown