Lição 08 · Unit 3 · Networking for a Backend Engineer & Application Support

Read a `dig` Answer

Rung 1 of the ladder asks "does the name resolve?" — and dig is the tool that answers it. But dig prints a wall of text, and only four parts of it matter on call. Learn to read those four, and you can read any answer dig ever gives you. First, make sure the tool is even there:

dig example.com
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12345
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; QUESTION SECTION:
;example.com.            IN  A

;; ANSWER SECTION:
example.com.        3600    IN  A   93.184.216.34

;; Query time: 24 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)

Four things, top to bottom, and nothing else matters yet:

status: NOERROR
The query succeeded. This is the DNS equivalent of a green light — the name was looked up and an answer came back.
ANSWER SECTION
What the name maps to. Here example.com → the A record 93.184.216.34. No answer section, or ANSWER: 0, means nothing resolved.
3600 (the TTL)
How many seconds this answer may be cached before it must be looked up again. A big number means "you'll keep seeing this even after it changes."
SERVER: 8.8.8.8#53
Which resolver gave you this answer. The most-skipped line and the most important — the next lesson is built on it.

A dig result shows status: NOERROR but ANSWER: 0 and an empty answer section. What has it proven?

Which line tells you which resolver actually produced the answer you're reading?

A record's TTL is 3600. What does that number govern?

Run it now against a name you actually care about at work. Next: that SERVER: line — why "DNS is fine" is a meaningless sentence until you name the resolver.

Fonte primária · leia em seguida

How to use dig — Julia Evans. Practitioner-grade, one screen long; the "reading the output" section maps exactly onto the four parts above.

Sou seu professor — traga suas perguntas difíceis de “mas por quê”. Exporte seu progresso na página do curso e cole no /teach.

08 / 11Anterior