github.com/StackExchange/dnscontrol/v4@v4.11.0/documentation/language-reference/domain-modifiers/NAMESERVER.md (about) 1 --- 2 name: NAMESERVER 3 parameters: 4 - name 5 - modifiers... 6 parameter_types: 7 name: string 8 "modifiers...": RecordModifier[] 9 --- 10 11 `NAMESERVER()` instructs DNSControl to inform the domain"s registrar where to find this zone. 12 For some registrars this will also add NS records to the zone itself. 13 14 This takes exactly one argument: the name of the nameserver. It must end with 15 a "." if it is a FQDN, just like all targets. 16 17 This is different than the [`NS()`](NS.md) function, which inserts NS records 18 in the current zone and accepts a label. [`NS()`](NS.md) is useful for downward 19 delegations. `NAMESERVER()` is for informing upstream delegations. 20 21 For more information, refer to [this page](../../nameservers.md). 22 23 {% code title="dnsconfig.js" %} 24 ```javascript 25 D("example.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), 26 DnsProvider(route53, 0), 27 // Replace the nameservers: 28 NAMESERVER("ns1.myserver.com."), 29 NAMESERVER("ns2.myserver.com."), 30 END); 31 32 D("example2.com", REG_MY_PROVIDER, DnsProvider(DSP_MY_PROVIDER), 33 // Add these two additional nameservers to the existing list of nameservers. 34 NAMESERVER("ns1.myserver.com."), 35 NAMESERVER("ns2.myserver.com."), 36 END); 37 ``` 38 {% endcode %} 39 40 41 # The difference between NS() and NAMESERVER() 42 43 Nameservers are one of the least 44 understood parts of DNS, so a little extra explanation is required. 45 46 * [`NS()`](NS.md) lets you add an NS record to a zone, just like [`A()`](A.md) adds an A 47 record to the zone. This is generally used to delegate a subzone. 48 49 * The `NAMESERVER()` directive speaks to the Registrar about how the parent should delegate the zone. 50 51 Since the parent zone could be completely unrelated to the current 52 zone, changes made by `NAMESERVER()` have to be done by an API call to 53 the registrar, who then figures out what to do. For example, if I 54 use `NAMESERVER()` in the zone `stackoverflow.com`, DNSControl talks to 55 the registrar who does the hard work of talking to the people that 56 control `.com`. If the domain was `gmeet.io`, the registrar does 57 the right thing to talk to the people that control `.io`. 58 59 (A better name might have been `PARENTNAMESERVER()` but we didn"t 60 think of that at the time.) 61 62 Each registrar handles delegations differently. Most use 63 the `NAMESERVER()` targets to update the delegation, adding 64 `NS` records to the parent zone as required. 65 Some providers restrict the names to hosts they control. 66 Others may require you to add the `NS` records to the parent domain 67 manually. 68 69 # How to prevent changing the parent NS records? 70 71 If dnsconfig.js has zero `NAMESERVER()` commands for a domain, it will 72 use the API to remove all non-default nameservers. 73 74 If dnsconfig.js has 1 or more `NAMESERVER()` commands for a domain, it 75 will use the API to add those nameservers (unless, of course, 76 they already exist). 77 78 So how do you tell DNSControl not to make any changes at all? Use the 79 special Registrar called "NONE". It makes no changes. 80 81 It looks like this: 82 83 {% code title="dnsconfig.js" %} 84 ```javascript 85 var REG_THIRDPARTY = NewRegistrar("ThirdParty"); 86 D("example.com", REG_THIRDPARTY, 87 ... 88 END); 89 ``` 90 {% endcode %}