🚀
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
  • The difference between NS() and NAMESERVER()
  • How to prevent changing the parent NS records?
Edit on GitHub
  1. Language Reference
  2. Domain Modifiers

NAMESERVER

PreviousMXNextNAMESERVER_TTL

Last updated 5 months ago

NAMESERVER() instructs DNSControl to inform the domain's registrar where to find this zone. For some registrars this will also add NS records to the zone itself.

This takes exactly one argument: the name of the nameserver. It must end with a "." if it is a FQDN, just like all targets.

This is different than the function, which inserts NS records in the current zone and accepts a label. is for downward delegations. NAMESERVER() is for informing upstream delegations.

For more information, refer to .

dnsconfig.js
D("example.com", REG_MY_PROVIDER,
  DnsProvider(DSP_MY_PROVIDER),
  DnsProvider(route53, 0),
  // Replace the nameservers:
  NAMESERVER("ns1.myserver.com."),
  NAMESERVER("ns2.myserver.com."),
);

D("example2.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER),
  // Add these two additional nameservers to the existing list of nameservers.
  NAMESERVER("ns1.myserver.com."),
  NAMESERVER("ns2.myserver.com."),
);

The difference between NS() and NAMESERVER()

Nameservers are one of the least understood parts of DNS, so a little extra explanation is required.

  • The NAMESERVER() directive speaks to the Registrar about how the parent should delegate the zone.

Since the parent zone could be completely unrelated to the current zone, changes made by NAMESERVER() have to be done by an API call to the registrar, who then figures out what to do. For example, if I use NAMESERVER() in the zone stackoverflow.com, DNSControl talks to the registrar who does the hard work of talking to the people that control .com. If the domain was gmeet.io, the registrar does the right thing to talk to the people that control .io.

(A better name might have been PARENTNAMESERVER() but we didn"t think of that at the time.)

Each registrar handles delegations differently. Most use the NAMESERVER() targets to update the delegation, adding NS records to the parent zone as required. Some providers restrict the names to hosts they control. Others may require you to add the NS records to the parent domain manually.

How to prevent changing the parent NS records?

If dnsconfig.js has zero NAMESERVER() commands for a domain, it will use the API to remove all non-default nameservers.

If dnsconfig.js has 1 or more NAMESERVER() commands for a domain, it will use the API to add those nameservers (unless, of course, they already exist).

So how do you tell DNSControl not to make any changes at all? Use the special Registrar called "NONE". It makes no changes.

It looks like this:

dnsconfig.js
var REG_THIRDPARTY = NewRegistrar("ThirdParty");
D("example.com", REG_THIRDPARTY,
  ...
);

adds an NS record to a zone, just like adds an A record to the zone. This is generally used to delegate a subzone.

NS()
NS()
this page
NS()
A()