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

栏目: 服务器 · 发布时间: 5年前

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

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

一台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连接中,服务器首先提供其标识字符串,然后等待客户端提供其标识字符串。   如果连接丢失,或者客户端刚刚退出,就会出现日志中所看到的内容。

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

对于ssh连接不了的排错,其实有不少系统的排查方法,下面这三篇博客非常精彩,此处就不班门弄斧,有兴趣的可以直接看看这些文章。

https://note.t4x.org/other/didnot-receive-identification-string-from/

https://www.centos.bz/2017/08/ssh-connect-failed-solve-experience/

https://scottlinux.com/2012/03/07/troubleshooting-ssh-server-logs-and-error-messages/


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C#入门经典

C#入门经典

[美] Karli Watson、Christian Nagel / 齐立波、黄静 / 清华大学出版社 / 2008-12 / 118.00元

这是一本成就无数C#程序员的经典名著,厚而不“重”,可帮助您轻松掌握C#的各种编程知识,为您的职业生涯打下坚实的基础,《C#入门经典》自第1版出版以来,全球销量已经达数万册,在中国也有近8万册的销量,已经成为广大初级C#程序员首选的入门教程,也是目前国内市场上最畅销的C#专业店销书,曾两次被CSDN、《程序员》等机构和读者评选为“最受读者喜爱的十大技术开发类图书”!第4版面向C#2008和.NET......一起来看看 《C#入门经典》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

SHA 加密
SHA 加密

SHA 加密工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具