Saturday, September 19, 2020

Linux Configure DNS Address

The Domain Name System (DNS) is the phonebook of the Internet. When users type domain names such as ‘google.com’  into web browsers, DNS is responsible for finding the correct IP address for those sites. Browsers then use those addresses to communicate with origin servers.

That’s why, it is important to know the DNS address for a client system access to the internet. In this tutorial, we will discuss about how to configure DNS client address in linux machine.

The file we need to edit to configure our DNS address is "resolv.conf". The complete file is below:-


Now we will open that file using “VI editor”. If you want, you can use any editor other than "VI Editor". The complete command to open the file is: -


Since, after opening the file it will be in “read only” mode, so we will have to go to “insert” mode. To go into “insert” mode we need to press “i” from the keyboard. 

Now will add the following line.

nameserver  10.10.10.5 (ip address of our dns server)

If we want, we can add more lines and configure many dns servers. E.g.

nameserver  10.10.10.5 (ip address of our dns server)
nameserver  172.16.5.239 (ip address of our dns server)

Here is a screenshot:


If we have already added a "nameserver", we can edit the existing lines if we want without creating new lines.

After changing the value, we will exit the "insert" mode by pressing the "escape" button. At the end of all, we will save and close the file using the following command.

:wq

After saving the file, we need to restart the network service once. That is why the command is:-


To verify that our DNS client is working, we can use the below command:-

dig

Everything is done.

No comments:

Post a Comment