The Domain Name System (DNS for short) is one of the most important parts of the internet infrastructure. It converts the easy to remember domain names, into IP (and IPv6) addresses, that aren’t so friendly to the end user.
Regardless of the distribution of Linux that you are using (such as Ubuntu, CentOS, Debian, Arch, Redhat, etc), the process of determining what DNS servers are currently being used for domain name resolution is the same.
To determine what DNS servers are being used, you simply need to view the contents of the “/etc/resolv.conf” file. This can be done via a graphical editing tool such as gedit, or can easily be viewed from the command line with a simple “cat” of the file, to show the contents. The command below will outline how to determine the DNS servers in use.
Show the active DNS servers on Linux:
$ cat /etc/resolv.conf
You will end up with some output like this:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 188.8.131.52 nameserver 184.108.40.206
You may or may not have the comments at the top of the file, as that will depend on your distribution, but you should have at least one or more “nameserver” records. These will be the name server IP’s that your system will currently be using. In this example, 220.127.116.11 and 18.104.22.168.
Note that this must be an IP address, and cant be a domain name.