"... As each IPv4 address requires 32 bytes, having 13 servers uses 416 bytes, leaving up to 96 bytes for the remaining protocol information."
The DNS protocol never transmits just plain IP addresses, but properly formatted queries and answers composed of DNS resource records.
The "IPv4 address requires 32 bytes" probably does not refer to the size of the plain IP address, but to the size of the
A resource record as formatted for transfer in the DNS protocol.
It looks like this value would have been accurate back when all root DNS servers had unique, non-systematic names, but since the root nameservers have now been re-named to the format
x.ROOT-SERVERS.NET, the current state is a bit more complicated.
I just ran
tcpdump on a BIND9 DNS server start-up, and it looks like the first A record will take just slightly more than 32 bytes, as it includes:
- the full name
a.root-servers.net (with one byte for the length of each name component and one zero byte at the end = 20 bytes total)
- a 16-bit record type code (2 bytes)
- a 16-bit record class code (2 bytes)
- a 32-bit TTL value (4 bytes)
- a 16-bit data length value (2 bytes)
- a 32-bit IP address (4 bytes)
So if you're requesting the A records for the root DNS servers, the first answer record would actually take 34 bytes.
Any subsequent answer records in the same DNS message can refer back to any previously-mentioned name or part of one, so that if
a.root-servers.net is mentioned in full, then
b.root-servers.net can be expressed in just 4 bytes (2 bytes for the
b part, 2 bytes to back-reference the
root-servers.net suffix). As a result, any other A records for the root servers will take just 17 bytes each.
The actual start-up query by BIND9 is equivalent to
dig . NS and happens over TCP rather than UDP.
As a result, the first answer record is a NS record of 31 bytes, listing the first root DNS server with full name. Subsequent NS records for the other root servers will take just 15 bytes each. As the A records presented as additional information will be able to back-reference each root server hostname in full, each A record for a root DNS server will take just 16 bytes. The response also includes the IPv6 AAAA records for the root nameservers. Even so, total length of the DNS response is just 1097 bytes.