Introduction to DNS 00:00:01 Follow a lookup across authorities A browser knows a shop's name. The network needs an address. Follow the question from a cached guess to the authority responsible for the name, then ask what happens when the shop moves. The browser needs the address of www.example.com and asks its resolver. The cache is empty. A root server knows who runs com and says so. A com server knows who runs example.com. The owner's server holds the record and answers with the address and a TTL. The resolver remembers the answer and tells the browser. The browser talks to the web server. DNS plays no part in the page itself. The recursive resolver does the chasing for its client. Referrals identify the next authority; they are not confirmations that the final application server is healthy. 00:00:56 Read the name from its root A name is read from right to left, one label at a time, from the root down. Every name ends with an invisible dot: the root. The last label, com, is looked after by its registry. example.com belongs to whoever registered it. www lives in the owner's zone, so nobody else has to be asked to create it. The rightmost labels describe broader delegation boundaries. Which server is authoritative depends on the zone cuts, not simply on how many dots appear in a printed name. 00:01:30 Which information belongs in a record? The type follows from what the name points at. An IPv4 address needs an A record. An IPv6 address is four times as long, and the type has four As. www is an alias of example.com. Mail for the domain goes to the server with the lowest number. SPF lists who may send mail. Other services check ownership this way. The parent zone names the servers of the child zone. An address record and a canonical-name alias answer different questions. Following an alias creates another resolution step, which can itself be cached according to its record lifetime. 00:02:10 Move a service to a new address Move a site without losing users: lower the TTL first, run both servers, switch, wait. The record lives one hour in caches. Everyone uses the old server. Set it to 60 seconds, then wait one hour so that answers with the old TTL run out. Start the new server. Nothing points at it yet. Change the address. For about a minute some users still go to the old one. A few clients cached too long. Keep the old server until it is quiet. Stop the old server and raise the TTL again. Lower a long lifetime far enough ahead of the move for previously cached answers to expire. Keeping the old destination functional during overlap prevents a correct old answer from becoming a broken connection. 00:03:00 A returned address can be dead Two addresses for one name, and what plain DNS does not notice. DNS returns both addresses in changing order. Users spread roughly evenly. DNS still hands out B. Clients that get it first wait and fail. Good clients try the second address. Others show an error. A provider with health checks stops returning B, or one name points at a load balancer. Returning several addresses can spread attempts but does not make every destination healthy. The resolver's valid cached record and the application's ability to answer are independent observations. 00:03:38 Hand the edge choice to a delivery network One alias gives another company control over the answer, which is the point. static.example.com is a CNAME to a name the CDN owns. The resolver asks the CDN's DNS, which chooses an edge near the question. The browser connects to the chosen edge. Changes behind the delivery provider's alias can now be handled by its DNS records without editing the shop's own alias for each move. A stable alias can delegate address selection to the delivery provider. The browser finally connects to an address, then still needs the application endpoint and its certificate to match the original service name. Names separate identity from a particular address, but cached answers create a period of overlap. Plan the change for the clients still using the old answer as well as those already seeing the new one.