How does NAPTR record work?
NAPTR record is a type of DNS record that allows the mapping of servers and user addresses in the Session Initiation Protocol (SIP). The combination of NAPTR records with Service Records (SRV) allows the chaining of multiple records to form complex rewrite rules which produce new domain labels or uniform resource identifiers (URIs).
NAPTR record format
A typical NAPTR record looks like one of the following in standard BIND format:
$ORIGIN example.com. @ 10800 IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:firstname.lastname@example.org!" . @ 10800 IN NAPTR 100 10 "S" "SIP+D2U" "" _sip._udp.example.com.An anatomy of the NAPTR Record
@ 10800 IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:email@example.com!" .looks like the below:
|Host Label||TTL||Record Class||Record Type||Order||Preference||Flags||Services||Regular Expression||Replacement|
It defines the hostname of a record and whether the hostname will be appended to the label. Fully qualified hostnames terminated by a period will not append the origin.
The time-to-live in seconds. This is the amount of time the record is allowed to be cached by an outside DNS server.
Mainly 3 classes of DNS records exist:
- IN (Internet) – default and generally what the internet uses.
- CH (Chaosnet) – used for querying DNS server versions.
- HS (Hesiod) – uses DNS functionality to provide access to databases of information that change infrequently.
The record format is defined using this field. Common record types are A, AAAA, CNAME, CAA, TXT etc. In the case of a NAPTR record, the record type is NAPTR.
The Order field is a number (0 - 65535) specifying the order in which multiple NAPTR records must be processed (low to high) by the application.
The Preference field is equivalent to the Priority value in the DDDS algorithm. It is a number (0-65535) that specifies the order (low to high) in which NAPTR records with equal Order values should be processed.
The Flags field contains flags to control aspects of the rewriting and interpretation of the fields in the record. Flags are single characters from the set A-Z and 0-9. The use of this field is specified by the individual DDDS application. Some commonly used Flags are below:
- S (SRV) – the next lookup should be for SRV records.
- A (A, AAAA or A6) – the next lookup should be for either an A, AAAA, or A6 record.
- U (URI) – the next step is not a DNS lookup but that the output of the Regular Expression field is an URI that adheres to the 'absoluteURI' production found in the ABNF of RFC 2396.
- P (Protocol Specific) – the remainder of the application side algorithm shall be carried out in a Protocol-specific fashion.
Regular Expression The Regular Expression field contains a substitution expression that is applied to the original string held by the client in order to construct the next domain name to lookup. See the DDDS algorithm specification for the syntax of this field.
Replacement The Replacement field specifies the next domain name (fully qualified) to query for depending on the potential values found in the flags field. This field is used when the regular expression is empty (a simple replacement operation). The Regular Expression and Replacement fields are mutually exclusive (only one can contain a value).
NAPTR record restrictions
Regular Expression or Replacement
The Regular Expression and Replacement fields are mutually exclusive. Only one of them can be used in a particular record. Their usage is determined by the Flags field.
@ 10800 IN NAPTR 100 10 "U" "E2U+sip" "!^.*$!sip:firstname.lastname@example.org!" .
@ 10800 IN NAPTR 100 10 "S" "SIP+D2U" "" _sip._udp.example.com.
How to add an NAPTR record?
For instructions on how to add a NAPTR record with us, you may refer to the tutorial here.
NAPTR record glossary
DDNS (Dynamic Delegation Discovery System)
The Dynamic Delegation Discovery System is used to implement lazy binding of strings to data, in order to support dynamically configured delegation systems. The DDDS functions by mapping some unique string to data stored within a DDDS Database by iteratively applying string transformation rules until a terminal condition is reached.
Berkeley Internet Name Daemon - is the most commonly used DNS software on the Internet and Dynu observes BIND format.
A wildcard DNS record is a record in a DNS zone that will match requests for non-existent domain names.