TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

โ† Back to DNS

๐Ÿ“– DNS: cheat sheet

๐ŸŽจ The analogyRinging the operator for a shop's street number, who asks around and writes the answer down for next time.
๐ŸŽ“ The regular explanationThe internet's directory. DNS turns names like www.shop.com into IP addresses by asking a chain of servers (root, top-level domain, authoritative) and caching every answer for a set time.
Looking up a nameStep 5 of 5
๐Ÿง’You๐Ÿ‘ฉโ€๐Ÿ’ผOperatorcached 1h๐Ÿ›๏ธHead office๐Ÿ—‚๏ธThe .com desk๐Ÿ“–Shop's own bookauthoritative
  1. You know the shop's name, www.shop.com, but not its street number. So you ring the operator and ask.
  2. The operator doesn't know either, so they ask head office, which only knows who looks after names ending in .com.
  3. The .com desk doesn't have the street number, but knows whose book does, the shop's own book.
  4. The shop's own book has the real answer, number 93.184.216.34, good for an hour.
  5. The operator writes it down in case anyone else asks, and tells you. Now you can walk to the right house.
Remembering answersStep 5 of 5
๐Ÿง’Youcached๐Ÿ‘งYour neighbour๐Ÿ‘ฉโ€๐Ÿ’ผOperatorcached 1h๐Ÿ“–Shop's own booknow 203.0.113.9
  1. You ask for the shop's number. The operator has to look it up properly the first time, and notes it for an hour.
  2. Your neighbour asks for the same shop a minute later. The operator answers straight from the notes, no calls needed.
  3. Your own laptop keeps a little notebook too, so asking again doesn't even need a phone call.
  4. The shop moves to a new street number. Anyone with old notes keeps going to the old house until their hour runs out.
  5. Once the hour is up, the operator rubs out the old note and asks the shop's book again, getting the new number.
Kinds of recordsStep 4 of 4
๐Ÿง’You๐Ÿ“ฌPostman๐Ÿ‘ฉโ€๐Ÿ’ผOperatorCNAME shop.cdn.net๐ŸฌBranch shop๐Ÿ“ฎShop's mailroomTXT: SPF
  1. The book's entry for www.shop.com just says "see branch-shop.net". It's a nickname that points to another name.
  2. The branch shop's entry gives a street number close to you, so your visit is quick.
  3. The postman asks a different question, "where do letters for shop.com go?" The book has a separate line for that.
  4. The book also has a notes column, where the shop writes things like "only these postmen really work for us".

๐Ÿงฉ Key questions

The operator doesn't have every number in the world. Who do they ask first?
Head office, which knows which desk handles names ending in .com. Head office points to the right desk, the desk points to the shop's own book, and the book has the answer.
The shop moves to a new street number. Why do some people keep going to the old one?
They have an old note whose hour isn't up yet. Writing answers down saves time, but notes stay until their hour is up.
A line in the shop's book says "look under this other name instead". What kind of line is it?
A nickname line. The book has different kinds of lines: the number, nicknames, where post goes, and notes.