The linux operating system can ping the ssh connection without responding

1. Problem description

A data node server frequently fails to connect, and the servers can be pinged but ssh cannot be connected. After logging in with an out-of-band address, the remote control cannot display the normal interface, and it will recover briefly after restarting.

2. Troubleshooting

After restarting the server, I checked that the SSH status of the server was normal. I had no choice but to go to the Redhat official website to mention the case and collect logs and other information feedback from sosreport and wait for the analysis result.

The error message you get when you cannot log in is as follows:
The linux operating system can ping the ssh connection without responding

Please execute the following commands in the system and feed back the output results
# ssh -vvv IP_address</br>
Collect the results of strace
# strace -fvttTyyx -s 4096 -o /tmp/strace.txt ssh IP_address</br>
Collect the output results of the following commands to check if there is any RPM packet loss
# rpm -Va &&gt; rpmva.out</br>

Three. Solution

Uncomment the following entries in the /etc/ssh/sshd_config file and restart the sshd service:
# cat etc/ssh/sshd_config | grep DNS</br> Change
the UseDNS option yes in sshd_config to no and delete
#vi /etc/ssh/sshd_config
UseDNS no
# systemctl restart sshd.service

Restart to solve, ssh is connected and used normally

Four. Reason analysis

  • UseDNS specifies whether sshd should look up the remote host name and checks whether the host name of the resolved remote IP address maps back to the same IP address. The default value is "yes". If this option is set to no, then ~ and the sum in .ssh/authorized_keys and sshd_config matching host instructions can only use addresses, not host names.
  • DNS reverse check. When ssh a certain IP, the system will try to reverse check the corresponding domain name through DNS. If there is no domain name resolution for this IP in DNS, it will wait until the DNS query times out before proceeding to the next step, which consumes a long time.

Please indicate the source of reprinting:
1. The copyright of the original article marked in the blog belongs to the original author heardic;
2. The content of this article may not be reprinted without the permission of the original author, otherwise it will be regarded as an infringement;
3. The source of the reprint or quotation of this article should be indicated And the original author;
4. I reserve the right to pursue investigations for those who do not comply with this statement or use the content of this article illegally.

Guess you like

Origin blog.51cto.com/13906754/2595673