+5 votes
How to know my Linux DNS Server | Command to see my DNS in Linux

in Linux/Unix by (551k points)
reopened | 46 views

1 Answer

+3 votes
Best answer

How to know DNS server in Linux

To stay up to date, remember to subscribe to our YouTube channel!


One of the most important factors in the network is the DNS (Domain Name System – Domain Name System) whose task is to convert or translate domain names into IP addresses and vice versa, in this way it is much simpler when accessing a browser to enter TechnoWikis.com and not, it would be impossible to learn the IP addresses of all the domains we access..


The DNS is in charge of finding the IP address associated with that domain name and then redirecting us to the correct server where the website is hosted and its operation starts from the root servers to the authoritative servers of each visited domain.


For administration and control tasks, we may need to know what the DNS server is in Linux, so TechnoWikis will explain how to find this information in Linux, in this case Ubuntu, but the process is identical for other distributions..



How to know DNS server in Linux



Step 1

In the system terminal we are going to execute one of the following commands:
 cat /etc/resolv.conf less /etc/resolv.conf 
Step 2

In the “nameserver” line we find the Linux DNS server.





Step 3

Now we can use the following command to exclusively lookup the DNS server name:
 grep "nameserver" /etc/resolv.conf 


Step 4

If we use Network Manager, which is a network manager, we have the following command to see the DNS server of the system:




If we use a system that works with systemd we can execute the following line to see the DNS server:
 systemd-resolve --status | grep "DNS Servers" 


step 5

Finally we can have details of the DNS server of a website, in this case we will use the "dig" command, dig (Domain Information Groper), it is a command with which it is possible to carry out DNS queries with complete details of the indicated site, Thanks to this command we will have details such as the DNS record, IP address, mail records (MX), service records (SRV), and much more, we execute the following syntax:
 say site 
step 6

We can see in the “Answer section” line the DNS details of that site.





With these few steps it will be possible to see DNS details in Linux environments using different commands in a complete way.


by (3.5m points)

Related questions

+5 votes
1 answer
asked Sep 22, 2019 in Linux / Unix by backtothefuture (551k points) | 263 views
+5 votes
1 answer
asked Nov 16, 2022 in Linux/Unix by backtothefuture (551k points) | 56 views
+3 votes
1 answer
asked Dec 6, 2019 in Linux / Unix by backtothefuture (551k points) | 250 views
+5 votes
1 answer
+3 votes
1 answer
asked Feb 6, 2023 in Linux/Unix by backtothefuture (551k points) | 58 views
Sponsored articles cost $40 per post. You can contact us via Feedback
10,633 questions
10,765 answers
3 users