Our Blog

Troubleshooting DNS Issues with dig (Domain Information Groper)

  1. 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
    ; EDNS: version: 0, flags:; udp: 65494
    ;greencodes.net.               IN     A
    greencodes.net.       600      IN     A
    ;; Query time: 118 msec
    ;; SERVER:
    ;; 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
  2. 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 @ greencodes.net +short

    Here 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.

  3. 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 @ greencodes.net SOA
  4. To get MX record which gives the information about where and how the emails are hosted, we can pass MX.
    dig greencodes.net MX

Enter your keyword