UseDNSyes is set in the sshd service. when the configured DNS server becomes inaccessible, it may take 10 to 30 seconds to connect to the server. Because UseDNS is used, the sshd server will reverse resolve the ip address connecting to the client, even in the LAN. When the connection is fast at ordinary times and suddenly becomes abnormal and slow, it may be because the DNS configured on the sshd server is invalid. for example, the DNS is configured on the Internet, and the external server is disconnected due to a fault. The ultimate solution is not to use UseDNS, in the configuration file/
UseDNS yes is set in the sshd service. when the configured DNS server becomes inaccessible, it may take 10 to 30 seconds to connect to the server. Because UseDNS is used, the sshd server will reverse resolve the ip address connecting to the client, even in the LAN.
When the connection is fast at ordinary times and suddenly becomes abnormal and slow, it may be because the DNS configured on the sshd server is invalid. for example, the DNS is configured on the Internet, and the external server is disconnected due to a fault. The ultimate solution is not to use UseDNS. in the configuration file/etc/sshd_config (some linux distributions find UseDNS in/etc/ssh/sshd_config) and set its value to no, if there is a # sign in front, remove it and restart the sshd server.