The connection was slow recently when SSH was connected to a Linux server. Waited for about more than 40 seconds. To connect and start thinking that there is a problem with the network line. The troubleshooting found that no other Linux was in the same situation. Finally, the configuration of SSH was set up and optimized to solve this problem.
1. Turn off DNS reverse resolution
In Linux, the reverse parsing of SSH is turned on by default, which can affect the connection speed of SSH.
[Email protected]_365 ~]# Vim/etc/ssh/sshd_configusedns No
2. Turn off GSS authentication in SSH.
The GSS is an authentication method in SSH. Generally not used. So turn it off to increase the connection speed of SSH.
[Email protected]_365 ~]# vim/etc/ssh/sshd_configgssapiauthentication No
3. Modify the nsswitch.conf on the SSH server
[[Email protected]_365 ~]# vim/etc/nsswitch.confhosts:files DNS changed to Hosts:files
Hosts:files DNS: The order of domain name resolution, first through the local file parsing (/etc/hosts), if the resolution is not successful through the DNS resolution.
General modification of the 1, 22 steps to solve the problem. 3 steps. Modification is not recommended. If the server has to access other servers through the domain name . The modification may cause the domain name resolution to fail.
Modify to complete the above content. Restart the sshd service.
This article is from "Desert Camel" blog, please make sure to keep this source http://maomaochong.blog.51cto.com/9260445/1930935
Linux SSH Connection Super slow solution.