ssh故障总结 连接慢 卡顿 pledge: network

排查ssh故障的第一步是ssh -vvv(最多三个v),看下问题出在哪个步骤

1、 如下图: 卡在

 

原因

反向解析慢

解决办法

修改 /etc/ssh/sshd_config,如下

#UseDNS yes
UseDNS no

参考:

ping域名 第一个包返回很慢 : https://blog.csdn.net/fanren224/article/details/79693783

 

2、可以连接,但是卡在了debug1: pledge: network,这一步很慢

 

原因

journalctl -u systemd-logind.service -r

ssh故障总结 连接慢 卡顿 pledge: network_第1张图片

解决办法

systemctl restart systemd-logind

如果报错

systemctl restart dbus

systemctl restart systemd-logind

参考

https://serverfault.com/questions/792486/ssh-connection-takes-forever-to-initiate-stuck-at-pledge-network

https://github.com/systemd/systemd/issues/2925

你可能感兴趣的:(linux,网络)