RFC 1035: DNS messages and resource records
Summary
RFC 1035 by Paul Mockapetris specified in November 1987 how DNS works technically: message format, resource records, zone files and transport over UDP and TCP on port 53. The limits of that time still shape DNS today, for example 512 bytes per UDP answer, 63 bytes per label and 255 bytes per name. Many extensions, from EDNS to DNSSEC, are ways of exceeding these limits compatibly.
A compact binary format
Every DNS message has a header with an identifier and flags as well as question, answer, authority and additional sections. Resource records consist of name, type, class, TTL and data. To keep answers small, RFC 1035 introduces name compression: repeated parts of names are replaced by pointers to earlier positions in the message.
Many well-known types come directly from RFC 1035, including A, NS, CNAME, SOA, PTR, MX and TXT. The text already declares the older mail types MD and MF obsolete and refers to MX.
512 bytes and their consequences
Answers over UDP are limited to 512 bytes; if an answer does not fit, the server sets the truncation bit and the client asks again over TCP. This limit long forced terse answers and was one reason why there are only 13 root server names. EDNS(0), now described in RFC 6891 from 2013, allows larger UDP answers, which DNSSEC depends on.
TCP was never optional in DNS but was long treated as if it were. In 2016 RFC 7766 made clear that servers and resolvers must fully support DNS over TCP. Firewalls that block TCP on port 53 therefore break large answers.
Ideas
- DNS messages consist of header, question, answer, authority and additional section.
- Resource records combine name, type, class, TTL and data.
- Name compression saves space through pointers to earlier name parts.
- Short answers run over UDP, long ones over TCP, both on port 53.
- The truncation bit tells the client to retry over TCP.
- Zone files describe data in a readable text format.
Insights
- Fixed size limits of an early standard shape its extensions for decades.
- A fallback that is rarely needed withers in practice; DNS over TCP had to be explicitly demanded in 2016.
- The zone file format from RFC 1035 is still the exchange format for DNS data, for example in BIND and NSD.
Facts
- RFC 1035 limits UDP messages to 512 bytes.
- Labels may be at most 63 bytes, whole names at most 255 bytes long.
- The TTL is a 32-bit value in seconds.
- EDNS(0) is described as Internet Standard in RFC 6891 from April 2013.
- RFC 7766 from March 2016 requires full support for DNS over TCP.
References
- RFC 1035: Domain names - implementation and specification
- RFC 1034: Domain Names: Concepts and Facilities (1987)
- RFC 6891: Extension Mechanisms for DNS (EDNS(0)) (2013)
- RFC 7766: DNS Transport over TCP (2016)
Remarks
- RFC 1035 contains examples with names such as SRI-NIC.ARPA, a reminder of the early internet in which the .ARPA domain was still used for host names.
Recommendations
- Always open firewalls for DNS on both UDP and TCP port 53.
- Check zone files with named-checkzone or an equivalent tool before loading them.
- Test large answers, for example from DNSSEC or many TXT records, with dig +bufsize and +tcp.
Read the RFC at the RFC Editor
Found a mistake or have something to add? Get in touch.
Links to the original source and the Web Archive open in a new tab.