NAPTR record explained

The NAPTR records are not as commonly used as A DNS records, but they have an important purpose: linking servers and users’ addresses in SIP.

What is the NAPTR record?

NAPTR DNS record is a Name Authority Pointer record. It is a type of DNS record that serves to map servers to the users’ addresses in the so-called Session Initiation Protocol or SIP for short. The NAPTR records, together with another type of DNS record called SRV records (service records), allow complex rewriting of rules that provide new uniform resource identifiers (URIs) or domain labels. Depending on the flag of the newly created URI or domain label, it could be used in the following query for a NAPTR record or directly as an output of the entire process for URI mapping.

The existence of NAPTR record allows lookup of services for many different resource names like URIs, which are not a part of domain name syntax.

If you want to read all the available information, you can see its RFC file (RFC 2915).

Why do we need a NAPTR record?

NAPTR records work together with SIP, with the SRV records involved, too, to see what kind of services are there for a domain name. When somebody performs a query for the NAPTR records, this person will see the protocols and ports that you use, if your domain name supports SIP, or any other VoIP service, and more.

What’s inside a NAPTR record

The values that you can see inside a DNS NAPTR records are:

  • TYPE: NAPTR or its code, which is 35
  • Domain name: the hostname to which it belongs. It is the key for the rule database.
  • TTL: Time to live for the DNS record
  • Order: It is a number (16-bit unsigned integer) that shows the order by which the NAPTR records must be processed to obey the rules properly. Lower numbers go first. If the values are the same, for two or more NAPTR records, the order is determined by the preference values.
  • Preference: It is a value (16-bit unsigned integer) that determines NAPTR records’ order with the same order number. Again, lower numbers go first. The difference with the Order number is that Preference gives weight to rules, which are otherwise equal. 
  • Flags: The flags are written with letters. There are only 4 for now: S, A, U, and P. What they indicate is if there will be a next lookup or no, and what should follow.

S: The next lookup, should be for the SRV record.

A: The next lookup, should be for the A, AAAA, or A6 records.

U: The next will be URI output.

P: Stands for the protocol and shows that the next step will be determined by the protocol.

  • Service: Sets the service or services down the rewrite path. It could also be a specific protocol that is used for a service.  
  • Regular expression: Also written Regexp is a string that gets attached to the original string to construct the next domain name for a lookup. It should connect the string from the client, not from a previous NAPTR record.  
  • Replacement: Depending on the flag, what is the next name (fully qualified domain name) to query for NAPTR, SRV, or another record.

Conclusion

The NAPTR record is not that simple as other DNS records, but you will need to understand it in order to apply it for VoIP services properly.

Leave a Reply

Your email address will not be published. Required fields are marked *