DNS NAPTR (Naming Authority Pointer) records provide a powerful mechanism for rewriting domain names and defining rules for how domain names should be processed. They are commonly used in telecommunications and VoIP applications to enable services like ENUM (E.164 Number Mapping) and dynamic domain name resolution.
NAPTR records contain rules for rewriting domain names using regular expressions and specifying the next step in a resolution process. Each NAPTR record includes an order value, preference value, flags, service identifier, regular expression pattern, and replacement value. This complex structure enables sophisticated domain name processing scenarios.
These records are most commonly used in telecommunications for converting telephone numbers into domain names (ENUM), enabling VoIP routing, and implementing dynamic DNS resolution based on service requirements. NAPTR records can chain together to create complex resolution paths.
When processing NAPTR records, DNS resolvers first sort them by order value, then by preference value for records with the same order. The resolver then applies the regular expression pattern to the original query name. If the pattern matches, the replacement operation is performed according to the flags and replacement fields.
The flags field determines how the replacement should be interpreted - whether it should be treated as a final answer, whether additional DNS lookups are needed, or whether the result should be processed by specific protocols. This flexibility makes NAPTR records suitable for complex service discovery scenarios.
A common use case is ENUM, where a telephone number like +1-555-123-4567 is converted to a domain name like 7.6.5.4.3.2.1.5.5.5.1.e164.arpa, and NAPTR records define how to route calls or messages to that number through various services like SIP, email, or web.