- 1 How to Find My DNS Server IP Address in Linux
- 2 How to Find DNS Server IP Address Using Command-Line Interface
- 3 1. Find DNS Server IP Address Through /etc/resolv.conf File
- 4 How to Find DNS Server IP Address Using Graphical User Interface
- 5 Conclusion
We have two different ways to find out the DNS Server IP address in the Linux operating system:
We will perform this task on the Ubuntu 22.04 version.
In Linux distributions, there are always multiple command-line utilities to execute any specific task. Similarly, to check the DNS Server IP Address, several commands are here:
Before getting started with all of the above commands, make sure to update all of the system packages:
sudo apt update && sudo apt upgrade
Let’s run command-line utilities to display the result:
There are multiple command tools to access the /etc/resilv.con file such as cat, less, and grep. 1
1. Using the cat command
The Concatenate (cat) command helps to display the content of a file as a standard output. It is also useful to print the DNS Server IP Address in the terminal:
sudo cat /etc/resolv.conf
Note that 127.0.0.53 is a loopback address, in this case forwarding the request to the DNS server which can be found using the following command:
In the output, you can see the DNS IP:
126.96.36.199 > Secondary DNS
2. Using the less Command
The less command function is similar to the Linux cat command. The difference is that the cat command reads a small file’s data and displays its output; whereas the less command is used to read extensive file data and display its output page by page.
We can also utilize this utility to find the DNS Server IP Address by running the command mentioned below:
sudo less /etc/resolv.conf
This address 127.0.0.53 is a loopback address used to send requests to the DNS server 188.8.131.52.
3. Using grep Command
Linux grep command is used to search and match similar patterns in a file and display them. Run the given command to find out the DNS Server IP Address using this command-line utility:su
sudo grep “nameserver” /etc/resolv.conf
The NetworkManager Command-line Interface (nmcli) is the Linux command-line utility used to handle network-related issues and configuration.
Execute the given command to let it display the DNS Server IP Address on the Ubuntu system:
sudo nmcli dev show | grep ‘IP4.DNS’
The Domain Information Groper (dig) command is used to retrieve information regarding the DNS name server. It looks out for the specific query name server given by the user and prints the output.
Not only using the CLI but there’s also another way to find the DNS Server IP address i.e., GUI.
Step 1: Move to the Show Applications icons located at the bottom left corner of the Ubuntu 22.04 screen and click it:
Step 2: Click on Settings from the displayed screen; if you don’t find it, type Settings in the search box:
Step 3: Move to the Network from the left panel and select it:
Step 4: In the Network screen, move to the gear icon in Wired section and select it:
Step 5: The displayed window will show the networking details including the DNS server addresses:
184.108.40.206 > Secondary
The DNS maps the IP addresses whenever the user sends a domain request to the server. It works as a phonebook on the internet that matches the correct IP address and returns it to the user. This guide has mentioned multiple methods to find the DNS server IP address on a Linux system i.e., through Command-line Interface and Graphical User Interface. By using the terminal method, we have found numerous command-line tools to get the DNS server IP address. You can use the one that is most suitable for you.