DNS Response
Message Format
Introduction
The
previous page delt with the DNS Query message
formats. We analysed them in great detail and showed
how various options are selected by the host using
the Flags/Parameters field.
On this
page we will see and analyse the responses we get
from the generated queries. These responses, in the
case of a recursive query, come directly from the
DNS server to which we sent the query and, in the
case of a non-recursive query, will come from the
last DNS server the client contacts in order to get
the required information.
Lastly,
keep in mind that this page is the continuation of
the previous page, so it's important to understand
the previous material ! If you have any doubts, read
the previous section again.
Now that
we have all that out of the way ....let's grab a few
DNS responses and get our hands dirty :)
DNS Analysis - Server Response
Here is
the response (highlighted) to the previous DNS query
sent to an Australian DNS server (139.130.4.4),
where I asked for the resolution of www.firewall.cx:
Something
worth paying attention to is the time this query
took to come back to my Linux file server. The time
taken, from the moment the packet was sent from the
Linux file server, until it received the answer, was
only 0.991 seconds !
During
this short period of time the packet travelled from
Greece to Australia, reached the DNS server, which
sent its queries to other DNS servers until it found
the answer and then generated a DNS response that
was sent back to Greece where my home network is !
There are
a lot of factors that contribute to this fairly fast
reponse. The transport protocol UDP, which does not
require any 3-way handshake, the load of the DNS
server to which I sent the query, the load of DNS
servers it then had to ask, the speed at which all
these servers and myself are connected to the
Internet and the general load between the routers
that my packet had to travel in order to get to its
various destinations !
As you can
clearly see, there is a lot happening for just one
DNS query and response. Try to consider what
happenes when you have 20,000,000 DNS queries
happening at once on the Internet and you have a
good idea on how well this protocol and the
underlying technology have been designed !
Following
is the Ethernet II packet that runs on the local
network. The structure is the same, but varies in
size, regardless of whether it's a DNS Query or
Response:
Now, to
make the analysis of the DNS
Section easier I have also included the
DNS Query (left hand
side) and DNS Response
(right hand side). This allows you to compare what
we sent and what we received :
........
By
comparing the two packets, you can see that there
are fields in the DNS Response
packet (marked with green
arrows) that didn't exist in the
Query. Let's see again
what each field means and anaylse them again as we
did in the previous page.
The
DNS Section in a
response packet is considerably larger and more
complex than that of a query. For this reason we are
going to analyse it in parts rather than all
together. The query had only one section that
required in-depth analysis whereas the response has
three since the first one is the original query
sent.
Here is
the DNS Section of a
DNS response in 3D:
You can
clearly see that everything after the
light green 3D block
labeled "DNS Query Section"
is new. We are going to focus on these 3 new blocks,
which are part of the DNS
Response Section, as the rest has been
covered in the previous page.
DNS Response Section
The
analysis of this section won't be too difficult
because the format that is followed in each
3D block of our
DNS Response Section is
identical. For this reason, I have not analysed all
3 3D blocks, but only a few to help you get the
idea.
The
diagram below shows you the contents of the 3 3D
blocks (sections) we are looking at:
Answers Section,
Authoritative Name Servers Section and the
Additional Records
Sections: |