0

Everything was working in my previous office. I've now moved to a new office, and cannot connect remotely to postgres. SSH works though. My IP is currently 70.90.155.138.

Could not connect to server: connection timed out

IP tables config:

#  Allpw postgres connections
-A INPUT -p tcp --dport 5432 -s 70.90.155.138/16 -j ACCEPT


iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
REJECT     all  --  anywhere             loopback/8           reject-with icmp-port-unreachable
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpts:http-alt:8090
ACCEPT     udp  --  anywhere             anywhere             udp dpts:60000:61000
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
ACCEPT     tcp  --  70.90.0.0/16         anywhere             tcp dpt:postgresql

pg_hba.conf:

local   all             postgres                                md5
host    all             all             0.0.0.0/0               md5

Listen_addresses is set correctly and not commented:

listen_addresses = '*' 

Postgres is running:

/etc/init.d/postgresql status
Running clusters: 9.1/main

and listening:

sudo /etc/init.d/postgresql status
Running clusters: 9.1/main
user1@finance1:/var/log$ sudo netstat -nlp | grep 5432
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      17772/postgres
tcp6       0      0 :::5432                 :::*                    LISTEN      17772/postgres
unix  2      [ ACC ]     STREAM     LISTENING     5667832  17772/postgres      /var/run/postgresql/.s.PGSQL.5432

And I'm not seeing any failed connections in the IPtables log:

tail -5000 /var/log/kern.log | grep DPT=5432

What have I failed to check here? What could cause this to stop working when the only thing that has changed is the location of my laptop?

Jeremy T
  • 101
  • 4
  • 1
    is there a new firewall in your new location that might be blocking the port, or even the ISP perhaps? maybe try allowing from anywhere temporarily to see if there's a problem with the ip address you're allowing? – user16081-JoeT Jul 29 '14 at 17:11
  • I agree that it seems likely it's being blocked on my network. Unfortunately, I don't have access there, so it looks like I'm going to have to see if I can find someone who can help. – Jeremy T Jul 29 '14 at 18:35
  • Also, I managed to connect to the database from another box outside my current network, so it looks like I'm being blocked somewhere. – Jeremy T Jul 29 '14 at 18:49
  • 1
    Try running traceroute using different port numbers to see where the packets are being blocked. For example `traceroute -n -T -p 5432 example.com` – kasperd Jul 29 '14 at 19:44

0 Answers0