web123456

Solve ssh: Could not resolve hostname ***: nodename nor servname provided, or not known error

1. Problem

Today I got a new Linux server and encountered the following error when logging in to the server using the domain name:

ssh: Could not resolve hostname ***: nodename nor servname provided, or not known

2. Solve

Method 1: Use the ping command

There is a saying on the Internet that when you use the ssh command to log in to a server for the first time, you can ping this address first, let the local hosts cache the name of the address, and then try ssh login.

It turns out that this method has no effect on the situation I encountered.

Method 2: Use IP address

Since the first method is not good, I explored and tried the second method myself, which is to use the IP address to log in. The reference command is as follows:

ssh [email protected] -p 5678

This method is effective. If you don't know the server's public network IP, you can ping the domain name address first.

Method 3: Modify server configuration

The first two methods start from the client. In fact, you can also do some things on the server side, such as adding the corresponding client and allowing the specified machine to connect to the server.

3. Summary

Okay, the method has been found. Let me record it here to prevent you from scratching your head when you encounter this situation in the future. After all, there are not many hairs now.


Author Profile: 😄Hello everyone, I am Data-Mining (liuzhen007), a typical audio and video technology enthusiast. I work in traditional radio and television giants and audio and video Internet companies. I have rich experience in live audio and video broadcasting and on-demand related, and have a very in-depth understanding of WebRTC, FFmpeg and Electron. At the same time, he is also a CSDN blog expert (Blog Star), Huawei Cloud Enjoy Expert (co-creation editor, top ten bloggers), 51CTO community editor, and InfoQ signed author. Welcome to follow me to share more information! 😄