When I ping my server, it responds:
当我ping服务器时,它会响应:
user@localhost:~$ ping my.server
PING my.server (111.111.111.11) 56(84) bytes of data.
64 bytes from my.server (111.111.111.11): icmp_req=1 ttl=42 time=38.4 ms
64 bytes from my.server (111.111.111.11): icmp_req=2 ttl=42 time=50.0 ms
64 bytes from my.server (111.111.111.11): icmp_req=3 ttl=42 time=58.6 ms
^C
--- my.server ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 38.419/49.037/58.637/8.287 ms
but when I try to ssh (something that I always do, and have been doing for the past few hours on the same connection), it hangs:
但是,当我尝试ssh(我总是这样做,并且在过去的几个小时内一直在做相同的连接)时,它挂起了:
user@localhost:~$ ssh my.server
http://speedtest.net says that my connection has 1.5 Mbps download and 0.4 Mbps upload speed.
http://speedtest.net说我的连接有1.5 Mbps下载和0.4 Mbps上传速度。
Is there a reason that ssh hangs?
为什么有ssh挂起?
Results from suggestions provided in answers
根据答案提供的建议结果。
from @nsfyn55
从@nsfyn55
user@localhost:~$ telnetmy.server 22
Trying 111.111.111.11...
Connected to my.server
Escape character is '^]'.
SSH-2.0-OpenSSH_4.3
Connection closed by foreign host.
from @vahid:
从@vahid:
user@localhost:~$ nc -v -w 1 111.111.111.111 -z 22
nc: timeout cannot be negative
3 个解决方案
#1
18
ping (ICMP protocol) and ssh are two different protocols.
ping (ICMP协议)和ssh是两种不同的协议。
-
It could be that ssh service is not running or not installed
可能是ssh服务没有运行或没有安装。
-
firewall restriction (local to server like iptables or even sshd config lock down ) or (external firewall that protects incomming traffic to network hosting 111.111.111.111)
防火墙限制(本地到服务器,如iptables,甚至是sshd配置锁定)或(保护incomming流量的外部防火墙,以网络托管111.111.111.111)
First check is to see if ssh port is up
首先检查ssh端口是否向上。
nc -v -w 1 111.111.111.111 -z 22
if it succeeds then ssh should communicate if not then it will never work until restriction is lifted or ssh is started
如果它成功,那么ssh应该通信,否则它将永远不会工作,直到限制解除或ssh启动。
#2
5
Find out two pieces of information
找出两条信息。
- Whats the hostname or IP of the target ssh sever
- 目标ssh服务器的主机名或IP是什么。
- What port is the ssh daemon listening on (default is port 22)
- 什么端口是ssh守护进程监听(默认是端口22)
$> telnet <hostname or ip> <port>
$> telnet <主机名或ip> <端口> 。
Assuming the daemon is up and running and listening on that port it should etablish a telnet session. Likely causes:
假设守护进程已经启动并在该端口上运行和侦听,它应该etablish一个telnet会话。可能的原因:
- The ssh daemon is not running
- ssh守护进程没有运行。
- The host is blocking the target port with its software firewall
- 主机通过其软件防火墙阻止目标端口。
- Some intermediate network device is blocking or filtering the target port
- 一些中间网络设备阻塞或过滤目标端口。
- The ssh daemon is listening on a non standard port
- ssh守护进程正在监听非标准端口。
- A TCP wrapper is configured and is filtering out your source host
- 配置TCP包装器并过滤掉源主机。
#3
-2
On the server, try:
在服务器上,试题:
netstat -an
and look to see if tcp port 22
is opened (use findstr
in Windows or grep
in Unix).
查看tcp端口22是否被打开(在Windows中使用findstr或在Unix中使用grep)。
#1
18
ping (ICMP protocol) and ssh are two different protocols.
ping (ICMP协议)和ssh是两种不同的协议。
-
It could be that ssh service is not running or not installed
可能是ssh服务没有运行或没有安装。
-
firewall restriction (local to server like iptables or even sshd config lock down ) or (external firewall that protects incomming traffic to network hosting 111.111.111.111)
防火墙限制(本地到服务器,如iptables,甚至是sshd配置锁定)或(保护incomming流量的外部防火墙,以网络托管111.111.111.111)
First check is to see if ssh port is up
首先检查ssh端口是否向上。
nc -v -w 1 111.111.111.111 -z 22
if it succeeds then ssh should communicate if not then it will never work until restriction is lifted or ssh is started
如果它成功,那么ssh应该通信,否则它将永远不会工作,直到限制解除或ssh启动。
#2
5
Find out two pieces of information
找出两条信息。
- Whats the hostname or IP of the target ssh sever
- 目标ssh服务器的主机名或IP是什么。
- What port is the ssh daemon listening on (default is port 22)
- 什么端口是ssh守护进程监听(默认是端口22)
$> telnet <hostname or ip> <port>
$> telnet <主机名或ip> <端口> 。
Assuming the daemon is up and running and listening on that port it should etablish a telnet session. Likely causes:
假设守护进程已经启动并在该端口上运行和侦听,它应该etablish一个telnet会话。可能的原因:
- The ssh daemon is not running
- ssh守护进程没有运行。
- The host is blocking the target port with its software firewall
- 主机通过其软件防火墙阻止目标端口。
- Some intermediate network device is blocking or filtering the target port
- 一些中间网络设备阻塞或过滤目标端口。
- The ssh daemon is listening on a non standard port
- ssh守护进程正在监听非标准端口。
- A TCP wrapper is configured and is filtering out your source host
- 配置TCP包装器并过滤掉源主机。
#3
-2
On the server, try:
在服务器上,试题:
netstat -an
and look to see if tcp port 22
is opened (use findstr
in Windows or grep
in Unix).
查看tcp端口22是否被打开(在Windows中使用findstr或在Unix中使用grep)。