ssh登陆概率性失败,报错:kex_exchange_identification

kex_exchange_identification: Connection closed by remote host

通过内网主机或者远程主机ssh登陆概率性失败,最高登陆失败率达到80%左右。

内网win主机登陆表现为登陆失败,需要反复登陆多次,因为这台主机是我内网的集中管控服务器,不能轻易的重装或者调整,整个大内网都靠它去监控和维护。期间尝试过更改各种配置,包括某乎帖子中的各种操作。 无效!!!

我只能默默的忍受~~~~~

我的解决办法是在xshell建立快捷方式,然后疯狂点击快捷方式登陆,好几个月的运维工作都是这么DT的过的,直到我,,,,再也不想忍受了。
在这里插入图片描述

尝试从别的服务器ssh登陆,报错信息如下:

[root@localhost ]# ssh -vvv tset@192.168.XX.XX
OpenSSH_8.1p1, OpenSSL 1.0.2p 14 Aug 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 192.168.XX.XX is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.XX.XX [192.168.XX.XX] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: Connection closed by remote host

百度报错信息无果,全是这个报错信息ssh_exchange_identification: Connection closed by remote host,根本没有我要找的KEX,无奈,只能尝试更改并行登陆参数和最大连接数。

MaxSessions:最大允许链接数,默认10.

MaxStartups:最大允许保持多少个未认证链接(未输入登录密码),默认值是10.

#MaxStartups 10:30:100 原配置指定SSH守护进程未经身份验证的并发连接的最大数量,默认值是 10:30:100。10:30:100表示的意思是,从第10个连接开始,以30%的概率(递增)拒绝新的连接,指导连接数达到100。

sshd的MaxStartups配置限制了可以并行认证的客户端数量为10,别问我为啥知道,自己登陆上去看cat /etc/ssh/sshd_config |grep MaxStartups 就知道了。

可查看ssh连接数
netstat -nat | grep -i ‘22’ | wc -l 或者lsof -i:22 |wc -l

我将
MaxSessions 改成 2000
MaxStartups 也改成2000

然后重启sshd服务
世界终于太平无事了。
原来都是并发连接惹的祸。

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值