Linux Ubuntu 无法连接 ssh connect to host port 22: Connection timed out

gxlonline · June 23, 2018 · Last by pynix replied at June 24, 2018 · 23200 hits

Google 了一圈,还是没找出原因,水平不高,所以只能来寻求帮助了。

服务器是阿里云,Ubuntu14.04。

以前一直使用正常,网站现在也能访问,Ping 也没问题,今天本地运行"mina deploy"时,就一直提示 Connection timed out。

ssh 连不上

ssh deploy@IP
# 这中间要等很久,几分钟。
ssh: connect to host IP port 22: Connection timed out

阿里云后台安全组配正常

授权策略    协议类型    端口范围    授权类型    授权对象    
允许  自定义 TCP   22/22 地址段访问   0.0.0.0/0

登录阿里云自带的管理终端查看(这里又能登录上去,不过是在网页端),防火墙是关闭的。

端口情况

sudo netstat -plnt
Active Internet connections (only servers)
Proto    Recv-Q    Send-Q   Loca Address    Foreign Address    State    PID/Program name
Tcp    0    0    0.0.0.0:22  0.0.0.0:*    LISTEN    906/sshd    

我在本地用 Ubuntu 和 Windows 连接都是这样。 麻烦各位帮忙看下,还有什么原因会这样,怎么解决,谢谢!

加个 -v 给看一下日志详情。

香港阿里云吧。

@pynix 是国内的。

@nightire-v 的日志

ubuntu@ubuntupc:~$ ssh deploy@IP -v
OpenSSH_7.6p1 Ubuntu-4, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to IP [IP] port 22.
debug1: connect to address IP port 22: Connection timed out
ssh: connect to host IP port 22: Connection timed out

vim /etc/ssh/ssh_config

Host *
    SendEnv LANG LC_*
    HashKnownHosts Yes
    GSSAPIAuthentication Yes
    GssAPIDelegateCredentials no

vim /etc/ssh/sshd_config (不好意思,网页端无法粘贴)

不知道本地的网络环境是否有变化? 比如,在广电网中 SSH 会 time out。

是不是连着代理啊,把系统代理关了,或加入例外

@lana 这....,还真是网络环境的问题。

用手机开个热点,用 4G 居然就可以了。

宽带和手机都是移动的,然而把路由器重启也不行。难道要用 ssh 我只得开热点了,这操作真是...。

搞不懂上网都是正常的,偏偏 ssh 用不起,难道是移动做了什么限制。

@ThxFly 没有开代理。

Reply to gxlonline

22 端口没了吧。。

gxlonline closed this topic. 25 Jun 16:14
You need to Sign in before reply, if you don't have an account, please Sign up first.