You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Debian 11端口已监听但无法连接问题求助

无法远程连接Debian 11服务器上的PostgreSQL 5432端口问题

我尝试使用pgAdmin连接远程Debian 11服务器上的PostgreSQL时,出现错误:

Unable to connect to server: connection to server at "XXX.XX.XXX.XX" port 5432 failed: timeout expired.

在远程服务器上执行ss -tnlp命令,结果如下:

State     Recv-Q    Send-Q       Local Address:Port       Peer Address:Port    Process
LISTEN    0         128                0.0.0.0:22              0.0.0.0:*        users:(("sshd",pid=106,fd=3))
LISTEN    0         64                 0.0.0.0:5432            0.0.0.0:*        users:(("postgres",pid=111,fd=5))
LISTEN    0         20               127.0.0.1:25              0.0.0.0:*        users:(("exim4",pid=407,fd=4))
LISTEN    0         1                  0.0.0.0:5555            0.0.0.0:*        users:(("nc",pid=477,fd=3))
LISTEN    0         128                   [::]:22                 [::]:*        users:(("sshd",pid=106,fd=4))
LISTEN    0         64                    [::]:5432               [::]:*        users:(("postgres",pid=111,fd=6))
LISTEN    0         20                   [::1]:25                 [::]:*        users:(("exim4",pid=407,fd=5))
LISTEN    0         100                      *:8080                  *:*        users:(("java",pid=606,fd=21))
LISTEN    0         511                      *:80                    *:*        users:(("node",pid=579,fd=17))

我的pg_hba.conf配置如下:

# "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
#IPv4 remote connections:
host    all             all             0.0.0.0/0               md5
#IPv6 remote connections:
host    all             all             ::0/0                   md5

补充测试情况:

  • 用telnet连接5432端口,长时间后报错:telnet: Unable to connect to remote host: Connection timed out.
  • 在远程服务器上执行nc -l -v 5555 &开启端口监听,用其他电脑通过telnet或nc -zv XXX.XX.XX.XX 5555连接,同样报错:Unable to connect to remote host: Connection timed out.
  • 但telnet连接22、8080、80端口均可正常工作
  • 服务器UFW已禁用

请问有人能解释为何我无法访问服务器的5432端口吗?感谢。


内容的提问来源于stack exchange,提问作者Zalox9

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 10:06:27