🚀
DNSControl
🚀
DNSControl
  • Introduction to DNSControl
  • Getting Started
    • Overview
    • Examples
    • Migrating zones to DNSControl
    • TypeScript autocomplete and type checking
  • Language Reference
    • JavaScript DSL
    • Top Level Functions
      • D
      • DEFAULTS
      • DOMAIN_ELSEWHERE
      • DOMAIN_ELSEWHERE_AUTO
      • D_EXTEND
      • FETCH
      • HASH
      • IP
      • NewDnsProvider
      • NewRegistrar
      • PANIC
      • REV
      • REVCOMPAT
      • getConfiguredDomains
      • require
      • require_glob
    • Domain Modifiers
      • A
      • AAAA
      • ALIAS
      • AUTODNSSEC_OFF
      • AUTODNSSEC_ON
      • CAA
      • CAA_BUILDER
      • CNAME
      • DHCID
      • DNAME
      • DNSKEY
      • DISABLE_IGNORE_SAFETY_CHECK
      • DMARC_BUILDER
      • DS
      • DefaultTTL
      • DnsProvider
      • FRAME
      • HTTPS
      • IGNORE
      • IGNORE_NAME
      • IGNORE_TARGET
      • IMPORT_TRANSFORM
      • IMPORT_TRANSFORM_STRIP
      • INCLUDE
      • LOC
      • LOC_BUILDER_DD
      • LOC_BUILDER_DMM_STR
      • LOC_BUILDER_DMS_STR
      • LOC_BUILDER_STR
      • M365_BUILDER
      • MX
      • NAMESERVER
      • NAMESERVER_TTL
      • NAPTR
      • NO_PURGE
      • NS
      • PTR
      • PURGE
      • SOA
      • SPF_BUILDER
      • SRV
      • SSHFP
      • SVCB
      • TLSA
      • TXT
      • URL
      • URL301
      • Service Provider specific
        • Akamai Edge Dns
          • AKAMAICDN
        • Amazon Route 53
          • R53_ALIAS
        • Azure DNS
          • AZURE_ALIAS
        • Cloudflare DNS
          • CF_REDIRECT
          • CF_SINGLE_REDIRECT
          • CF_TEMP_REDIRECT
          • CF_WORKER_ROUTE
        • ClouDNS
          • CLOUDNS_WR
    • Record Modifiers
      • TTL
      • Service Provider specific
        • Amazon Route 53
          • R53_ZONE
          • R53_EVALUATE_TARGET_HEALTH
    • Why CNAME/MX/NS targets require a "dot"
  • Provider
    • Supported providers
    • Akamai Edge DNS
    • Amazon Route 53
    • AutoDNS
    • AXFR+DDNS
    • Azure DNS
    • Azure Private DNS
    • BIND
    • Bunny DNS
    • CentralNic Reseller (CNR) - formerly RRPProxy
    • Cloudflare
    • ClouDNS
    • CSC Global
    • deSEC
    • DigitalOcean
    • DNS Made Easy
    • DNSimple
    • DNS-over-HTTPS
    • DOMAINNAMESHOP
    • Dynadot
    • easyname
    • Exoscale
    • Gandi_v5
    • Gcore
    • Google Cloud DNS
    • Hetzner DNS Console
    • HEXONET
    • hosting.de
    • Huawei Cloud DNS
    • Hurricane Electric DNS
    • Internet.bs
    • INWX
    • Linode
    • Loopia
    • LuaDNS
    • Microsoft DNS Server on Microsoft Windows Server
    • Mythic Beasts
    • Namecheap
    • Name.com
    • Netcup
    • Netlify
    • NS1
    • OpenSRS
    • Oracle Cloud
    • OVH
    • Packetframe
    • Porkbun
    • PowerDNS
    • Realtime Register
    • RWTH DNS-Admin
    • Sakura Cloud
    • SoftLayer DNS
    • TransIP
    • Vultr
  • Commands
    • preview/push
    • check-creds
    • get-zones
    • get-certs
    • fmt
    • creds.json
    • Global Flag
    • Disabling Colors
  • Advanced features
    • CI/CD example for GitLab
    • CLI variables
    • Nameservers and Delegations
    • Notifications
    • Useful code tricks
    • JSON Reports
  • Developer info
    • Code Style Guide
    • Documentation Style Guide
    • DNSControl is an opinionated system
    • Writing new DNS providers
    • Creating new DNS Resource Types (rtypes)
    • Integration Tests
    • Test a branch
    • Unit Testing DNS Data
    • Bug Triage Process
    • Bring-Your-Own-Secrets for automated testing
    • Debugging with dlv
    • ALIAS Records
    • TXT record testing
    • DNS records ordering
  • Release
    • How to build and ship a release
    • Changelog v3.16.0
    • GitHub releases
Powered by GitBook
On this page
  • Introduction
  • Parameters
  • Examples
Edit on GitHub
  1. Language Reference
  2. Domain Modifiers

NAPTR

PreviousNAMESERVER_TTLNextNO_PURGE

Last updated 4 months ago

Introduction

NAPTR adds a NAPTR record to the domain. Various formats exist. NAPTR is a part of DDDS such as ENUM (defined by ), SIP (), S-NAPTR () or U-NAPTR ().

Parameters

subdomain

Subdomain of the domain (e.g. example.com) this entry represents.

E164

In the case of E164 (e.g. 3.2.1.5.5.5.0.0.8.1.e164.arpa.) - where is u - the final digit of the zone it represents, or the zone apex record @. For example, the ARPA zone 3.2.1.5.5.5.0.0.8.1.e164.arpa. represents the phone number block 001800555123X (or the synonymous +1800555123X), where X is the final digit of the phone number string, i.e. the .

order

ordinal (1st, 2nd, 3rd, ...) 16 bit number (2^16 i.e. <= 65535) which determines lower entries are sent first (1), and higher, last (65535).

preference

16 bit number (2^16 i.e. <= 65535). At the DNS server, this entry is summed with other entries of identical value and normalised to a fraction of 100 percent, determining the likelihood that this record is returned by the DNS system. Effective for load balancing services.

terminalflag

(case insensitive)

One of [AaSsUuPp], where:

  • a (terminal lookup) means that the output of the rewrite will be a domain-name for which an or record should be queried

  • p Protocol specific

  • s (terminal lookup) indicates that points to a record

  • u (terminal lookup) indicates that is a (SIP) URN or URI

  • "" (empty string) - a non-terminal condition defined by the ENUM application () to indicate that regexp is empty and the replace field contains the FQDN of another NAPTR RR

Flags called 'terminal' halt the looping rewrite algorithm of DNS.

service

(case insensitive)

protocol+rs where protocol defines the protocol used by the DDDS application. rs is the resolution service. There may be 0 or more resolution services each separated by +. ENUM further defines this to be a type field and allows a subtype separated by a colon (:).

For E164, typically one of E2U+SIP (or E2U+sip) or E2U+email. For SIP, typically SIPS+D2T for TCP/TLS sips: URIs, or TLS sip: URIs, or SIP+D2T for TCP based SIP, or SIP+D2U for UDP based SIP. Note that SCTP, WS and WSS are also available.

E2U+pres
E2U+voice:tel+sms:tel (compound form)
E2U+web:http
E2U+sms:mailto
E2U+sms:tel
E2U+sip
E2U+pstn
E2U+tel
SIP+D2T
SIPS+D2T
SIP+D2U
SIP+D2S
SIPS+D2S
SIP+D2W
SIPS+D2W

regexp

[Syntax: delimit ere delimit substitution delimit flag] an ERE or extended regular expression which captures any address string .* found between the line start ^ and finish $ anchors (i.e. !^.*$!), and redirects it to the stated sip:, sips:, tel: or mailto: URI. Other URI forms may be possible. Other delimiter (!) forms are possible. The final flag, if any, shall be i, i.e. case insensitive.

# AUS = Application User String
# all examples use ! as the delimiter for consistency
# and simplicity
# AUS = +441115551234 in all cases

!(\\+441115551234)!tel:\\1!
# explicit check of all characters in string
# the +441115551234 because of () creates a group
# which is referenced by \1 in substitution
# result = tel:+441115551234

!^(\\+441115551234)$!tel:\\1!
# this is functionally identical to the expression
# above but uses ^ and $ to anchor both ends of
# the expression, there is no technical reason to do this
# within an ere and the RFCs are silent on the topic
# result = tel:+441115551234

!(.+)!tel:\\1!
# given the AUS of +441115551234
# the expression (.+) sets back ref 1 = +441115551234
# . = any character, + = 0 or more times
# result = tel:+441115551212

!\\+44111(.+)!sip:775\\1@some.example.com!
# given the AUS of +441115551234 provides partial replacement
# removes the 44111 part and substitutes 775
# result = sip:7755551234@some.example.com

!.*!sip:james@sip.example.com!
# reads and ignores AUS using .*
# and is called a simple replacement expression
# result = sip:james@sip.example.com

U-NAPTR supported regexp fields must be of the form (from the RFC):

"!.*!<URI>!"
# the .* (any character 1 or more times)
# is fixed by the RFC and essentially ignores
# the AUS data. The result will always be URI

target

Not all examples are guaranteed to be standards compliant, or correct.

Examples

Examples for e164 ARPA:

Individual e164 records

dnsconfig.js
D("3.2.1.5.5.5.0.0.8.1.e164.arpa.", REG_MY_PROVIDER, DnsProvider(R53),
  NAPTR("1",  10, 10, "u", "E2U+SIP", "!^.*$!sip:bob@example.com!", "."),
  NAPTR("2",  10, 10, "u", "E2U+SIP", "!^.*$!sip:alice@example.com!", "."),
  NAPTR("4",  10, 10, "u", "E2U+SIP", "!^.*$!sip:kate@example.com!", "."),
  NAPTR("5",  10, 10, "u", "E2U+SIP", "!^.*$!sip:steve@example.com!", "."),
  NAPTR("6",  10, 10, "u", "E2U+SIP", "!^.*$!sip:joe@example.com!", "."),
  NAPTR("7",  10, 10, "u", "E2U+SIP", "!^.*$!sip:jane@example.com!", "."),
  NAPTR("8",  10, 10, "u", "E2U+SIP", "!^.*$!sip:mike@example.com!", "."),
  NAPTR("9",  10, 10, "u", "E2U+SIP", "!^.*$!sip:linda@example.com!", "."),
  NAPTR("0",  10, 10, "u", "E2U+SIP", "!^.*$!sip:fax@example.com!", "."),
);

Single e164 zone

dnsconfig.js
D("4.3.2.1.5.5.5.0.0.8.1.e164.arpa.", REG_MY_PROVIDER, DnsProvider(R53),
  NAPTR("@", 100, 50, "u", "E2U+SIP", "!^.*$!sip:customer-service@example.com!", "."),
  NAPTR("@", 101, 50, "u", "E2U+email", "!^.*$!mailto:information@example.com!", "."),
  NAPTR("@", 101, 50, "u", "smtp+E2U", "!^.*$!mailto:information@example.com!", "."),
);

Examples for SIP:

dnsconfig.js
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
  NAPTR("@", 20, 50, "s", "SIPS+D2T", "", "_sips._tcp.example.com."),
  NAPTR("@", 20, 50, "s", "SIP+D2T", "", "_sip._tcp.example.com."),
  NAPTR("@", 30, 50, "s", "SIP+D2U", "", "_sip._udp.example.com."),
  NAPTR("help", 100, 50, "s", "SIP+D2U", "!^.*$!sip:customer-service@example.com!", "_sip._udp.example.com."),
  NAPTR("help", 101, 50, "s", "SIP+D2T", "!^.*$!sip:customer-service@example.com!", "_sip._tcp.example.com."),
  SRV("_sip._udp", 100, 0, 5060, "sip.example.com."),
  SRV("_sip._tcp", 100, 0, 5060, "sip.example.com."),
  SRV("_sips._tcp", 100, 0, 5061, "sip.example.com."),
  A("sip", "192.0.2.2"),
  AAAA("sip", "2001:db8::85a3"),
  // and so on
);

Other RFC based examples:

dnsconfig.js
D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
  NAPTR("@",100, 50, "a", "z3950+N2L+N2C", "", "cidserver.example.com."),
  NAPTR("@", 50, 50, "a", "rcds+N2C", "", "cidserver.example.com."),
  NAPTR("@", 30, 50, "s", "http+N2L+N2C+N2R", "", "www.example.com."),
  NAPTR("www",100,100, "s", "http+I2R", "", "_http._tcp.example.com."),
  NAPTR("www",100,100, "s", "ftp+I2R", "", "_ftp._tcp.example.com."),
  SRV("_z3950._tcp", 0, 0, 1000, "z3950.beast.example.com."),
  SRV("_http._tcp", 10, 0, 80, "foo.example.com."),
  // and so on
);

Mutually exclusive; more than one cannot be combined in the same record. Since there is no place for a port specification in the NAPTR record, when the a is used, the specified protocol must be running on its default port (Note that at least SIP URI forms allow ports to be specified).

Valid :

Valid :

Examples (taken from ):

A (replacement) record for the target - format depends on .

A , if the is s (syntax: _Service._Proto.Name)

An or if the is a

URI if the is u

IANA registered services for ENUM
IANA registered SIP services
Zytrax
RFC 6116
RFC 3263
RFC 3958
RFC 4848
A
AAAA
SRV
RFC 6116
terminalflag
subdomain
order
target
target
target
terminalflag
terminalflag
SRV
terminalflag
A
AAAA
terminalflag
terminalflag