1<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
2               "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3	       [<!ENTITY mdash "&#8212;">]>
4<!--
5 - Copyright (C) 2004-2012  Internet Systems Consortium, Inc. ("ISC")
6 - Copyright (C) 2000-2003  Internet Software Consortium.
7 -
8 - Permission to use, copy, modify, and/or distribute this software for any
9 - purpose with or without fee is hereby granted, provided that the above
10 - copyright notice and this permission notice appear in all copies.
11 -
12 - THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
13 - REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14 - AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15 - INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16 - LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17 - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18 - PERFORMANCE OF THIS SOFTWARE.
19-->
20
21<!-- $Id$ -->
22<refentry id="man.nsupdate">
23  <refentryinfo>
24    <date>Aug 25, 2009</date>
25  </refentryinfo>
26  <refmeta>
27    <refentrytitle><application>nsupdate</application></refentrytitle>
28    <manvolnum>1</manvolnum>
29    <refmiscinfo>BIND9</refmiscinfo>
30  </refmeta>
31  <refnamediv>
32    <refname><application>nsupdate</application></refname>
33    <refpurpose>Dynamic DNS update utility</refpurpose>
34  </refnamediv>
35
36  <docinfo>
37    <copyright>
38      <year>2004</year>
39      <year>2005</year>
40      <year>2006</year>
41      <year>2007</year>
42      <year>2008</year>
43      <year>2009</year>
44      <year>2010</year>
45      <year>2011</year>
46      <year>2012</year>
47      <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
48    </copyright>
49    <copyright>
50      <year>2000</year>
51      <year>2001</year>
52      <year>2002</year>
53      <year>2003</year>
54      <holder>Internet Software Consortium.</holder>
55    </copyright>
56  </docinfo>
57
58  <refsynopsisdiv>
59    <cmdsynopsis>
60      <command>nsupdate</command>
61      <arg><option>-d</option></arg>
62      <arg><option>-D</option></arg>
63      <group>
64	<arg><option>-g</option></arg>
65	<arg><option>-o</option></arg>
66	<arg><option>-l</option></arg>
67        <arg><option>-y <replaceable class="parameter"><optional>hmac:</optional>keyname:secret</replaceable></option></arg>
68        <arg><option>-k <replaceable class="parameter">keyfile</replaceable></option></arg>
69      </group>
70      <arg><option>-t <replaceable class="parameter">timeout</replaceable></option></arg>
71      <arg><option>-u <replaceable class="parameter">udptimeout</replaceable></option></arg>
72      <arg><option>-r <replaceable class="parameter">udpretries</replaceable></option></arg>
73      <arg><option>-R <replaceable class="parameter">randomdev</replaceable></option></arg>
74      <arg><option>-v</option></arg>
75      <arg>filename</arg>
76    </cmdsynopsis>
77  </refsynopsisdiv>
78
79  <refsect1>
80    <title>DESCRIPTION</title>
81    <para><command>nsupdate</command>
82      is used to submit Dynamic DNS Update requests as defined in RFC 2136
83      to a name server.
84      This allows resource records to be added or removed from a zone
85      without manually editing the zone file.
86      A single update request can contain requests to add or remove more than
87      one
88      resource record.
89    </para>
90    <para>
91      Zones that are under dynamic control via
92      <command>nsupdate</command>
93      or a DHCP server should not be edited by hand.
94      Manual edits could
95      conflict with dynamic updates and cause data to be lost.
96    </para>
97    <para>
98      The resource records that are dynamically added or removed with
99      <command>nsupdate</command>
100      have to be in the same zone.
101      Requests are sent to the zone's master server.
102      This is identified by the MNAME field of the zone's SOA record.
103    </para>
104    <para>
105      The
106      <option>-d</option>
107      option makes
108      <command>nsupdate</command>
109      operate in debug mode.
110      This provides tracing information about the update requests that are
111      made and the replies received from the name server.
112    </para>
113    <para>
114      The <option>-D</option> option makes <command>nsupdate</command>
115      report additional debugging information to <option>-d</option>.
116    </para>
117    <para>
118      The <option>-L</option> option with an integer argument of zero or
119      higher sets the logging debug level.  If zero, logging is disabled.
120    </para>
121    <para>
122      Transaction signatures can be used to authenticate the Dynamic
123      DNS updates.  These use the TSIG resource record type described
124      in RFC 2845 or the SIG(0) record described in RFC 2535 and
125      RFC 2931 or GSS-TSIG as described in RFC 3645.  TSIG relies on
126      a shared secret that should only be known to
127      <command>nsupdate</command> and the name server.  Currently,
128      the only supported encryption algorithm for TSIG is HMAC-MD5,
129      which is defined in RFC 2104.  Once other algorithms are
130      defined for TSIG, applications will need to ensure they select
131      the appropriate algorithm as well as the key when authenticating
132      each other.  For instance, suitable <type>key</type> and
133      <type>server</type> statements would be added to
134      <filename>/etc/named.conf</filename> so that the name server
135      can associate the appropriate secret key and algorithm with
136      the IP address of the client application that will be using
137      TSIG authentication.  SIG(0) uses public key cryptography.
138      To use a SIG(0) key, the public key must be stored in a KEY
139      record in a zone served by the name server.
140      <command>nsupdate</command> does not read
141      <filename>/etc/named.conf</filename>.
142    </para>
143    <para>
144      GSS-TSIG uses Kerberos credentials.  Standard GSS-TSIG mode
145      is switched on with the <option>-g</option> flag.  A
146      non-standards-compliant variant of GSS-TSIG used by Windows
147      2000 can be switched on with the <option>-o</option> flag.
148    </para>
149    <para><command>nsupdate</command>
150      uses the <option>-y</option> or <option>-k</option> option
151      to provide the shared secret needed to generate a TSIG record
152      for authenticating Dynamic DNS update requests, default type
153      HMAC-MD5.  These options are mutually exclusive. 
154    </para>
155    <para>
156      When the <option>-y</option> option is used, a signature is
157      generated from
158      <optional><parameter>hmac:</parameter></optional><parameter>keyname:secret.</parameter>
159      <parameter>keyname</parameter> is the name of the key, and
160      <parameter>secret</parameter> is the base64 encoded shared secret.
161      Use of the <option>-y</option> option is discouraged because the
162      shared secret is supplied as a command line argument in clear text.
163      This may be visible in the output from
164      <citerefentry>
165        <refentrytitle>ps</refentrytitle><manvolnum>1</manvolnum>
166      </citerefentry>
167      or in a history file maintained by the user's shell.
168    </para>
169    <para>
170      With the
171      <option>-k</option> option, <command>nsupdate</command> reads
172      the shared secret from the file <parameter>keyfile</parameter>.
173      Keyfiles may be in two formats: a single file containing
174      a <filename>named.conf</filename>-format <command>key</command>
175      statement, which may be generated automatically by
176      <command>ddns-confgen</command>, or a pair of files whose names are
177      of the format <filename>K{name}.+157.+{random}.key</filename> and
178      <filename>K{name}.+157.+{random}.private</filename>, which can be
179      generated by <command>dnssec-keygen</command>.
180      The <option>-k</option> may also be used to specify a SIG(0) key used
181      to authenticate Dynamic DNS update requests.  In this case, the key
182      specified is not an HMAC-MD5 key.
183    </para>
184    <para>
185      <command>nsupdate</command> can be run in a local-host only mode
186      using the <option>-l</option> flag.  This sets the server address to
187      localhost (disabling the <command>server</command> so that the server
188      address cannot be overridden).  Connections to the local server will
189      use a TSIG key found in <filename>/var/run/named/session.key</filename>,
190      which is automatically generated by <command>named</command> if any
191      local master zone has set <command>update-policy</command> to
192      <command>local</command>.  The location of this key file can be
193      overridden with the <option>-k</option> option.
194    </para>
195    <para>
196      By default, <command>nsupdate</command>
197      uses UDP to send update requests to the name server unless they are too
198      large to fit in a UDP request in which case TCP will be used.
199      The
200      <option>-v</option>
201      option makes
202      <command>nsupdate</command>
203      use a TCP connection.
204      This may be preferable when a batch of update requests is made.
205    </para>
206    <para>
207      The <option>-p</option> sets the default port number to use for
208      connections to a name server.  The default is 53.
209    </para>
210    <para>
211      The <option>-t</option> option sets the maximum time an update request
212      can
213      take before it is aborted.  The default is 300 seconds.  Zero can be
214      used
215      to disable the timeout.
216    </para>
217    <para>
218      The <option>-u</option> option sets the UDP retry interval.  The default
219      is
220      3 seconds.  If zero, the interval will be computed from the timeout
221      interval
222      and number of UDP retries.
223    </para>
224    <para>
225      The <option>-r</option> option sets the number of UDP retries. The
226      default is
227      3.  If zero, only one update request will be made.
228    </para>
229    <para>
230      The <option>-R <replaceable
231      class="parameter">randomdev</replaceable></option> option
232      specifies a source of randomness.  If the operating system
233      does not provide a <filename>/dev/random</filename> or
234      equivalent device, the default source of randomness is keyboard
235      input.  <filename>randomdev</filename> specifies the name of
236      a character device or file containing random data to be used
237      instead of the default.  The special value
238      <filename>keyboard</filename> indicates that keyboard input
239      should be used.  This option may be specified multiple times.
240    </para>
241  </refsect1>
242
243  <refsect1>
244    <title>INPUT FORMAT</title>
245    <para><command>nsupdate</command>
246      reads input from
247      <parameter>filename</parameter>
248      or standard input.
249      Each command is supplied on exactly one line of input.
250      Some commands are for administrative purposes.
251      The others are either update instructions or prerequisite checks on the
252      contents of the zone.
253      These checks set conditions that some name or set of
254      resource records (RRset) either exists or is absent from the zone.
255      These conditions must be met if the entire update request is to succeed.
256      Updates will be rejected if the tests for the prerequisite conditions
257      fail.
258    </para>
259    <para>
260      Every update request consists of zero or more prerequisites
261      and zero or more updates.
262      This allows a suitably authenticated update request to proceed if some
263      specified resource records are present or missing from the zone.
264      A blank input line (or the <command>send</command> command)
265      causes the
266      accumulated commands to be sent as one Dynamic DNS update request to the
267      name server.
268    </para>
269    <para>
270      The command formats and their meaning are as follows:
271      <variablelist>
272
273        <varlistentry>
274          <term>
275              <command>server</command>
276              <arg choice="req">servername</arg>
277              <arg choice="opt">port</arg>
278            </term>
279          <listitem>
280            <para>
281              Sends all dynamic update requests to the name server
282              <parameter>servername</parameter>.
283              When no server statement is provided,
284              <command>nsupdate</command>
285              will send updates to the master server of the correct zone.
286              The MNAME field of that zone's SOA record will identify the
287              master
288              server for that zone.
289              <parameter>port</parameter>
290              is the port number on
291              <parameter>servername</parameter>
292              where the dynamic update requests get sent.
293              If no port number is specified, the default DNS port number of
294              53 is
295              used.
296            </para>
297          </listitem>
298        </varlistentry>
299
300        <varlistentry>
301          <term>
302              <command>local</command>
303              <arg choice="req">address</arg>
304              <arg choice="opt">port</arg>
305            </term>
306          <listitem>
307            <para>
308              Sends all dynamic update requests using the local
309              <parameter>address</parameter>.
310
311              When no local statement is provided,
312              <command>nsupdate</command>
313              will send updates using an address and port chosen by the
314              system.
315              <parameter>port</parameter>
316              can additionally be used to make requests come from a specific
317              port.
318              If no port number is specified, the system will assign one.
319            </para>
320          </listitem>
321        </varlistentry>
322
323        <varlistentry>
324          <term>
325              <command>zone</command>
326              <arg choice="req">zonename</arg>
327            </term>
328          <listitem>
329            <para>
330              Specifies that all updates are to be made to the zone
331              <parameter>zonename</parameter>.
332              If no
333              <parameter>zone</parameter>
334              statement is provided,
335              <command>nsupdate</command>
336              will attempt determine the correct zone to update based on the
337              rest of the input.
338            </para>
339          </listitem>
340        </varlistentry>
341
342        <varlistentry>
343          <term>
344              <command>class</command>
345              <arg choice="req">classname</arg>
346            </term>
347          <listitem>
348            <para>
349              Specify the default class.
350              If no <parameter>class</parameter> is specified, the
351              default class is
352              <parameter>IN</parameter>.
353            </para>
354          </listitem>
355        </varlistentry>
356
357        <varlistentry>
358          <term>
359              <command>ttl</command>
360              <arg choice="req">seconds</arg>
361            </term>
362          <listitem>
363            <para>
364              Specify the default time to live for records to be added.
365	      The value <parameter>none</parameter> will clear the default
366	      ttl.
367            </para>
368          </listitem>
369        </varlistentry>
370
371        <varlistentry>
372          <term>
373              <command>key</command>
374              <arg choice="req">name</arg>
375              <arg choice="req">secret</arg>
376            </term>
377          <listitem>
378            <para>
379              Specifies that all updates are to be TSIG-signed using the
380              <parameter>keyname</parameter> <parameter>keysecret</parameter> pair.
381              The <command>key</command> command
382              overrides any key specified on the command line via
383              <option>-y</option> or <option>-k</option>.
384            </para>
385          </listitem>
386        </varlistentry>
387
388        <varlistentry>
389          <term>
390            <command>gsstsig</command>
391          </term>
392          <listitem>
393            <para>
394	      Use GSS-TSIG to sign the updated.  This is equivalent to
395	      specifying <option>-g</option> on the commandline.
396            </para>
397          </listitem>
398        </varlistentry>
399
400        <varlistentry>
401          <term>
402            <command>oldgsstsig</command>
403          </term>
404          <listitem>
405            <para>
406	      Use the Windows 2000 version of GSS-TSIG to sign the updated.
407	      This is equivalent to specifying <option>-o</option> on the
408	      commandline.
409            </para>
410          </listitem>
411        </varlistentry>
412
413        <varlistentry>
414          <term>
415            <command>realm</command>
416            <arg choice="req"><optional>realm_name</optional></arg>
417          </term>
418          <listitem>
419            <para>
420	      When using GSS-TSIG use <parameter>realm_name</parameter> rather
421	      than the default realm in <filename>krb5.conf</filename>.  If no
422	      realm is specified the saved realm is cleared.
423            </para>
424          </listitem>
425        </varlistentry>
426
427        <varlistentry>
428          <term>
429              <command><optional>prereq</optional> nxdomain</command>
430              <arg choice="req">domain-name</arg>
431            </term>
432          <listitem>
433            <para>
434              Requires that no resource record of any type exists with name
435              <parameter>domain-name</parameter>.
436            </para>
437          </listitem>
438        </varlistentry>
439
440
441        <varlistentry>
442          <term>
443              <command><optional>prereq</optional> yxdomain</command>
444              <arg choice="req">domain-name</arg>
445            </term>
446          <listitem>
447            <para>
448              Requires that
449              <parameter>domain-name</parameter>
450              exists (has as at least one resource record, of any type).
451            </para>
452          </listitem>
453        </varlistentry>
454
455        <varlistentry>
456          <term>
457              <command><optional>prereq</optional> nxrrset</command>
458              <arg choice="req">domain-name</arg>
459              <arg choice="opt">class</arg>
460              <arg choice="req">type</arg>
461            </term>
462          <listitem>
463            <para>
464              Requires that no resource record exists of the specified
465              <parameter>type</parameter>,
466              <parameter>class</parameter>
467              and
468              <parameter>domain-name</parameter>.
469              If
470              <parameter>class</parameter>
471              is omitted, IN (internet) is assumed.
472            </para>
473          </listitem>
474        </varlistentry>
475
476
477        <varlistentry>
478          <term>
479              <command><optional>prereq</optional> yxrrset</command>
480              <arg choice="req">domain-name</arg>
481              <arg choice="opt">class</arg>
482              <arg choice="req">type</arg>
483            </term>
484          <listitem>
485            <para>
486              This requires that a resource record of the specified
487              <parameter>type</parameter>,
488              <parameter>class</parameter>
489              and
490              <parameter>domain-name</parameter>
491              must exist.
492              If
493              <parameter>class</parameter>
494              is omitted, IN (internet) is assumed.
495            </para>
496          </listitem>
497        </varlistentry>
498
499        <varlistentry>
500          <term>
501              <command><optional>prereq</optional> yxrrset</command>
502              <arg choice="req">domain-name</arg>
503              <arg choice="opt">class</arg>
504              <arg choice="req">type</arg>
505              <arg choice="req" rep="repeat">data</arg>
506            </term>
507          <listitem>
508            <para>
509              The
510              <parameter>data</parameter>
511              from each set of prerequisites of this form
512              sharing a common
513              <parameter>type</parameter>,
514              <parameter>class</parameter>,
515              and
516              <parameter>domain-name</parameter>
517              are combined to form a set of RRs.  This set of RRs must
518              exactly match the set of RRs existing in the zone at the
519              given
520              <parameter>type</parameter>,
521              <parameter>class</parameter>,
522              and
523              <parameter>domain-name</parameter>.
524              The
525              <parameter>data</parameter>
526              are written in the standard text representation of the resource
527              record's
528              RDATA.
529            </para>
530          </listitem>
531        </varlistentry>
532
533        <varlistentry>
534          <term>
535              <command><optional>update</optional> del<optional>ete</optional></command>
536              <arg choice="req">domain-name</arg>
537              <arg choice="opt">ttl</arg>
538              <arg choice="opt">class</arg>
539              <arg choice="opt">type <arg choice="opt" rep="repeat">data</arg></arg>
540            </term>
541          <listitem>
542            <para>
543              Deletes any resource records named
544              <parameter>domain-name</parameter>.
545              If
546              <parameter>type</parameter>
547              and
548              <parameter>data</parameter>
549              is provided, only matching resource records will be removed.
550              The internet class is assumed if
551              <parameter>class</parameter>
552              is not supplied.  The
553              <parameter>ttl</parameter>
554              is ignored, and is only allowed for compatibility.
555            </para>
556          </listitem>
557        </varlistentry>
558
559        <varlistentry>
560          <term>
561              <command><optional>update</optional> add</command>
562              <arg choice="req">domain-name</arg>
563              <arg choice="req">ttl</arg>
564              <arg choice="opt">class</arg>
565              <arg choice="req">type</arg>
566              <arg choice="req" rep="repeat">data</arg>
567            </term>
568          <listitem>
569            <para>
570              Adds a new resource record with the specified
571              <parameter>ttl</parameter>,
572              <parameter>class</parameter>
573              and
574              <parameter>data</parameter>.
575            </para>
576          </listitem>
577        </varlistentry>
578
579        <varlistentry>
580          <term>
581              <command>show</command>
582            </term>
583          <listitem>
584            <para>
585              Displays the current message, containing all of the
586              prerequisites and
587              updates specified since the last send.
588            </para>
589          </listitem>
590        </varlistentry>
591
592        <varlistentry>
593          <term>
594              <command>send</command>
595            </term>
596          <listitem>
597            <para>
598              Sends the current message.  This is equivalent to entering a
599              blank line.
600            </para>
601          </listitem>
602        </varlistentry>
603
604        <varlistentry>
605          <term>
606              <command>answer</command>
607            </term>
608          <listitem>
609            <para>
610              Displays the answer.
611            </para>
612          </listitem>
613        </varlistentry>
614
615        <varlistentry>
616          <term>
617              <command>debug</command>
618            </term>
619          <listitem>
620            <para>
621              Turn on debugging.
622            </para>
623          </listitem>
624        </varlistentry>
625
626      </variablelist>
627    </para>
628
629    <para>
630      Lines beginning with a semicolon are comments and are ignored.
631    </para>
632
633  </refsect1>
634
635  <refsect1>
636    <title>EXAMPLES</title>
637    <para>
638      The examples below show how
639      <command>nsupdate</command>
640      could be used to insert and delete resource records from the
641      <type>example.com</type>
642      zone.
643      Notice that the input in each example contains a trailing blank line so
644      that
645      a group of commands are sent as one dynamic update request to the
646      master name server for
647      <type>example.com</type>.
648
649      <programlisting>
650# nsupdate
651&gt; update delete oldhost.example.com A
652&gt; update add newhost.example.com 86400 A 172.16.1.1
653&gt; send
654</programlisting>
655    </para>
656    <para>
657      Any A records for
658      <type>oldhost.example.com</type>
659      are deleted.
660      And an A record for
661      <type>newhost.example.com</type>
662      with IP address 172.16.1.1 is added.
663      The newly-added record has a 1 day TTL (86400 seconds).
664      <programlisting>
665# nsupdate
666&gt; prereq nxdomain nickname.example.com
667&gt; update add nickname.example.com 86400 CNAME somehost.example.com
668&gt; send
669</programlisting>
670    </para>
671    <para>
672      The prerequisite condition gets the name server to check that there
673      are no resource records of any type for
674      <type>nickname.example.com</type>.
675
676      If there are, the update request fails.
677      If this name does not exist, a CNAME for it is added.
678      This ensures that when the CNAME is added, it cannot conflict with the
679      long-standing rule in RFC 1034 that a name must not exist as any other
680      record type if it exists as a CNAME.
681      (The rule has been updated for DNSSEC in RFC 2535 to allow CNAMEs to have
682      RRSIG, DNSKEY and NSEC records.)
683    </para>
684  </refsect1>
685
686  <refsect1>
687    <title>FILES</title>
688
689    <variablelist>
690      <varlistentry>
691        <term><constant>/etc/resolv.conf</constant></term>
692        <listitem>
693          <para>
694            used to identify default name server
695          </para>
696        </listitem>
697      </varlistentry>
698
699      <varlistentry>
700        <term><constant>/var/run/named/session.key</constant></term>
701        <listitem>
702          <para>
703            sets the default TSIG key for use in local-only mode
704          </para>
705        </listitem>
706      </varlistentry>
707
708      <varlistentry>
709        <term><constant>K{name}.+157.+{random}.key</constant></term>
710        <listitem>
711          <para>
712            base-64 encoding of HMAC-MD5 key created by
713            <citerefentry>
714              <refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>
715            </citerefentry>.
716          </para>
717        </listitem>
718      </varlistentry>
719
720      <varlistentry>
721        <term><constant>K{name}.+157.+{random}.private</constant></term>
722        <listitem>
723          <para>
724            base-64 encoding of HMAC-MD5 key created by
725            <citerefentry>
726              <refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>
727            </citerefentry>.
728          </para>
729        </listitem>
730      </varlistentry>
731
732    </variablelist>
733  </refsect1>
734
735  <refsect1>
736    <title>SEE ALSO</title>
737    <para>
738      <citetitle>RFC 2136</citetitle>,
739      <citetitle>RFC 3007</citetitle>,
740      <citetitle>RFC 2104</citetitle>,
741      <citetitle>RFC 2845</citetitle>,
742      <citetitle>RFC 1034</citetitle>,
743      <citetitle>RFC 2535</citetitle>,
744      <citetitle>RFC 2931</citetitle>,
745      <citerefentry>
746        <refentrytitle>named</refentrytitle><manvolnum>8</manvolnum>
747      </citerefentry>,
748      <citerefentry>
749        <refentrytitle>ddns-confgen</refentrytitle><manvolnum>8</manvolnum>
750      </citerefentry>,
751      <citerefentry>
752        <refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>
753      </citerefentry>.
754    </para>
755  </refsect1>
756
757  <refsect1>
758    <title>BUGS</title>
759    <para>
760      The TSIG key is redundantly stored in two separate files.
761      This is a consequence of nsupdate using the DST library
762      for its cryptographic operations, and may change in future
763      releases.
764    </para>
765  </refsect1>
766</refentry><!--
767 - Local variables:
768 - mode: sgml
769 - End:
770-->
771