![防火墙设置正确,但端口仍然关闭](https://linux22.com/image/1071271/%E9%98%B2%E7%81%AB%E5%A2%99%E8%AE%BE%E7%BD%AE%E6%AD%A3%E7%A1%AE%EF%BC%8C%E4%BD%86%E7%AB%AF%E5%8F%A3%E4%BB%8D%E7%84%B6%E5%85%B3%E9%97%AD.png)
我设置了机器来远程连接 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