防火牆設定正確,但連接埠仍對外關閉

防火牆設定正確,但連接埠仍對外關閉

我設定了 machien 來遠端連接到 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

相關內容