/etc/hosts names machines for one computer only. DNS does it for everyone: a DNS server holds the names, and every machine asks it. The office's is ns, at 10.0.0.53.
New command
dig
Asks a DNS server about a name, and prints its whole reply.
Usagedig name
text
learner@ops:~$ dig monster.market
…
;; ANSWER SECTION:
monster.market. 300 IN A 10.0.0.10 ← name, TTL, class, type, address
…
;; SERVER: 10.0.0.53#53(10.0.0.53) (UDP) ← who answeredThe answer is an A record: a name's address. TTL is how many seconds a machine may keep the answer before asking again.
+short prints only the answer:
text
learner@ops:~$ dig +short monster.market
10.0.0.10Objectives
- What address does DNS give for monster.market?
- What address does mail.monster.market have?