ssh卡在debug1: SSH2_MSG_KEXINIT sent的解决办法

在公司通过kerberos登录ssh,完全没有问题。但是在家里通过l2tp连接vpn后,就无法登录了。

通过ssh -v查看日志,发现卡在debug1: SSH2_MSG_KEXINIT sent这一步。

查了下,发现是因为mtu设置太大


但是由于系统的网络是NetworkManager管理的,如果需要自动设置mtu,connection的配置中并没有vpn对应的mtu设置。

后来,看了有人使用dispatcher脚本来设置:

创建/etc/NetworkManager/dispatcher.d/vpn-up文件,内容如下

1
2
3
4
5
#!/bin/sh

if [ "$2" = "vpn-up" ]; then
ip link set "$1" mtu 1350
fi

然后vpn连接的时候,就会自动设置mtu了。

ssh卡在debug1: SSH2_MSG_KEXINIT sent的解决办法

https://robberphex.com/ssh-hangs-in-debug1-ssh2_msg_kexinit-sent/

作者

Robert Lu

发布于

2017-03-05

许可协议

评论