无法通过端口5432上的ssh隧道连接到远程主机

我在运行Debian 8的远程主机上安装了PostgreSQL。我必须通过代理服务器使用ssh隧道来连接到这个远程。 我没有问题:

  • 在通过端口22上的ssh进行连接时,
  • 在远程主机上连接时在本地运行psql。

但是,我不能通过隧道运行psql。 我做了什么:

1)使用-vvv选项创build隧道:

ssh proxy-user@proxy-host -L localhost:2222:remote-host:5432 -N -vvv 

2)尝试通过隧道运行psql:

 psql -h 127.0.0.1 -p 2222 -U user db 

连接被拒绝,这里是第一个命令的输出:

 debug1: Connection to port 2222 forwarding to XX.XX.XX.XX port 5432 requested. debug2: fd 7 setting TCP_NODELAY debug2: fd 7 setting O_NONBLOCK debug3: fd 7 is O_NONBLOCK debug1: channel 2: new [direct-tcpip] debug3: send packet: type 90 debug3: receive packet: type 92 channel 2: open failed: connect failed: Connection timed out debug2: channel 2: zombie debug2: channel 2: garbage collecting debug1: channel 2: free: direct-tcpip: listening port 2222 for XX.XX.XX.XX port 5432, connect from 127.0.0.1 port 35206 to 127.0.0.1 port 2222, nchannels 3 debug3: channel 2: status: The following connections are open: 

有任何想法吗 ? (请详细解释一下哪些命令可以尝试,我不习惯debuggingnetworking问题)。 非常感谢。