Table of Contents

About

A DNS lookup is a request to a DNS server in order to get DNS record from a DNS name

Beware that not all DNS clients are performing a lookup on the content of the host file as ping does.

Example of response known as replies

Each message 1) consists of:

  • a header with:
    • ID: query identifier
    • QR: message type:
      • 0: query
      • 1: response
    • OPCODE: kind of query:
    • RCODE: Response code:
      • 0: No error
      • 1: Query Format error
      • 2: Server failure
      • 3: Name Error (the domain name referenced in the query does not exist)
      • 4: Query Type Not Implemented
      • 5: Refused (For Policy reason)
  • and four sections:
    • question: the question for the name server composed of:
      • a query type (QTYPE),
      • a query class (QCLASS),
      • a query domain name (QNAME).
    • answer: the answer (in resource records (RR) format),
      • with a status code 2)
    • authority: the authoritative name server (in RR format),
    • and an additional space information (in RR format)

A header field (flags) controls the content of these four sections

Example of A record query against datacadamia.com

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56993
;; flags: qr rd ra ; qd: 1 an: 2 au: 0 ad: 1 

;; OPT PSEUDOSECTION: 
; EDNS: version: 0; flags: ; udp: 512
;; QUESTIONS:
;;	datacadamia.com., type = A, class = IN

;; ANSWERS:
datacadamia.com.	300	IN	A	188.114.96.0
datacadamia.com.	300	IN	A	188.114.97.0

;; AUTHORITY RECORDS:

;; ADDITIONAL RECORDS:


;; Message size: 76 bytes

Type

Forward

A forward lookup translate a DNS name to an IP. See What is a DNS Forward Lookup?

Reverse

A reverse lookup translate a an IP to a DNS name. See DNS - rDNS - Reverse DNS (lookup|resolution) - from IP to name