github.com/teknogeek/dnscontrol/v2@v2.10.1-0.20200227202244-ae299b55ba42/docs/_functions/domain/NAMESERVER.md (about)

     1  ---
     2  name: NAMESERVER
     3  parameters:
     4    - name
     5    - modifiers...
     6  ---
     7  
     8  `NAMESERVER()` instructs DNSControl to inform the domain's registrar where to find this zone.
     9  For some registrars this will also add NS records to the zone itself.
    10  
    11  This takes exactly one argument: the name of the nameserver. It must end with
    12  a "." if it is a FQDN, just like all targets.
    13  
    14  This is different than the `NS()` function, which inserts NS records
    15  in the current zone and accepts a label. It is useful for downward
    16  delegations. This is for informing upstream delegations.
    17  
    18  {% include startExample.html %}
    19  {% highlight js %}
    20  
    21  D("example.com", REGISTRAR, .... ,
    22    NAMESERVER("ns1.myserver.com."),
    23    NAMESERVER("ns2.myserver.com."),
    24  );
    25  
    26  {%endhighlight%}
    27  {% include endExample.html %}
    28  
    29  
    30  # The difference between NS() and NAMESERVER()
    31  
    32  Nameservers are one of the least
    33  understood parts of DNS, so a little extra explanation is required.
    34  
    35  * `NS()` lets you add an NS record to a zone, just like A() adds an A
    36    record to the zone.
    37  
    38  * The `NAMESERVER()` directive adds an NS record to the parent zone.
    39  
    40  Since the parent zone could be completely unrelated to the current
    41  zone, changes made by `NAMESERVER()` have to be done by an API call to
    42  the registrar, who then figures out what to do. For example, if I
    43  change the `NAMESERVER()` for stackoverflow.com, DNSControl talks to
    44  the registrar who does the hard work of talking to the people that
    45  control `.com`.  If the domain was gmeet.io, the registrar does
    46  the right thing to talk to the people that control `.io`.
    47  
    48  (Maybe it should have been called `PARENTNAMESERVER()` but we didn't
    49  think of that at the time.)
    50  
    51  When you use `NAMESERVER()`, DNSControl takes care of adding the
    52  appropriate `NS` records to the zone.
    53  
    54  Therefore, you don't have to specify `NS()` records except when
    55  delegating a subdomain, in which case you are acting like a registrar!
    56  
    57  Many DNS Providers will handle all of this for you, pick the name of
    58  the nameservers for you and updating them (upward and in your zone)
    59  automatically.  For more information, refer to
    60  [this page]({{site.github.url}}/nameservers).
    61  
    62  
    63  That's why NAMESERVER() is a separate operator.
    64  
    65  
    66  # How to not change the parent NS records?
    67  
    68  If dnsconfig.js has zero `NAMESERVER()` commands for a domain, it will
    69  use the API to remove all the nameservers.
    70  
    71  If dnsconfig.js has 1 or more `NAMESERVER()` commands for a domain, it
    72  will use the API to set those as the nameservers (unless, of course,
    73  they're already correct).
    74  
    75  So how do you tell DNSControl not to make any changes?  Use the
    76  special Registrar called "NONE". It makes no changes.
    77  
    78  It looks like this:
    79  
    80  ```
    81  var REG_THIRDPARTY = NewRegistrar('ThirdParty', 'NONE')
    82  D("mydomain.com", REG_THIRDPARTY,
    83    ...
    84  )
    85  ```