When working in Linux, there may be times when you need to know the DNS server that your system is using. This can be particularly useful while troubleshooting network connectivity issues or setting up a new server configuration. In this blog post, we will walk you through the steps to find out your DNS server in Linux.
DNS: A Brief Overview
DNS, or Domain Name System, is a system used for translating human-friendly domain names, such as www.example.com, into IP addresses that machines understand. It’s like the internet’s phonebook. A DNS server is a server that provides the DNS service. It’s important to know the DNS server your Linux system is using to troubleshoot or configure your network settings.
Finding DNS Server in Linux
The DNS servers your system uses are located in the /etc/resolv.conf file. You can view the content of this file using a simple command-line text editor like ‘cat’.
To display the content of /etc/resolv.conf file, open the terminal and type the following command:
This command will display the content of the /etc/resolv.conf file in the terminal. You should see something similar to this:
# Generated by NetworkManager search home nameserver 192.168.1.1
In this example, 192.168.1.1 is the DNS server.
Finding the DNS server in Linux is relatively straightforward. You simply need to understand the correct files to look at and the commands to use. Hopefully, this guide has helped you understand how to find your DNS server in Linux. As always, if you have any questions or comments, feel free to leave a comment below!