NAPTR Resource Record
With NAPTR (Naming Authority Pointer) resource records are DNS domain name addresses of servers assigned and other information.
background
Traditionally, names are resolved into IP addresses via the DNS service . You send a name to a DNS server and receive an IP address back (behind which a server is usually hidden). Today, this simple and proven procedure is inadequate in many cases, as the inquirers often need further information.
NAPTR records provide this additional information in a very flexible way. Among other things, the protocol used by the server is specified. If several NAPTR records exist for one name, a prioritization can be defined via the weighting. In addition, if there are several NAPTR records with the same priority for one name, a load distribution can be achieved by preference.
The NAPTR record type can thus be understood as an extension of the classic A record (or SRV record ).
construction
The structure of NAPTR records is complicated because a large number of cases have to be covered. One of the main difficulties is that it is often not a server name that is returned directly, but a regular expression that must first be resolved.
Simple example of a NAPTR record (without regular expression):
dienst.example.com. IN NAPTR 100 10 "A" "" "" prodserver.example.com.
On the left there is a DNS name and on the far right a reference to the name of a server that provides the desired service. The "A" means: The rightmost expression "prodserver.example.com" is an A record. In order to obtain the IP address, a further step is necessary: This A record must be resolved (some name servers such as BIND do this independently and provide the IP address in the additional section).
- DNS name
- Name to be resolved (to which the regular expression may be applied)
- IN
- Internet
- NAPTR
- Naming Authority Pointer (Record Type)
- priority
- Entries with lower numbers must be used first (see MX priority)
- Preference
- Entries with lower numbers should be weighted more heavily (weighting between two entries with the same priority)
- Flag
- Defines the record type that is returned
- service
- indicates the service or protocol that the server is providing
- Regular expression
- This is applied to the DNS name
- Replacement
- String that can be used by the regular expression, or "."
The following flags are currently defined:
- A - the result is an A record
- S - the result is an SRV record
- U - the result is a URI
- empty - the result is a NAPTR record.
In order to obtain the IP address of the server you are looking for, at least one additional DNS request must be made or a URL must be resolved. If the flag is empty, another NAPTR request is required. In this case one speaks of a concatenation.
Regular expression example
The above example is implemented by including a regular expression:
dienst.example.com. IN NAPTR 100 10 "A" "" "!^.*$!prodserver.example.com!".
The regular expression corresponds to a Posix Extended Regular Expression. The first character in the regular expression (here "!") Serves as a delimiter. It is useful as a limiter e.g. B. the "!" instead of the commonly used delimiter "/", since URLs often already contain "/", making the regular expression easier to read. The first field defined by the delimiters (^. * $) Contains information that defines which parts of the input string (service.example.com.) Are to be replaced by the string to the right of the delimiter (prodserver.example.com). "^. * $" means: Everything should be replaced.
Web links
- RFC 2915 - The Naming Authority Pointer (NAPTR) DNS Resource Record