SSH学习2_ssh登陆卡住(expecting SSH2_MSG_KEX_ECDH_REPLY)

openvpn虚拟网卡mtu导致ssh登陆不上 

ssh expecting SSH2_MSG_KEX_ECDH_REPLY 卡住 登陆 openvpn

问题描述

当前使用系统为 Ubuntu, 
登陆openvpn后ssh连接内网机器时,一直卡住无法登陆, 
该内网机器可以ping通,并且探测ssh端口也没问题:

# nc -zv 192.168.1.10 22
Connection to 192.168.1.10 22 port [tcp/sshd] succeeded!

而切换到windows系统,同样使用openvpn在ssh登陆到同个服务器无问题。

 

问题解决

重新回到ubuntu,使用ssh加上-vvv参数,检查登陆信息,发现是到这里卡住:

debug2: kex_parse_kexinit: none,
debug2: kex_parse_kexinit: none,
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY

就是这一行debug1: expecting SSH2_MSG_KEX_ECDH_REPLY.

google搜了下,发现有两个可能的原因:

  • 一个是因为IPv6导致,这个可以排除;
  • 另外一个就是mtu问题,也即虚拟网卡mtu大于vpn服务器那边的网络mtu。

尝试修改openvpn的虚拟网卡mtu,发现真的可以成功登陆上:

利用ifconfig找到虚拟网卡的设备号:tun0

然后修改mtu为1200:

ifconfig tun0 mtu 1200

然后重新用ssh登陆服务器,能够成功登陆上。

问题解释

这里简单说下原因(可能不是很准确):

  1. 因为使用openvpn,本地主机与服务器的连接是通过tun0这个虚拟网卡设备;
  2. vpn服务器到目标服务器之间的网络设备(简称为目标网络)规定的MTU比tun0的MTU小;
  3. ssh 密钥交换阶段一次发送的数据一般大于 1500 字节,因此至少填满了一个 MTU;
  4. 通过tun0发出密钥交换信息,因为大于目标网络的MTU,而被丢弃;
  5. tun0设备的MTU设置为1200后,不会超过目标网络设定的MTU,因此可以正常交换密钥。

转自:http://blog.sina.com.cn/s/blog_4da051a60102vdpb.html

  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
包含如下操作系统版本 FreeBSD Linux Solaris Windows 分别对应如下目录 MegaCLI for DOS MegaCLI for Linux MegaCLI for Solaris MegaCLI for FreeBSD MegaCLI for Windows ********************************************* LSI Corp. MegaRAID MegaCLI Release ********************************************* Release Date: 01/20/14 ======================== Supported Controllers ================== MegaRAID SAS 9270-8i MegaRAID SAS 9271-4i MegaRAID SAS 9271-8i MegaRAID SAS 9271-8iCC MegaRAID SAS 9286-8e MegaRAID SAS 9286CV-8e MegaRAID SAS 9286CV-8eCC MegaRAID SAS 9265-8i MegaRAID SAS 9285-8e MegaRAID SAS 9240-4i MegaRAID SAS 9240-8i MegaRAID SAS 9260-4i MegaRAID SAS 9260CV-4i MegaRAID SAS 9260-8i MegaRAID SAS 9260CV-8i MegaRAID SAS 9260DE-8i MegaRAID SAS 9261-8i MegaRAID SAS 9280-4i4e MegaRAID SAS 9280-8e MegaRAID SAS 9280DE-8e MegaRAID SAS 9280-24i4e MegaRAID SAS 9280-16i4e MegaRAID SAS 9260-16i MegaRAID SAS 9266-4i MegaRAID SAS 9266-8i MegaRAID SAS 9285CV-8e MegaRAID SAS 8704ELP MegaRAID SAS 8704EM2 MegaRAID SAS 8708ELP MegaRAID SAS 8708EM2 MegaRAID SAS 8880EM2 MegaRAID SAS 8888ELP MegaRAID SAS 8308ELP* MegaRAID SAS 8344ELP* MegaRAID SAS 84016E* MegaRAID SAS 8408E* MegaRAID SAS 8480E* MegaRAID SATA 300-8ELP* *These older controllers should work but have not been tested. Component: ========= SAS MegaRAID MegaCLI Release Date: 01/20/14 Version Numbers: MegaCLI =============== =========== Current Version 8.07.14 Previous Version 8.07.07 Contents: ========= This package contains MegaCLI for the following OSes: DOS FreeBSD Linux Solaris Windows Use the MegaCLI components from the folder that matches your OS. Enhancements and Bug Fixes ========================== SCGCQ00393585 (DFCT) - VD creation from MegaCli fails on Solaris Sparc 10u9 operating system. SCGCQ00413883 (DFCT) - "megacli -version -pd -a0" Segmentation Faults if PDs are missing SCGCQ00445356 (CSET) - Megacli crashes after invoking any command in SGI system with one 9280-8e and 2 quad port qlogic FC cards. SCGCQ
OpenSSH_9.2p1 Debian-2, OpenSSL 3.0.9 30 May 2023 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files debug1: /etc/ssh/ssh_config line 21: Applying options for * debug1: Connecting to lxslc702.ihep.ac.cn [2401:de00:2:332::186] port 22. debug1: Connection established. debug1: identity file /home/fyf/.ssh/id_rsa type -1 debug1: identity file /home/fyf/.ssh/id_rsa-cert type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa_sk type -1 debug1: identity file /home/fyf/.ssh/id_ecdsa_sk-cert type -1 debug1: identity file /home/fyf/.ssh/id_ed25519 type -1 debug1: identity file /home/fyf/.ssh/id_ed25519-cert type -1 debug1: identity file /home/fyf/.ssh/id_ed25519_sk type -1 debug1: identity file /home/fyf/.ssh/id_ed25519_sk-cert type -1 debug1: identity file /home/fyf/.ssh/id_xmss type -1 debug1: identity file /home/fyf/.ssh/id_xmss-cert type -1 debug1: identity file /home/fyf/.ssh/id_dsa type -1 debug1: identity file /home/fyf/.ssh/id_dsa-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2 debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4 debug1: compat_banner: match: OpenSSH_7.4 pat OpenSSH_7.4* compat 0x04000006 debug1: Authenticating to lxslc702.ihep.ac.cn:22 as 'fanyufan' debug1: load_hostkeys: fopen /home/fyf/.ssh/known_hosts: No such file or directory debug1: load_hostkeys: fopen /home/fyf/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ssh-ed25519 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY Connection closed by 2401:de00:2:332::186 port 22
07-08

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值