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 8.8.8.8 nameserver 8.8.4.4
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, 8.8.8.8 and 8.8.4.4.
Note that this must be an IP address, and cant be a domain name.