ssh为什么出现连接超时错误?

分享于 

2分钟阅读

互联网

  繁體

ssh: connect to username@<public ip address> port 22: Connection timed out

ssh -v example.com. OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 debug1: Connecting to example.com [93.184.216.34] port 22. debug1: connect to address 93.184.216.34 port 22: Connection timed out ssh: connect to host example.com port 22: Connection timed out

Pinging 1.1.1.1 with 32 bytes of data: Reply from 1.1.1.1: bytes=32 time=23ms TTL=54 Reply from 1.1.1.1: bytes=32 time=74ms TTL=54 Reply from 1.1.1.1: bytes=32 time=26ms TTL=54 Reply from 1.1.1.1: bytes=32 time=24ms TTL=54 Ping statistics for 1.1.1.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 23ms, Maximum = 74ms, Average = 36ms

ssh -v -p 2200 example.com OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 debug1: Connecting to example.com [93.184.216.34] port 2200. debug1: connect to address 93.184.216.34 port 2200: Connection timed out ssh: connect to host example.com port 2200: Connection timed out


如果目标服务器未侦听默认ssh端口(22 ),连接将不响应。

联系服务器提供程序,并询问SSH在哪个端口上运行,因为某些人会将SSH端口从默认的(22 )更改为不同的端口,以减轻安全攻击。

例子:对于不同的端口,你可以尝试下面的命令,假设ssh port (2200 )

ssh -p 2200 user@example.com 

或者

ssh -p 2200 user@ipaddress 

答案2:

连接超时:可能的原因可能是服务器没有侦听或没有响应


# ping pub.licip.add.ress (ie ping 1.1.1.1)



如果响应类似于 icmp_seq=1 ttl=58 time=134 ms ->,然后


# username@<public ip address> -p 22



如果第一步出现Connection timed out错误,那么确保ssh运行在远程计算机上,你尝试ssh,然后再试一次