Many people have encountered the cause of slow SSH Login. I have summarized four methods I have encountered to speed up ssh, for different situations, there may be only one suitable for you. The following uses Debian and as an example:
1. Disable reverse resolution of ssh dns. You don't have to talk about the principle.
- Vim/etc/ssh/sshd_config
CopyCode
Add at the end of the file
- Usedns No
Copy code
2. add host ing in/etc/hosts, and view Debian from/etc/hostname. Ensure that the names of hosts in the two files are consistent; view RedHat from/etc/sysconfig/Network
3.For local virtual machines only:
When you install VMware or virtualbox on your local machine, there will be two more virtual NICs, one is host-only and the other is Nat. When you use one of the modes, when you log on to the Virtual Machine Linux through SSH, you will first try to connect to the virtual machine using your local network (that is, the NIC address used for Internet connection). Of course, the connection is unsuccessful, it will time out. When you connect again, it will usually succeed. This time, you are using the corresponding virtual Nic mode.
4. Disable gssapi User Authentication
- Vim/etc/ssh/ssh_config
Copy code
Set
- Gssapiauthentication Yes
Copy code
Change
- Gssapiauthentication No
Copy code