When I run netstat -a | findstr :5432 I get:
TCP 0.0.0.0:5432 PDDV-Answers:0 LISTENING
TCP 127.0.0.1:5432 PDDV-Answers:53925 ESTABLISHED
...
TCP 127.0.0.1:53931 PDDV-Answers:5432 ESTABLISHED
TCP [::]:5432 PDDV-Answers:0 LISTENING
Is the postgres DB on this server listening for remote connections on 5432?
I was expecting something like:
TCP 0.0.0.0:5432 *.*:0 LISTENING
My settings in postgres have all been enabled for remote connections and listening. and I think my firewall rule in is place - yet I can't remote telnet to the server on 5432 (local telnet to it works), or establish a database connection from my remote server which is my ultimate objective.
Craig Ringer was correct. The system is listening fine. There was a corporate firewall which was blocking access into the server.
In addition I needed to add additional access rules via the pg_hba.conf file for the servers own IP number
host all all a.b.c.d/32 md5
To allow it to connect to itself via Telnet. That was how I proved it was a corporate firewall problem
Related
I have set up Postgresql on a remote server, and for some reason I cannot connect to the 5432 port on the server even after opening up the port, deactivating firewall, etc.
I have checked that the database is listening to all addresses with
listen_addresses = '*':
postgresql.conf:
SHOW listen_addresses:
changed pg_hba.conf:
checked that port number 5432 is open and listening with
netstat -nlp | grep 5432
checked that firewall is inactive with sudo ufw status
and still I get Operation timed out error message after performing both
nc -v [ip_address] 5432
watch "nc -v [ip_address] 5432"
Can anyone tell me what I can do to enable connection to the remote server from external network?
I am a newbie to connections. I ran the following command on my ubuntu server:
lsof -nP -iTCP -sTCP:LISTEN
and this came up, among other connections:
postgres 29826 postgres 7u IPv6 192275 0t0 TCP [::1]:5432 (LISTEN)
postgres 29826 postgres 8u IPv4 192276 0t0 TCP 127.0.0.1:5432 (LISTEN)
I am configuring my "ufw" firewall and trying to understand what is connecting to my server. Question is the following:
Is this connecting in some way to the internet? I am assuming it is not, since the IP address is local. Another question, is there a command to check only incoming and outcoming connections to the internet? Somewhat simplified so I can understand it better?
Thank you very much
You are right, that server is only listening on the loopback interface.
You'll have to change the listen_addresses parameter and restart PostgreSQL.
I have PHP/Mysql/FastCGI running on Windows server 2008 which has been running fine for a while, now when trying to connect to localhost I get this
No connection could be made because the target machine actively refused it
I have tried turning the firewall off
I have tried restarting the server
Netstat -anb shows for port 80:
[svchost.exe]
TCP 0.0.0.0:80 LISTENING
[svchost.exe]
TCP [::1]:80 [::1]:49809 ESTABLISHED
Cannot obtain ownership information
TCP [::1]:49809 [::1]:80 ESTABLISHED
Could this be the problem?
This was a problem with Mysql couldn't connect because the password was wrong
Hello all :) I'm a having a little trouble connecting this.
On Windows 7 about my Debian 6 on VitualBox configured with Host-only Adapter:
>nmap -T4 -A -v 192.168.56.1
[...]
5432/tcp unknown postgresql
On the Debian, PostgreSQl is listening:
>netstat -tulpn
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 2432/postgres
tcp6 0 0 :::5432 :::* LISTEN 2432/postgres
.. and the port is opened
>iptables -nL
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0./0 tcp dpt:5432
.. and Postgres is accepting all the connections in postgresql.conf
listen-addresses = '*'
port = 5432
In Windows I have this error message from pdAdmin:
Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "192.168.56.1" and accepting TCP/IP
connections on port 5432?
If you encounter this message, please check if the server you're trying
to contact is actually running PostgreSQL on the given port.
Test if you have network connectivity from your client to the server
host using ping or equivalent tools. Is your network / VPN / SSH tunnel /
firewall configured correctly?
For security reasons, PostgreSQL does not listen on all available
IP addresses on the server machine initially. In order to access
the server over the network, you need to enable listening on the
address first.
For PostgreSQL servers starting with version 8.0, this is controlled
using the "listen_addresses" parameter in the postgresql.conf file.
Here, you can enter a list of IP addresses the server should listen
on, or simply use '*' to listen on all available IP addresses. For
earlier servers (Version 7.3 or 7.4), you'll need to set the
"tcpip_socket" parameter to 'true'.
You can use the postgresql.conf editor that is built into pgAdmin III
to edit the postgresql.conf configuration file. After changing this
file, you need to restart the server process to make the setting effective.
If you double-checked your configuration but still get this error
message, it's still unlikely that you encounter a fatal PostgreSQL
misbehaviour. You probably have some low level network connectivity
problems (e.g. firewall configuration). Please check this thoroughly
before reporting a bug to the PostgreSQL community.
Best regards
What about your pg_hba.conf file?
Have you configured it to accept connections from hosts in the 192.168.56.0 network?
Try to add this line and restart Postgres:
# VitualBox Host-Only Adapter
host all all 192.168.56.0/24 md5
If it's a testing environment you could even replace 192.168.56.0/24 with 0.0.0.0/0 and forget about it.
I'm running memcached, but can't connect. How should I start to debug this? Something appears to be stopping me connecting.
ps -elf | grep memcached
0 S lee 10744 529 0 80 0 - 30529 ep_pol 03:36 pts/22 00:00:00 /usr/bin/memcached -m 512 -p 11211 -u nobody -l 127.0.0.1
(Memcached is definitely running)
But when I try to telnet in, I get a timeout.
telnet 127.0.0.1 11211
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection timed out
Any advice would be appreciated.
Ensure that the local loopback network interface is running. It sounds like you're using a Unix system, so I would recommend running /sbin/ifconfig to see if a section labeled lo with the IP address (labeled as the inet addr) 127.0.0.1 is up and running. If not, run ifdown lo then ifup lo, this should get it going. Read your /etc/hosts file to make sure that localhost or you machine's name is bound to 127.0.0.1. And if your machine is using ipchains or iptables, ensure that those are configured to let traffic pass to 127.0.0.1 from 127.0.0.1.
These things are all fine 99% of the time, but being unable to connect to localhost is indeed odd, so a sanity check is in order.
Make sure you don't have any firewall enabled. In my case I found following entries for iptables:
target prot opt source destination
ACCEPT tcp -- example.com.internal anywhere tcp dpt:11211
ACCEPT udp -- example.com.internal anywhere udp dpt:11211
DROP tcp -- anywhere anywhere tcp dpt:11211
DROP udp -- anywhere anywhere udp dpt:11211
They allow connection only from the example.com.internal and deny from anywhere else, including localhost. To fix that I added specific rule for localhost:
ACCEPT tcp -- localhost anywhere tcp dpt:11211
ACCEPT udp -- localhost anywhere udp dpt:11211