A
A
aleksey_k2015-06-07 12:43:24
PostgreSQL
aleksey_k, 2015-06-07 12:43:24

Why does Connection Timeout occur when connecting to remote postgresql?

Good afternoon,
CentOS with postgresql on board is installed on the VPS from reg.ru, it is configured as follows:

netstat -nlp | grep 5432
tcp   0 0 0.0.0.0:5432   0.0.0.0:*  LISTEN  29609/postmaster
tcp        0      0 :::5432  :::*  LISTEN      29609/postmaster
unix  2   [ ACC ]  STREAM   LISTENING 2107633273 29609/postmaster   /tmp/.s.PGSQL.5432

When connecting from the server itself, everything works, when I try to connect from my computer, I get the following:
psql -h {hostname}
psql: could not connect to server: Connection timed out (0x0000274C/10060). Is the server running on host "{hostname}" (194.58.98.133) and accepting TCP/IP connections on port 5432?

iptables is empty. What could be causing the problem? Does reg ru have any amazon-like security settings, something like blocking ports before packets reach the server itself?
tcpdump on port 5432 on the server says:
13:30:35.017437 IP {мой IP}.53341 > {hostname}.postgres: Flags [S], seq 4004314466, win 8192, options [mss 1400,nop,wscale 2,nop,nop,sackOK], length 0
13:30:35.017470 IP {hostname}.postgres > {мой IP}.53341: Flags [S.], seq 2431652762, ack 4004314467, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 7], length 0
13:30:36.388395 IP {hostname}.postgres > {мой IP}.53341: Flags [S.], seq 2431652762, ack 4004314467, win 14600, options [mss 1460,nop,nop,sackOK,nop,wscale 7], length 0
13:30:38.018102 IP {мой IP}.53341 > {hostname}.postgres: Flags [S], seq 4004314466, win 8192, options [mss 1400,nop,wscale 2,nop,nop,sackOK], length 0

wireshark on the local computer shows that packets go to the remote server, but do not come back (completely Retransmission, no responses).
At what stage did the error occur? Firewall on VPS or after VPS, wrong routing or my ISP is blocking the connection?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sim3x, 2015-06-07
@sim3x

настроен он следующим образом:well, it looks like your postgres is only listening to unix socket, not tcp
www.cyberciti.biz/tips/postgres-allow-remote-acces...

M
mureevms, 2015-06-07
@mureevms

Do you have these settings?
In pg_hba.conf
In postgresql.conf
This config should work. If not, then either a firewall or a hoster.
194.58.98.133 IP VPS? Scanned, 5432 does not obey

A
aleksey_k, 2015-06-11
@aleksey_k

The problem was on the hoster's side, according to them, blocking of incoming connections was enabled. However, in the LC I do not have and did not have the appropriate settings. Thanks to all who responded!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question