防火墙设置正确,但端口仍然关闭

防火墙设置正确,但端口仍然关闭

我设置了机器来远程连接 postgresql 我检查了一些东西,发现一切都是正确的

检查端口状态:

$> sudo netstat -tulpn | grep LISTEN | grep 5432

tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 18134/postgres

检查防火墙

$> sudo ufw status | grep 5432

5432 ALLOW Anywhere

Ping 内机工作情况:

$> telnet 185.235.x.x 5432

Connected to 185.235.x.x

但是当从机器外部调用时

 $> telnet 185.235.x.x 5432
  
 Connecting ... (And then timeout)

我还应该做什么?

更新

pg_hba.cof:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5
host    all             all             0.0.0.0/0               md5

相关内容