Index

Module 12 · From ScratchDNS Server

DNS 01 and 02: The UDP Socket and the Header

DNS Wire Format
DNS Wire Format · Open board

A real dig example.com, byte by byte. Its first section, the 12-byte header with every flag boxed, is the thing this lesson builds a parser for.

Before you start. Build Your Own DNS Server set out the build: a DNS server answers one question packet with one answer packet, over UDP, and every packet starts with a 12-byte header. This lesson covers the first two stages, because each is small: 01-udp opens the socket and proves bytes arrive, and 02-header reads the 12 bytes and answers with a header alone. A byte is a number from 0 to 255; a packet is a run of them, shown below in hexadecimal, so d0 is 208.

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

Review From Scratch →

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