DNS names are encoded as length-prefixed labels, not dotted text. This flagship strip follows the QNAME bytes and the question tail byte for byte.

highlighted = computed this step

Why names are length-prefixed

The DNS name is not sent with dots. Each label starts with a length byte, then the label bytes follow.

QNAME bytes=17\text{QNAME bytes}=17
QNAME bytesThe DNS name is decoded from length-prefixed labels.QNAME bytes136 bits / 17 bytes0x03777777076578616d706c6503636f6d00byte 0byte 1byte 2byte 300000011011101110111011101110111byte 4byte 5byte 6byte 700000111011001010111100001100001byte 8byte 9byte 10byte 1101101101011100000110110001100101byte 12byte 13byte 14byte 1500000011011000110110111101101101byte 1600000000len-www3www0x777777len-example7(cont.)example0x6578616d706c65len-com3com0x636f6dterminator0x00Question tail32 bits / 4 bytes0x00010001byte 0byte 1byte 2byte 300000000000000010000000000000001qtype0x0001qclass0x0001

Decode the labels

The length bytes are 3, 7, and 3, followed by a zero terminator.

3,7,3,03,7,3,0
QNAME bytesThe DNS name is decoded from length-prefixed labels.QNAME bytes136 bits / 17 bytes0x03777777076578616d706c6503636f6d00byte 0byte 1byte 2byte 300000011011101110111011101110111byte 4byte 5byte 6byte 700000111011001010111100001100001byte 8byte 9byte 10byte 1101101101011100000110110001100101byte 12byte 13byte 14byte 1500000011011000110110111101101101byte 1600000000len-www3www0x777777len-example7(cont.)example0x6578616d706c65len-com3com0x636f6dterminator0x00Question tail32 bits / 4 bytes0x00010001byte 0byte 1byte 2byte 300000000000000010000000000000001qtype0x0001qclass0x0001

Question type and class

The tail asks for type A as 1 and class IN as 1.

QTYPE=1,QCLASS=1\text{QTYPE}=1,\quad\text{QCLASS}=1
QNAME bytesThe DNS name is decoded from length-prefixed labels.QNAME bytes136 bits / 17 bytes0x03777777076578616d706c6503636f6d00byte 0byte 1byte 2byte 300000011011101110111011101110111byte 4byte 5byte 6byte 700000111011001010111100001100001byte 8byte 9byte 10byte 1101101101011100000110110001100101byte 12byte 13byte 14byte 1500000011011000110110111101101101byte 1600000000len-www3www0x777777len-example7(cont.)example0x6578616d706c65len-com3com0x636f6dterminator0x00Question tail32 bits / 4 bytes0x00010001byte 0byte 1byte 2byte 300000000000000010000000000000001qtype0x0001qclass0x0001

Summary

The question name is a sequence of length-prefixed labels followed by type and class. Message structure and exact bytes only; resolution timing, caching, and UDP/TCP transport are not modeled here.

QTYPE=1\text{QTYPE}=1
QNAME bytesThe DNS name is decoded from length-prefixed labels.QNAME bytes136 bits / 17 bytes0x03777777076578616d706c6503636f6d00byte 0byte 1byte 2byte 300000011011101110111011101110111byte 4byte 5byte 6byte 700000111011001010111100001100001byte 8byte 9byte 10byte 1101101101011100000110110001100101byte 12byte 13byte 14byte 1500000011011000110110111101101101byte 1600000000len-www3www0x777777len-example7(cont.)example0x6578616d706c65len-com3com0x636f6dterminator0x00Question tail32 bits / 4 bytes0x00010001byte 0byte 1byte 2byte 300000000000000010000000000000001qtype0x0001qclass0x0001