ssh卡在debug1: SSH2_MSG_KEXINIT sent解决方法

现象:主机间互通正常且可以判断对方ssh端口是开放的,但是用ssh xxx.xxx.xxx.xxx -v这种方式连接的时候会卡在debug1: SSH2_MSG_KEXINIT sent这步

解决方法:

# 先看看 /sys/class/net/eth0/mtu文件内容
cat /sys/class/net/eth0/mtu
# 确定是不是1500,是的话,修改为1454
echo "1454" > /sys/class/net/eth0/mtu

原因:

简单解释就是IPV4报头与GRE报头结构不同,导致GRE数据包最大内容载荷只有1454,默认mtu如果是1500的话,就会有46字节的内容无法处理导致错误。

参考:

http://blog.csdn.net/hrayha/article/details/50721022

http://techbackground.blogspot.com/2013/06/path-mtu-discovery-and-gre.html