Index

Module 12 · From ScratchDNS Server

Build Your Own DNS Server

DNS Resolution
DNS Resolution · Open board

The concierge story: your laptop asks one helper for an address and the helper walks the directory for you. That helper is a DNS server. This build writes one.

Before you start. This series builds a small DNS server, the program that turns a name like www.example.test into the number a computer needs to reach it. You need two ideas from the Networking track, refreshed here. DNS is the internet’s name directory: you ask it a name and it answers with an address (DNS Resolution). The question and the answer travel as short fixed-format packets, and DNS on the wire takes a real one apart byte by byte. Write the telegram yourself wrote the question side in Python. This build writes the side that answers. If Go is new to you, Enough Go to read these builds is an optional read first.

Code: teaching/code/from-scratch/dns/. One Go module, six stages, each a program you can run: go run ./01-udp up to go run ./06-forward. Each stage folder holds the files the earlier stages needed plus one or two new ones. Only the Go standard library, and the DNS bytes are built by hand: no DNS package. The real dig is the tester.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Lab

You changed the address. How long until the world stops sending people to the old one?

Set Seconds the concierge keeps the note to 300, press Add next question through the run, and watch the stranded count in The tally.

Open The TTL dial →

Review From Scratch →

Saved in this browser, and to your account when you sign in.