阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

SSH服务突然连接不了案例总结

127次阅读
没有评论

共计 2192 个字符,预计需要花费 6 分钟才能阅读完成。

一台 Oracle 数据库服务器(Linux 版本为 Oracle Linux Server release 5.7)今天中午突然出现短暂的 ssh 连接不上的情况,ssh 连接不上的时候,ping 服务器正常,使用 psping 检测端口 22 也是正常(只返回 5 个包,没有持续 ping),使用 SQL Developer 可以登录数据库进行任何操作,另外,通过 DPA 工具发现该服务器的 CPU 等资源消耗很低(发现数据库服务都正常后,就出去吃饭了),回来时,同事反馈 ssh 已经正常,错过诊断的大好时机,期间另外一个同事也做了一些检查:

检测发现 ping 正常,但是 psping 检测 8088 端口发现网络时延很长,甚至出现超时。他做了一个截图对比,如下所示.

ping 是一个网络层的协议,只是表明网络在 3 层是通的;tomcat 是应用层协议

SSH 服务突然连接不了案例总结

吃饭回来后,发现 ssh 已经可以正常登录服务器,检查发现这个进程已经运行了二百多天了,那么也就是说 sshd 服务没有死掉,sshd 服务也没有重启过。

使用 ps -ef | grep sshd 找到 sshd 的进程,执行下面命令

[root@mylnx01 ~]# ps -eo pid,lstart,etime | grep 3423
 
 3423 Sun Feb 18 13:56:11 2018 234-09:01:48

检查日志信息,发现里面有几条 Did not receive identification string from xxx 的信息(部分信息做了脱敏处理)。

[root@mylnx01 log]# tail -100 /var/log/secure
Oct  8 14:50:48 mylnx01 sshd[4341]: pam_unix(sshd:session): session opened for user oracle by (uid=0)
Oct  8 14:50:49 mylnx01 sshd[4341]: pam_unix(sshd:session): session closed for user oracle
Oct 10 12:26:41 mylnx01 sshd[742]: Did not receive identification string from 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[743]: Did not receive identification string from 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[790]: Did not receive identification string from 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[789]: Did not receive identification string from 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[745]: Did not receive identification string from 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[744]: Did not receive identification string from 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[1007]: Connection closed by 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[1006]: Connection closed by 192.168.xxx.xxx
Oct 10 12:26:41 mylnx01 sshd[746]: Did not receive identification string from 192.168.xxx.xxx

搜索了一下这个错误的相关资料,一般出现错误是因为:

This one below means ssh server waited and did not receive what it needed in a timely fashion. This is typically due to connectivity issues. In an ssh connection, the server first provides its identification string, then waits for the client to then provide its identification string. If there is a loss in connection, or the client just bails, this is what you will see in the logs.
If someone uses telnet or netcat to fetch your ssh banner, or other various scans, the logs on the server side will show this as well.

这个错误信息意味着 ssh 服务由于没有及时收到它所需要的东西,而出现等待现象。通常是由于连接问题造成。在 ssh 连接中,服务器首先提供其标识字符串,然后等待客户端提供其标识字符串。如果连接丢失,或者客户端刚刚退出,就会出现日志中所看到的内容。

虽然怀疑是路由问题,但是个人手头缺少网络监控方面的详实证据,但是也有一些佐证的证据:最近两地网络问题蛮多,前天还发现网络掉包比较严重,网络管理员找供应商反馈过,但是后面也不清楚什么情况。因为这方面的事情不归我处理。

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计2192字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中