We will demonstrate two methods for resolving the issue, using SSH access and sFTP access.
Using SSH
We will use the Nano utility to view and edit the resolv.conf file, where the DNS configuration of our server is set. Enter the following command:
nano /etc/resolv.conf
The resolv.conf file editor will open in front of us. The file may be empty, or it may contain text in the form of a description, depending on the chosen Linux distribution. In this file, you need to specify the nameserver for your OS. Which nameserver to choose? You can read about it in detail at the end of this article. In this case, we will use Google's DNS 8.8.8.8 as the primary one. Add the following text to the file:
nameserver 8.8.8.8
nameserver 1.1.1.1
Press the Ctrl + X key combination to exit the file. Then press Y to save the changes. Finally, press Enter to keep the file name the same.
Using sFTP
Connect to our server via sFTP. Next, navigate to the /etc directory and find the resolv.conf file there. Open it with any text editor. The file may be empty, or it may contain text in the form of a description, depending on the chosen Linux distribution. We need to add the optimal nameservers here, specifying several of them in case of problems with one of them.
nameserver 8.8.8.8
nameserver 1.1.1.1
Great, save the file and upload it to the server.