DNS servers are an important part of the internet, translating domain names into IP addresses. If your DNS server is not working correctly, you may experience problems loading websites or sending and receiving email. In this blog post, we will discuss three ways to check your DNS server in Linux. We will also provide some tips for troubleshooting DNS problems. Let’s get started!
Check DNS server IP with Dig command in Linux
The best way to check your DNS server is to use the ‘dig’ command. The ‘dig’ command allows you to query DNS servers for information about domains. To use the ‘dig’ command, open a terminal and type the following: dig example.com
This will query the DNS server for information about the domain “example.com”. For example, if you want to query for A records, you would type the following: dig example.com +short
You can replace “example.com” with any domain you want to query. From the following example, we can see that the DNS server is 126.96.36.199 .
; <<>> DiG 9.10.6 <<>> howtouselinux.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25003
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;howtouselinux.com. IN A
;; ANSWER SECTION:
howtouselinux.com. 0 IN A 188.8.131.52
howtouselinux.com. 0 IN A 184.108.40.206
;; Query time: 138 msec
;; SERVER: 220.127.116.11#53(18.104.22.168)
;; WHEN: Wed Mar 02 21:24:01 CST 2022
;; MSG SIZE rcvd: 78
Check DNS server IP with nslookup command in Linux
The second way to check your DNS server is to use the ‘nslookup’ command. ‘Nslookup’ is a tool that allows you to query DNS servers for information about domains. To use the ‘nslookup’ command, open a terminal and type the following: nslookup example.com
This will query the DNS server for information about the domain “example.com”. You can also query specific records by using the ‘querytype’ parameter. For example, if you want to query for A records, you would type the following: nslookup -query=a example.com
The dns server is 22.214.171.124 from the following example.
% nslookup -query=a howtouselinux.com
Check DNS server IP with /etc/resolv.conf file in Linux
The third way is to check /etc/resolv.conf configuration file. It contains DNS server information we use.
We hope this blog post has been helpful in showing you how to check your DNS server in Linux. If you are experiencing DNS problems, be sure to try using these three commands to troubleshoot the issue. Thanks for reading!