2017-08-15 10:46:31 -07:00
|
|
|
---
|
|
|
|
name: NAMESERVER
|
|
|
|
parameters:
|
|
|
|
- name
|
|
|
|
- modifiers...
|
2023-01-12 16:59:42 -05:00
|
|
|
parameter_types:
|
|
|
|
name: string
|
|
|
|
"modifiers...": RecordModifier[]
|
2017-08-15 10:46:31 -07:00
|
|
|
---
|
|
|
|
|
2018-03-22 11:31:53 -04:00
|
|
|
`NAMESERVER()` instructs DNSControl to inform the domain's registrar where to find this zone.
|
2017-08-15 10:46:31 -07:00
|
|
|
For some registrars this will also add NS records to the zone itself.
|
|
|
|
|
2018-03-22 11:31:53 -04:00
|
|
|
This takes exactly one argument: the name of the nameserver. It must end with
|
|
|
|
a "." if it is a FQDN, just like all targets.
|
|
|
|
|
2023-03-15 23:43:57 +01:00
|
|
|
This is different than the [`NS()`](NS.md) function, which inserts NS records
|
|
|
|
in the current zone and accepts a label. [`NS()`](NS.md) is useful for downward
|
2020-09-21 09:26:24 -04:00
|
|
|
delegations. `NAMESERVER()` is for informing upstream delegations.
|
|
|
|
|
2023-01-20 13:56:20 +01:00
|
|
|
For more information, refer to [this page](../../nameservers.md).
|
2017-08-15 10:46:31 -07:00
|
|
|
|
2023-03-13 21:30:21 +01:00
|
|
|
{% code title="dnsconfig.js" %}
|
2023-01-20 13:56:20 +01:00
|
|
|
```javascript
|
2017-08-15 10:46:31 -07:00
|
|
|
D("example.com", REGISTRAR, .... ,
|
2020-09-21 09:26:24 -04:00
|
|
|
DnsProvider(route53, 0),
|
|
|
|
// Replace the nameservers:
|
|
|
|
NAMESERVER("ns1.myserver.com."),
|
|
|
|
NAMESERVER("ns2.myserver.com."),
|
|
|
|
);
|
|
|
|
|
|
|
|
D("example2.com", REGISTRAR, .... ,
|
|
|
|
// Add these two additional nameservers to the existing list of nameservers.
|
2018-03-22 11:31:53 -04:00
|
|
|
NAMESERVER("ns1.myserver.com."),
|
|
|
|
NAMESERVER("ns2.myserver.com."),
|
2017-08-15 10:46:31 -07:00
|
|
|
);
|
2022-02-17 18:22:31 +01:00
|
|
|
```
|
2023-03-13 21:30:21 +01:00
|
|
|
{% endcode %}
|
2020-01-29 13:47:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
# The difference between NS() and NAMESERVER()
|
|
|
|
|
|
|
|
Nameservers are one of the least
|
|
|
|
understood parts of DNS, so a little extra explanation is required.
|
|
|
|
|
2023-03-15 23:43:57 +01:00
|
|
|
* [`NS()`](NS.md) lets you add an NS record to a zone, just like [`A()`](A.md) adds an A
|
2020-09-21 09:26:24 -04:00
|
|
|
record to the zone. This is generally used to delegate a subzone.
|
2020-01-29 13:47:32 -05:00
|
|
|
|
2020-09-21 09:26:24 -04:00
|
|
|
* The `NAMESERVER()` directive speaks to the Registrar about how the parent should delegate the zone.
|
2020-01-29 13:47:32 -05:00
|
|
|
|
|
|
|
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
|
2020-09-21 09:26:24 -04:00
|
|
|
use `NAMESERVER()` in the zone `stackoverflow.com`, DNSControl talks to
|
2020-01-29 13:47:32 -05:00
|
|
|
the registrar who does the hard work of talking to the people that
|
2020-09-21 09:26:24 -04:00
|
|
|
control `.com`. If the domain was `gmeet.io`, the registrar does
|
2020-01-29 13:47:32 -05:00
|
|
|
the right thing to talk to the people that control `.io`.
|
|
|
|
|
2020-09-21 09:26:24 -04:00
|
|
|
(A better name might have been `PARENTNAMESERVER()` but we didn't
|
2020-01-29 13:47:32 -05:00
|
|
|
think of that at the time.)
|
|
|
|
|
2020-09-21 09:26:24 -04:00
|
|
|
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.
|
2020-01-29 13:47:32 -05:00
|
|
|
|
2023-03-13 21:33:05 +01:00
|
|
|
# How to prevent changing the parent NS records?
|
2020-01-29 13:47:32 -05:00
|
|
|
|
|
|
|
If dnsconfig.js has zero `NAMESERVER()` commands for a domain, it will
|
2020-09-21 09:26:24 -04:00
|
|
|
use the API to remove all non-default nameservers.
|
2020-01-29 13:47:32 -05:00
|
|
|
|
|
|
|
If dnsconfig.js has 1 or more `NAMESERVER()` commands for a domain, it
|
2020-09-21 09:26:24 -04:00
|
|
|
will use the API to add those nameservers (unless, of course,
|
|
|
|
they already exist).
|
2020-01-29 13:47:32 -05:00
|
|
|
|
2020-09-21 09:26:24 -04:00
|
|
|
So how do you tell DNSControl not to make any changes at all? Use the
|
2020-01-29 13:47:32 -05:00
|
|
|
special Registrar called "NONE". It makes no changes.
|
|
|
|
|
|
|
|
It looks like this:
|
|
|
|
|
2023-03-13 21:30:21 +01:00
|
|
|
{% code title="dnsconfig.js" %}
|
2023-01-20 13:56:20 +01:00
|
|
|
```javascript
|
2020-01-29 13:47:32 -05:00
|
|
|
var REG_THIRDPARTY = NewRegistrar('ThirdParty', 'NONE')
|
|
|
|
D("mydomain.com", REG_THIRDPARTY,
|
|
|
|
...
|
|
|
|
)
|
|
|
|
```
|
2023-03-13 21:30:21 +01:00
|
|
|
{% endcode %}
|