Troubleshooting DNS Issues with dig (Domain Information Groper)
- By default, it queries A record.
An A record is used to find the IP address of a computer connected to the internet from a domain name.From Linux terminal,
manoj@local: dig greencodes.net ; <<>> DiG 9.11.3-1ubuntu1.8-Ubuntu <<>> greencodes.net ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29043 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 65494 ;; QUESTION SECTION: ;greencodes.net. IN A ;; ANSWER SECTION: greencodes.net. 600 IN A 220.127.116.11 ;; Query time: 118 msec ;; SERVER: 127.0.0.53#53(127.0.0.53) ;; WHEN: Mon Jul 01 12:18:18 +0545 2019 ;; MSG SIZE rcvd: 59
Don’t waste time looking other info but except the Question and Answer Section.
This extra info can be removed by +short
manoj@local:dig greencodes.net +short 18.104.22.168
- Sometimes there might be an issue with your ISP or with router. Most commonly if the DNS cache is still not cleared, the routers nearest to your computer might give old or non-updated information. Since the request starts with your local computer, with information from, /etc/resolv.conf, it uses the DNS server listed in that file. Many routers act as a DNS server or at least the DNS server of our ISP. To change the DNS server while doing query, so that a cached copy is not replied, we can explicitly define the DNS server with @DNS_SERVER as follow:
dig @22.214.171.124 greencodes.net +short
Here 126.96.36.199 is the ip address of Google DNS server and we explicitly used it to query of DNS question. The router or local ISP DNS server will not be used to query to reach out to the server.
- A Start of Authority record (abbreviated as SOA record) is a type of resource record in the Domain Name System (DNS) containing administrative information about the zone, especially regarding zone transfers.
dig @188.8.131.52 greencodes.net SOA
- To get MX record which gives the information about where and how the emails are hosted, we can pass MX.
dig greencodes.net MX