Filters:

  • Technologies

  • Instructors

  • Windows Troubleshooting Tip – Advanced DNS Query Debugging With NSLookup

    I’ve published a number of articles on following a simple and straightforward troubleshooting methodology. I advocate a simple and focused approach shown in Figure 1. You can see that symptom identification is the first step, followed by root cause analysis and problem resolution.

    Figure 1. MikeDan’s Quick and Dirty Troubleshooting Methodology.

    There’s lots of great tools built right in to Windows that will actually help when narrowing down network communications problems. One of my favorites is NSLookup. I’ve previously written about NSLookup and covered the basic use. This article focuses on deep DNS troubleshooting. I recommend you read Windows Troubleshooting Tip – NSLookup if you’re not already familiar with NSLookup.

    Displaying Detailed Query Data
    By default, NSLookup is user friendly. It only displays the basic name resolution information resolution for a target host. If you’ve researched DNS, you know that there can be a complex set of queries and responses with multiple servers involved before that resolution is returned to the client. And there’s an easy way to display all of that as it happens.

    As an example I’m going to use NSLookup to resolve the hostname www.interfacett.com against my favorite DNS provider, Level 3. The DNS server at Level 3 I’ll use here is 4.2.2.6. Here’s the basic NSLookup for that scenario:

    001-NSLookup-DNS-scenario

    For ease of reading, here’s the text from that screenshot:
    C:\>nslookup
    Default Server: UnKnown
    Address: 10.0.1.1

    > server 4.2.2.6
    Default Server: resolver8.level3.net
    Address: 4.2.2.6

    > www.interfacett.com
    Server: resolver8.level3.net
    Address: 4.2.2.6

    Non-authoritative answer:
    Name: www.interfacett.com
    Address: 8.19.33.146

    > _

    Now I’ll turn on verbose debugging and re-run the same query. To set verbose debugging in NSLookup I just type set d2. Then I run the exact same query as before, with very different output.

    002-NSLookup-DNS-debugging-quert

    Because the entire response won’t fit in a single window, here’s the text from the query:

    > set d2

    > www.interfacett.com

    Server:  resolver8.level3.net

    Address:  4.2.2.6

     

    ————

    SendRequest(), len 61

        HEADER:

            opcode = QUERY, id = 9, rcode = NOERROR

            header flags:  query, want recursion

            questions = 1,  answers = 0,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Phoenix.Interfacett.com, type = A, class = IN

     

    ————

    ————

    Got answer (145 bytes):

        HEADER:

            opcode = QUERY, id = 9, rcode = NXDOMAIN

            header flags:  response, want recursion, recursion avail.

            questions = 1,  answers = 0,  authority records = 1,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Phoenix.Interfacett.com, type = A, class = IN

        AUTHORITY RECORDS:

        ->  Interfacett.com

            type = SOA, class = IN, dlen = 72

            ttl = 720 (12 mins)

            primary name server = ns-1995.awsdns-57.co.uk

            responsible mail addr = awsdns-hostmaster.amazon.com

            serial  = 1

            refresh = 7200 (2 hours)

            retry   = 900 (15 mins)

            expire  = 604800 (7 days)

            default TTL = 14400 (4 hours)

     

    ————

    ————

    SendRequest(), len 61

        HEADER:

            opcode = QUERY, id = 10, rcode = NOERROR

            header flags:  query, want recursion

            questions = 1,  answers = 0,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Phoenix.Interfacett.com, type = AAAA, class = IN

     

    ————

    ————

    Got answer (145 bytes):

        HEADER:

            opcode = QUERY, id = 10, rcode = NXDOMAIN

            header flags:  response, want recursion, recursion avail.

            questions = 1,  answers = 0,  authority records = 1,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Phoenix.Interfacett.com, type = AAAA, class = IN

        AUTHORITY RECORDS:

        ->  Interfacett.com

            type = SOA, class = IN, dlen = 72

            ttl = 720 (12 mins)

            primary name server = ns-1995.awsdns-57.co.uk

            responsible mail addr = awsdns-hostmaster.amazon.com

            serial  = 1

            refresh = 7200 (2 hours)

            retry   = 900 (15 mins)

            expire  = 604800 (7 days)

            default TTL = 14400 (4 hours)

     

    ————

    ————

    SendRequest(), len 53

        HEADER:

            opcode = QUERY, id = 11, rcode = NOERROR

            header flags:  query, want recursion

            questions = 1,  answers = 0,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Interfacett.com, type = A, class = IN

     

    ————

    ————

    Got answer (137 bytes):

        HEADER:

            opcode = QUERY, id = 11, rcode = NXDOMAIN

            header flags:  response, want recursion, recursion avail.

            questions = 1,  answers = 0,  authority records = 1,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Interfacett.com, type = A, class = IN

        AUTHORITY RECORDS:

        ->  Interfacett.com

            type = SOA, class = IN, dlen = 72

            ttl = 720 (12 mins)

            primary name server = ns-1995.awsdns-57.co.uk

            responsible mail addr = awsdns-hostmaster.amazon.com

            serial  = 1

            refresh = 7200 (2 hours)

            retry   = 900 (15 mins)

            expire  = 604800 (7 days)

            default TTL = 14400 (4 hours)

     

    ————

    ————

    SendRequest(), len 53

        HEADER:

            opcode = QUERY, id = 12, rcode = NOERROR

            header flags:  query, want recursion

            questions = 1,  answers = 0,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Interfacett.com, type = AAAA, class = IN

     

    ————

    ————

    Got answer (137 bytes):

        HEADER:

            opcode = QUERY, id = 12, rcode = NXDOMAIN

            header flags:  response, want recursion, recursion avail.

            questions = 1,  answers = 0,  authority records = 1,  additional = 0

     

        QUESTIONS:

            www.interfacett.com.Interfacett.com, type = AAAA, class = IN

        AUTHORITY RECORDS:

        ->  Interfacett.com

            type = SOA, class = IN, dlen = 72

            ttl = 719 (11 mins 59 secs)

            primary name server = ns-1995.awsdns-57.co.uk

            responsible mail addr = awsdns-hostmaster.amazon.com

            serial  = 1

            refresh = 7200 (2 hours)

            retry   = 900 (15 mins)

            expire  = 604800 (7 days)

            default TTL = 14400 (4 hours)

     

    ————

    ————

    SendRequest(), len 37

        HEADER:

            opcode = QUERY, id = 13, rcode = NOERROR

            header flags:  query, want recursion

            questions = 1,  answers = 0,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com, type = A, class = IN

     

    ————

    ————

    Got answer (53 bytes):

        HEADER:

            opcode = QUERY, id = 13, rcode = NOERROR

            header flags:  response, want recursion, recursion avail.

            questions = 1,  answers = 1,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com, type = A, class = IN

        ANSWERS:

        ->  www.interfacett.com

            type = A, class = IN, dlen = 4

            internet address = 8.19.33.146

            ttl = 300 (5 mins)

     

    ————

    Non-authoritative answer:

    ————

    SendRequest(), len 37

        HEADER:

            opcode = QUERY, id = 14, rcode = NOERROR

            header flags:  query, want recursion

            questions = 1,  answers = 0,  authority records = 0,  additional = 0

     

        QUESTIONS:

            www.interfacett.com, type = AAAA, class = IN

     

    ————

    ————

    Got answer (121 bytes):

        HEADER:

            opcode = QUERY, id = 14, rcode = NOERROR

            header flags:  response, want recursion, recursion avail.

            questions = 1,  answers = 0,  authority records = 1,  additional = 0

     

        QUESTIONS:

            www.interfacett.com, type = AAAA, class = IN

        AUTHORITY RECORDS:

        ->  interfacett.com

            type = SOA, class = IN, dlen = 72

            ttl = 719 (11 mins 59 secs)

            primary name server = ns-1995.awsdns-57.co.uk

            responsible mail addr = awsdns-hostmaster.amazon.com

            serial  = 1

            refresh = 7200 (2 hours)

            retry   = 900 (15 mins)

            expire  = 604800 (7 days)

            default TTL = 14400 (4 hours)

     

    ————

    Name:    www.interfacett.com

    Address:  8.19.33.146

    Remember that the queries were the same in both examples. The final result was the same in both examples. The difference is that with d2 set, I can see the entire process of name resolution.

    How does this help? It tells me which servers are being queried and what records or referrals are returned from each. If I have a complex DNS architecture or if I believe an errant DNS server is handing out incorrect results, seeing the entire query process helps me find the spot along the resolution path where the failure occurs.
    Mike Danseglio -CISSP / CEH
    Interface Technical Training – Technical Director and Instructor

    See what people are saying...

    1. MS

      Sigh, it insisted on putting the http:// on the leading end.

    2. MS

      To keep the dns suffix returns to just the item referenced, put a dot at the end of the query to tell nslookup this is a fully qualified name that doesn’t need to be examined with all dns suffixes;
      http://www.hotmail.com.
      http://www.cnn.com.
      and so forth.

    Share your thoughts...

    Please fill out the comment form below to post a reply.