Skip to content

Commit 95a6ebe

Browse files
committed
update ordering of DNS fields and add dig example
1 parent a5f08b4 commit 95a6ebe

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

applications/infrastructure.rst

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fields:
203203

204204
::
205205

206-
(Name, Value, Type, Class, TTL)
206+
(Name, TTL, Type, Class, Value)
207207

208208
The ``Name`` and ``Value`` fields are exactly what you would expect,
209209
while the ``Type`` field specifies how the ``Value`` should be
@@ -221,18 +221,19 @@ mapping we have been assuming. Other record types include:
221221
- ``MX``—The ``Value`` field gives the domain name for a host that is
222222
running a mail server that accepts messages for the specified domain.
223223

224-
The ``Class`` field was included to allow entities other than the NIC to
225-
define useful record types. To date, the only widely used ``Class`` is
226-
the one used by the Internet; it is denoted ``IN``. Finally, the
227-
time-to-live (``TTL``) field shows how long this resource record is
224+
The time-to-live (``TTL``) field shows how long this resource record is
228225
valid. It is used by servers that cache resource records from other
229226
servers; when the ``TTL`` expires, the server must evict the record from
230227
its cache.
231228

229+
Finally, the ``Class`` field was included to allow entities other than the NIC to
230+
define useful record types. To date, the only widely used ``Class`` is
231+
the one used by the Internet; it is denoted ``IN``.
232+
232233
To better understand how resource records represent the information in
233234
the domain hierarchy, consider the following examples drawn from the
234235
domain hierarchy given in :numref:`Figure %s <fig-domains>`. To
235-
simplify the example, we ignore the ``TTL`` field and we give the
236+
simplify the example, we ignore the ``TTL`` and ``Class`` fields and we give the
236237
relevant information for only one of the name servers that implement
237238
each zone.
238239

@@ -246,19 +247,19 @@ TLD servers.
246247

247248
::
248249

249-
(edu, a3.nstld.com, NS, IN)
250-
(a3.nstld.com, 192.5.6.32, A, IN)
251-
(com, a.gtld-servers.net, NS, IN)
252-
(a.gtld-servers.net, 192.5.6.30, A, IN)
250+
(edu, NS, a3.nstld.com)
251+
(a3.nstld.com, A, 192.5.6.32)
252+
(com, NS, a.gtld-servers.net)
253+
(a.gtld-servers.net, A, 192.5.6.30)
253254
...
254255

255256
Moving our way down the hierarchy by one level, the server has records
256257
for domains like this:
257258

258259
::
259260

260-
(princeton.edu, dns.princeton.edu, NS, IN)
261-
(dns.princeton.edu, 128.112.129.15, A, IN)
261+
(princeton.edu, NS, dns.princeton.edu)
262+
(dns.princeton.edu, A, 128.112.129.15)
262263
...
263264

264265
In this case, we get an ``NS`` record and an ``A`` record for the name
@@ -270,9 +271,9 @@ server at yet another layer in the hierarchy (e.g., for a query about
270271

271272
::
272273

273-
(email.princeton.edu, 128.112.198.35, A, IN)
274-
(penguins.cs.princeton.edu, dns1.cs.princeton.edu, NS, IN)
275-
(dns1.cs.princeton.edu, 128.112.136.10, A, IN)
274+
(email.princeton.edu, A, 128.112.198.35)
275+
(penguins.cs.princeton.edu, NS, dns1.cs.princeton.edu)
276+
(dns1.cs.princeton.edu, A, 128.112.136.10)
276277
...
277278

278279
Finally, a third-level name server, such as the one managed by domain
@@ -291,11 +292,11 @@ change everyone’s email address.
291292

292293
::
293294

294-
(penguins.cs.princeton.edu, 128.112.155.166, A, IN)
295-
(www.cs.princeton.edu, coreweb.cs.princeton.edu, CNAME, IN)
296-
(coreweb.cs.princeton.edu, 128.112.136.35, A, IN)
297-
(cs.princeton.edu, mail.cs.princeton.edu, MX, IN)
298-
(mail.cs.princeton.edu, 128.112.136.72, A, IN)
295+
(penguins.cs.princeton.edu, A, 128.112.155.166)
296+
(www.cs.princeton.edu, CNAME, coreweb.cs.princeton.edu)
297+
(coreweb.cs.princeton.edu, A, 128.112.136.35)
298+
(cs.princeton.edu, MX, mail.cs.princeton.edu)
299+
(mail.cs.princeton.edu, A, 128.112.136.72)
299300
...
300301

301302
Note that, although resource records can be defined for virtually any
@@ -357,8 +358,8 @@ records for one or more of the root servers, for example:
357358

358359
::
359360

360-
('root', a.root-servers.net, NS, IN)
361-
(a.root-servers.net, 198.41.0.4, A, IN)
361+
('root', NS, a.root-servers.net)
362+
(a.root-servers.net, A, 198.41.0.4, A)
362363

363364
Thus, resolving a name actually involves a client querying the local
364365
server, which in turn acts as a client that queries the remote servers
@@ -391,6 +392,32 @@ names before sending out a query.
391392
Name resolution in practice, where the numbers 1 to 10 show the sequence
392393
of steps in the process.
393394

395+
If you want to get a hands-on view of how name resolution works, you
396+
can use the command-line tool ``dig`` to make queries and receive
397+
responses in the form
398+
399+
::
400+
401+
Name TTL Class Type Value
402+
403+
If you invoke ``dig`` with the ``+trace`` option you can see the
404+
recursive process happening as the tool starts at the top of the DNS
405+
hierarchy and works its way down to resolve the query. Here is a subset of the
406+
output when we use the simple form of ``dig`` to look up ``www.cs.princeton.edu``
407+
408+
::
409+
410+
$ dig www.cs.princeton.edu
411+
412+
...
413+
414+
;; QUESTION SECTION:
415+
;www.cs.princeton.edu. IN A
416+
417+
;; ANSWER SECTION:
418+
www.cs.princeton.edu. 60 IN CNAME coreweb.cs.princeton.edu.
419+
coreweb.cs.princeton.edu. 60 IN A 128.112.136.35
420+
394421
.. _key-naming:
395422
.. admonition:: Key Takeaway
396423

0 commit comments

Comments
 (0)