xref: /netbsd-src/external/bsd/nsd/dist/doc/README (revision 4724848cf0da353df257f730694b7882798e5daf)
11.0 Introduction
21.1 ... Basic theory of operation
31.2 ... Quick build & install
42.0 Building nsd
52.1 ... Unpacking the source
62.2 ... Configuring NSD
72.3 ... Building
82.4 ... Installing
93.0 Running NSD
103.1 ... Logging
113.2 ... AXFR access
123.3 ... Using TSIG
133.4 ... Zone expiry of secondary zones
143.5 ... Diagnosing NSD log entries
153.6 ... Interfaces
163.7 ... Tuning
173.8 ... Zone verification
184.0 Support and Feedback
194.1 ... Your Support
20
21
221.0 Introduction
23
24This is NSD Name Server Daemon (NSD) version 4.6.0.
25
26The NLnet Labs Name Server Daemon (NSD) is an authoritative RFC compliant
27DNS nameserver. It was first conceived to allow for more genetic
28diversity for DNS server implementations used by the root-server system
29and it has been developed for operations in environments where speed,
30reliability, stability, and security are of high importance. NSD is
31currently used on root servers such as k.root-servers.net and is also in
32use by several top-level domain registries.
33
34NSD is a complete implementation of an authoritative DNS name server.
35For further information about what NSD is and what NSD is not please
36consult the REQUIREMENTS document which is a part of this distribution.
37
38If you are a BIND user (the named daemon) consult NSD_FOR_BIND_USERS.
39
40The source code is available for download from:
41
42         http://www.nlnetlabs.nl/downloads
43
44
451.1 Basic Theory of Operation
46
47NSD consists of two programs: the zone compiler 'zonec' and the name
48server 'nsd' itself. The name server works with an intermediate
49database prepared by the zone compiler from standard zone files.
50
51For NSD operation this means that zones have to be compiled by zonec
52before NSD can use them.
53
54All this can be controlled via rc.d (SIGTERM, SIGHUP) or nsd-control,
55and uses a simple configuration file 'nsd.conf'.
56
57
581.2 Quick build and install
59
60Step 1: Unpack the source with gtar -xzvf nsd-4.6.0.tar.gz
61
62Step 2: Create user nsd or any other unprivileged user of your
63        choice. In case of later make sure to use
64        --with-user=<username> while running configure.
65	You can also set "username: <name>" in the nsd.conf file later.
66	Install openssl and libevent.
67
68Step 3: ./configure
69
70Step 4: make all	(or simply 'make').
71
72Step 5: make install
73
74Step 6: Create and edit /etc/nsd/nsd.conf file possibly from
75        nsd.conf.sample template that comes with the distribution.
76	(installed by default at /etc/nsd/nsd.conf.sample)
77	Here you need to configure the zones you want to serve.
78	TSIG keys used for secure zone transfers must be included.
79	Also server parameters can be set, see nsd.conf(5) man page.
80
81	If you have a NSD 2 nsd.zones config file take a look at the
82	python script contrib/nsd.zones2nsd.conf, it will convert
83	zone and TSIG key settings for you.
84
85Step 7: Copy necessary master zone files into appropriate directories
86        under /etc/nsd/primary & /etc/nsd/secondary.
87
88Step 8: Run nsd-control start
89
90Step 9: Test the NSD with dig, drill or host.
91
92Step 10: If you're happy add a rc.d script to start into your OS boot up
93	 sequence. The format of the rc.d startup script depends on
94	 the platform.  Also stop it in the shutdown sequence.
95	 You can use SIGTERM to stop, or nsd-control stop.
96
97Step 11: If desired add 'nsd-control write' to your superuser crontab to
98         update the zone files with the content transferred from master
99	 servers periodically, such as once per day.
100
101         Got any problems or questions with the steps above? Read the
102         rest of this file.
103
104
105
1062.0 Building NSD
107
108
1092.1 Unpacking the source
110
111Use your favorite combination of tar and gnu zip to unpack the source,
112for example
113
114$ gtar -xzvf nsd-4.6.0.tar.gz
115
116will unpack the source into the ./nsd-4.6.0 directory...
117
118
1192.2 Configuring NSD
120
121NSD can be configured using GNU autoconf's configure script. In
122addition to standard configure options, one may use the following:
123
124  CC=compiler
125
126        Specify the C compiler.  The default is gcc or cc.  The
127        compiler must support ANSI C89.
128
129  CPPFLAGS=flags
130
131        Specify the C preprocessor flags.  Such as -I<includedir>.
132
133  CFLAGS=flags
134
135        Specify the C compiler flags.  These include code generation,
136        optimization, warning, and debugging flags.  These flags are
137        also passed to the linker.
138
139        The default for gcc is "-g -O2".
140
141  LD=linker
142
143        Specify the linker (defaults to the C compiler).
144
145  LDFLAGS=flags
146
147        Specify linker flags.
148
149  LIBS=libs
150
151        Specify additional libraries to link with.
152
153  --enable-root-server
154
155        Configure NSD as a root server. Unless this option is
156        specified, NSD will refuse to serve the ``.'' zone as a
157        misconfiguration safeguard.
158
159  --disable-ipv6
160
161        Disables IPv6 support in NSD.
162
163  --enable-checking
164
165        Enable some internal development checks.  Useful if you want
166        to modify NSD.  This option enables the standard C "assert" macro
167	and compiler warnings.
168
169	This will instruct NSD to be stricter when validating its input.
170	This could lead to a reduced service level.
171
172  --enable-bind8-stats
173
174        Enables BIND8-like statistics.
175
176  --enable-ratelimit
177
178	Enables ratelimiting, based on query name, type and source.
179
180   --enable-draft-rrtypes
181
182	Enables draft RRtypes.
183
184  --with-configdir=dir
185
186        Specified, NSD configuration directory, default /etc/nsd
187
188  --with-nsd_conf_file=path
189
190	Pathname to the NSD configuration file, default /etc/nsd/nsd.conf
191
192  --with-pidfile=path
193
194        Pathname to the NSD pidfile, default is platform specific,
195        mostly /var/run/nsd.pid
196
197  --with-dbfile=path
198
199        Pathname to the NSD database, default is /etc/nsd/nsd.db
200
201  --with-zonesdir=dir
202
203        NSD default location for master zone files, default /etc/nsd/
204
205  --with-user=username
206
207        User name or ID to answer the queries with, default is nsd
208
209  --with-facility=facility
210
211        Specify the syslog facility to use.  The default is
212        LOG_DAEMON.  See the syslog(3) manual page for the available
213        facilities.
214
215  --with-libevent=path
216
217  	Specity the location of the libevent library (or libev).
218	--with-libevent=no uses a builtin portable implementation (select()).
219
220  --with-ssl=path
221
222        Specify the location of the OpenSSL libraries.  OpenSSL 0.9.7
223        or higher is required for TSIG support.
224
225  --with-start_priority=number
226
227	Startup priority for NSD.
228
229  --with-kill_priority=number
230
231	Shutdown priority for NSD.
232
233  --with-tcp-timeout=number
234
235	Set the default TCP timeout (in seconds). Default 120 seconds.
236
237  --disable-nsec3
238
239  	Disable NSEC3 support. With NSEC3 support enabled, very large zones,
240	also non-nsec3 zones, use about 20% more memory.
241
242  --disable-minimal-responses
243
244  	Disable minimal responses. If disabled, responses are more likely
245	to get truncated, resulting in TCP fallback.  When enabled (by default)
246	NSD will leave out RRsets to make responses fit inside one datagram,
247	but for shorter responses the full normal response is carried.
248
249  --disable-largefile
250
251	Disable large file support (64 bit file lengths). Makes off_t
252	a 32bit length during compilation.
253
254
2552.3 Building
256
257Use ``make'' to create NSD and support tools.  If you get errors, try to
258use ``gmake'' (gnu version of make), especially on old systems. If so,
259do a `gmake realclean` first, to remove stuff that the make call messed up.
260
261
2622.4 Installing
263
264Become a superuser (if necessary) and type ``make install''
265
266This step should install four binaries
267
268nsd               - the daemon itself
269nsd-control-setup - a shell script that creates keys for nsd-control.
270nsd-control	      - program that connects over SSL to nsd and gives commands.
271nsd-checkconf	  - simple C program to check nsd.conf before use.
272
273Plus the manual pages and a sample configuration file.
274
275
2763.0 Running NSD
277
278Before running NSD you need to create a configuration file for it.
279The config file contains server settings, secret keys and zone settings.
280
281The server settings start with a line with the keyword 'server:'.
282In the server settings set 'database: <file>' with the filename of the name
283database that NSD will use. Set 'chroot: <dir>' to run nsd in a chroot-jail.
284Make sure the zone files, database file, xfrdfile, difffile and pidfile
285can be accessed from the chroot-jail.  Set 'username: <user>' to an
286unprivileged user, for security.
287
288For example:
289	# This is a sample configuration
290	server:
291		database: "/etc/nsd/nsd.db"
292		pidfile: "/etc/nsd/nsd.pid"
293		chroot: "/etc/nsd/"
294		username: nsd
295
296After the global server settings to need to make entries for the
297zones that you wish to serve. For each zone you need to list the zone
298name, the file name with the zone contents, and access control lists.
299
300	zone:
301		name:	"example.com"
302		zonefile: "example.com.zone"
303
304The zonefile needs to be filled with the correct zone information
305for master zones. For secondary zones an empty file will suffice,
306a zone transfer will be initiated to obtain the slave zone contents.
307
308Access control lists are needed for zone transfer and notifications.
309
310For a slave zone list the masters, by IP address. Below is an example
311of a slave zone with two master servers. If a master only supports AXFR
312transfers and not IXFR transfers (like NSD), specify the master as
313"request-xfr: AXFR <ip_address> <key>". By default, all zone transfer requests
314are made over TCP. If you want the IXFR request be transmitted over UDP, use
315"request-xfr: UDP <ip address> <key>".
316
317	zone:
318		name: "example.com"
319		zonefile: "example.com.zone"
320		allow-notify: 168.192.185.33 NOKEY
321		request-xfr: 168.192.185.33 NOKEY
322		allow-notify: 168.192.199.2 NOKEY
323		request-xfr: 168.192.199.2 NOKEY
324
325By default, a slave will fallback to AXFR requests if the master told us it does
326not support IXFR. You can configure the slave not to do AXFR fallback with:
327
328		allow-axfr-fallback: "no"
329
330For a master zone, list the slave servers, by IP address or subnet.
331Below is an example of a master zone with two slave servers.
332
333	zone:
334		name: "example.com"
335		zonefile: "example.com.zone"
336		notify: 168.192.133.75 NOKEY
337		provide-xfr: 168.192.133.75 NOKEY
338		notify: 168.192.5.44 NOKEY
339		provide-xfr: 168.192.5.44 NOKEY
340
341You also can set the outgoing interface for notifies and zone transfer requests
342to satisfy access control lists at the other end:
343
344		outgoing-interface: 168.192.5.69
345
346By default, NSD will retry a notify up to 5 times. You can override that
347value with:
348
349		notify-retry: 5
350
351Zone transfers can be secured with TSIG keys, replace NOKEY with
352the name of the tsig key to use. See section 3.3.
353
354Since NSD is written to be run on the root name servers, the config file
355can to contain something like:
356
357	zone:
358		name: "."
359		zonefile: "root.zone"
360		provide-xfr: 0.0.0.0/0 NOKEY # allow axfr for everyone.
361		provide-xfr: ::0/0 NOKEY
362
363You should only do that if you're intending to run a root server, NSD
364is not suited for running a . cache. Therefore if you choose to serve
365the .  zone you have to make sure that the complete root zone is
366timely and fully updated.
367
368To prevent misconfiguration, NSD configure has the --enable-root-server
369switch, that is by default disabled.
370
371In the config file, you can use patterns.  A pattern can have the
372same configuration statements that a zone can have.  And then you can
373include-pattern: <name-of-pattern> in a zone (or in another pattern)
374to apply those settings.  This can be used to organise the settings.
375
376The nsd-control tool is also controlled from the nsd.conf config file.
377It uses SSL encrypted transport to 127.0.0.1, and if you want to use it
378you have to setup the keys and also edit the config file.  You can leave
379the remote-control disabled (the secure default), or opt to turn it on:
380
381	# generate keys
382	nsd-control-setup
383
384	# edit nsd.conf to add this
385	remote-control:
386		control-enable: yes
387
388By default nsd-control is limited to localhost, as well as encrypted, but
389some people may want to remotely administer their nameserver.  What you
390then do is setup nsd-control to listen to the public IP address, with
391control-interface: <IP> after the control-enable statement.  Furthermore,
392you copy the key files /etc/nsd/nsd_server.pem /etc/nsd/nsd_control.*
393to a remote host on the internet; on that host you can run nsd-control
394with -c <special config file> which references same IP address
395control-interface and references the copies of the key files with
396server-cert-file, control-key-file and control-cert-file config lines
397after the control-enable statement.  The nsd-server authenticates the
398nsd-control client, and also the nsd-control client authenticates the
399nsd-server.
400
401When you are done with the configuration file, check the syntax using
402
403	nsd-checkconf <name of configfile>
404
405The zone files are read by the daemon, which builds 'nsd.db' with their
406contents.  You can start the daemon with
407
408	nsd
409	or with "nsd-control start" (which execs nsd again).
410	or with nsd -c <name of configfile>
411
412To check if the daemon is running look with ps, top, or if you enabled
413nsd-control,
414
415	nsd-control status
416
417To reload changed zone files after you edited them, without stopping
418the daemon, use this to check if files are modified:
419
420	kill -HUP `cat <name of nsd pidfile>`
421
422If you enabled nsd-control, you can reread with
423
424	nsd-control reload
425
426With nsd-control you can also reread the config file (new zones, ..)
427
428	nsd-control reconfig
429
430To restart the daemon
431
432	/etc/rc.d/nsd restart  # or your system(d) equivalent
433
434To shut it down (for example on the system shutdown) do
435
436	kill -TERM <pid of nsd>
437	or nsd-control stop
438
439NSD will automatically keep track of secondary zones and update them
440when needed. When primary zones are updated and reloaded notifications
441are sent to slave servers.
442
443The zone transfers are applied to nsd.db by the daemon.  To write changed
444contents of the zone files for slave zones to disk in the text-based zone
445file format, issue nsd-control write.
446
447NSD will send notifications to slave zones if a master zone is updated.
448NSD will check for updates at master servers periodically and transfer
449the updated zone by AXFR/IXFR and reload the new zone contents. If
450you wish exert manual control use nsd-control notify, transfer and
451force_transfer commands.  The transfer command will check for new versions
452of the secondary zones hosted by this NSD. The notify command will send
453notifications to the slave servers configured in 'notify:' statements.
454
455
4563.1 Logging
457
458NSD doesn't do any logging. We believe that logging is a separate task
459and has to be done independently from the core operation.
460
461This consciously is not part of nsd itself in order to keep nsd
462focused and minimize its complexity. It is better to leave logging and
463tracing to separate dedicated tools. dnsstat can also easily be
464configured and/or modified to suit local statistics requirements
465without any danger of affecting the name server itself. We have run
466dnsstat on the same machine as nsd, we would recommend using a
467multiprocessor if performance is an issue. Of course it can also run
468on a separate machine that has MAC layer access to the network of the
469server.
470
471The nsd-control tool can output some statistics, with nsd-control stats
472and nsd-control stats_noreset.  In contrib/nsd_munin_ there is a munin
473grapher plugin that uses it.  The output of nsd-control stats is easy
474to read (text only) with scripts.  The output values are documented on
475the nsd-control man page.
476
477The CAIDA dnsstat tool referenced is recommended to nsd operators as a
478means of keeping statistics and check on abnormal query loads.
479
480    http://www.caida.org/tools/utilities/dnsstat/dnsstat-3.5.1a.tar.gz
481
482Another tool is the dnstop, that displays DNS statistics on your network.
483
484    http://dns.measurement-factory.com/tools/dnstop/src/dnstop-20060517.tar.gz
485
486A sample invocation of dnsstat:
487
488/usr/local/Coral/bin/crl_dnsstat -D -Ci=60 -Cd=240 -C'filter dst 10.1.1.3'  -h -u if:fxp1
489
490A sample output of a slightly modified version:
491
492# dnsstat output version: 0.2 "dfk"
493
494# begin trace interval at 1025267664.859043, duration 15.000000
495# DNS messages: 74973 (4998.200000/s); DNS queries: 151983 (10132.200000/s)
496# print threshold: 30 messages/sec
497
498#src              op type  class queries    msgs      rd notes
499 208.18.162.10     - -     -         533     533       0
500 "                 0 MX    IN          6
501 "                 0 A     IN        264
502 "                 0 ANY   IN        263
503 209.11.18.248     - -     -         661     661       0
504 "                 0 A     IN        655
505 "                 0 MX    IN          6
506 210.117.65.137    - -     -         745     745       0
507 "                 0 A     IN        745
508 216.54.221.131    - -     -         477     477       0
509 "                 0 A     IN        477
510 193.97.205.80     - -     -         681     681       0
511 "                 0 A     IN          3
512 "                 0 ANY   IN        678
513 168.30.240.11     - -     -         685     685       0
514 "                 0 A     IN        405
515 "                 0 MX    IN        280
516 210.94.6.67       - -     -         742     742       0
517 "                 0 A     IN        742
518 63.66.68.237      - -     -        1375    1375       0
519 "                 0 A     IN       1375
520 168.30.240.12     - -     -         493     493       0
521 "                 0 A     IN        493
522 139.142.205.225   - -     -        5579    5579       0
523 "                 0 A     IN       3006
524 "                 0 MX    IN       2573
525 210.117.65.2      - -     -         700     700       0
526 "                 0 A     IN        700
527# end trace interval
528
529
5303.2 AXFR access
531
532The access list for AXFR should be set with provide-xfr:
533in the nsd config file. This is per zone. See nsd.conf(5).
534For example to grant zone 'example.com' AXFR right to localhost for
535IPv4 and IPv6, use the below config options.
536
537zone:
538	name: "example.com"
539	provide-xfr: 127.0.0.1 NOKEY
540	provide-xfr: ::1 NOKEY
541
542You can use dig @localhost example.com axfr to test this.
543
544
5453.3 Using TSIG
546
547NSD supports TSIG for any query to the server, for zone transfer
548and for notify sending and receiving.
549
550TSIG keys are based on shared secrets. These must be configured
551in the config file. To keep the secret in a separate file use
552include: "filename" to include that file.
553
554An example tsig key named sec1_key.
555
556	key:
557		name: "sec1_key"
558		algorithm: hmac-md5
559		secret: "6KM6qiKfwfEpamEq72HQdA=="
560
561This key can then be used for any query to the NSD server. NSD
562will check if the signature is valid, and if so, return a signed
563answer. Unsigned queries will be given unsigned replies.
564
565The key can be used to restrict the access control lists, for
566example to only allow zone transfer with the key, by listing
567the key name on the access control line.
568
569	# provides AXFR to the subnet when TSIG is used.
570	provide-xfr: 10.11.12.0/24 sec1_key
571	# allow only notifications that are signed
572	allow-notify: 192.168.0.0/16 sec1_key
573
574If the TSIG key name is used in notify or request-xfr lines,
575the key is used to sign the request/notification messages.
576
577
5783.4 Zone expiry of secondary zones
579
580NSD will keep track of the status of secondary zones, according to the
581timing values in the SOA record for the zone.  When the refresh time of a
582zone is reached, the serial number is checked and a zone transfer is
583started if the zone has changed.  Each master server is tried in turn.
584
585Master zones cannot expire.  They are always served.  Zones are master
586zones if they have no 'request-xfr:' statements in the config file.
587
588After the expire timeout (from the SOA record at the zone apex) is reached,
589the zone becomes expired. NSD will return SERVFAIL for expired zones,
590and will attempt to perform a zone transfer from any of the masters.
591After a zone transfer succeeds, or if the master indicates that the SOA
592serial number is still the same, the zone will be OK again.
593
594In contrast with e.g. BIND, the inception time for a slave zone is stored
595on disk (in the xfrdfile: "xfrd.state"), together with timeouts.  If a
596slave zone acquisition time is recent enough, this means that NSD can start
597serving a zone immediately on loading, without querying the master server.
598
599If your slave zone has expired, and no masters can be reached, but you
600still want NSD to serve the zone.  (i.e. ''My network is in shambles, but
601serve the zone dangit!'').  You can delete the file 'xfrd.state',
602but leave the zonefile for the zone intact.  Make sure to stop nsd before
603you delete the file, as NSD writes it on exit.  Upon loading NSD will treat
604the zonefile that you as operator have provided as recent and will serve
605the zone.  Even though NSD will start to serve the zone immediately,
606the zone will expire after the timeout is reached again.  NSD will also
607attempt to confirm that you have provided the correct data by polling
608the masters.  So when the master servers come back up, it will transfer
609the updated zone within <retry timeout from SOA> seconds.
610
611In general it is possible to provide zone files for both master and
612slave zones manually (say from email or rsync). Reload with SIGHUP
613or nsd-control reload to read the new zonefile contents into the name
614database.  When this is done the new zone will be served. For master
615zones, NSD will issue notifications to all configured 'notify:' targets.
616For slave zones the above happens; NSD attempts to validate the zone
617from the master (checking its SOA serial number).
618
619
6203.5 Diagnosing NSD log entries
621
622NSD will print log messages to the system log (or 'logfile:' configuration
623entry). Some of these messages are discussed below. These messages can
624get extra support if errors happen.
625
626- "Reload process <pid> failed with status <s>, continuing with old database"
627
628This log message indicates the reload process of NSD has failed for
629some reason.  The reason can be anything from a missing database file
630to internal errors.  If this happens often, please let us know, this
631error message can be caught in the code, and appropriate action could
632be taken.  We are as of yet not sure what action is appropriate, if any.
633
634- "snipping off trailing partial part of <ixfr.db>"
635
636Please let us know if, and how often, this happens.
637
638What happens is the file ixfr.db contains only part of expected data.
639The corruption is removed by snipping off the trailing part.
640
641- "memory recyclebin holds <num> bytes"
642
643This is printed for every reload. NSD allocates and deallocates memory
644to service IXFR updates. The recyclebin holds deallocated memory ready
645for future use. If the number grows too large, a restart resets it.
646
647- "xfrd: max number of tcp connections (32) reached."
648
649This line is printed when more than 32 zones need a zone transfer at the
650same time.  The value is a compile constant (xfrd-tcp.h), but if this
651happens often for you, we could make this a config option.  NSD will reuse
652existing TCP connections to the same master (determined by IP address)
653to transfer up to 64k zones from that master.  Thus this error should
654only happen with more than 32 masters or more than 64*32=2M zones that
655need to be updated at the same time.
656
657If this happens, more zones have to wait until a zone transfer completes
658(or is aborted) before they can have a zone transfer too. This waiting
659list has no size limit.
660
661- "error: <zone> NSEC3PARAM entry <num> has unknown hash algo <number>"
662
663This error means that the zone has NSEC3 chain(s) with hash algorithms
664that are not supported by this version of NSD, and thus cannot be served
665by NSD.  If there are also no NSECs or NSEC3 chain(s) with known hash
666algorithms, NSD will not be able to serve DNSSEC authenticated denials
667for the zone.
668
669
6703.6 Interfaces
671
672NSD will by default bind itself to the system default interface and
673service ip4 and if available also ip6. It is possible to service only ip4
674or ip6 using the -4, -6 commandline options, or the ip4-only and ip6-only
675config file options.
676
677The commandline option -a and config file option ip-address can be given
678to bind to specific interfaces.  Multiple interfaces can be specified.
679This is useful for two reasons:
680	o The specific interface bound will result in the OS bypassing
681	  routing tables for the interface selection.  This results in
682	  a small performance gain.  It is not the performance gain that
683	  is the problem, sometimes the routing tables can give the
684	  wrong answer, see the next point.
685	o The answer will be routed via the interface the query came from.
686	  This makes sure that the return address on the DNS replies is the
687	  same as the query was sent to.  Many resolvers require the source
688	  address of the replies to be correct.  The ip-address: option is
689	  easier than configuring the OS routing table to return the DNS
690	  replies via the correct interface.
691The above means that even for systems with multiple interfaces where you
692intend to provide DNS service to all interfaces, it is prudent to specify
693all the interfaces as ip-address config file options.
694
695With the config file option ip-transparent you can allow NSD to bind to
696non local addresses.
697
698
6993.7 Tuning
700
701NSD is performant by design and most users will have little need for tuning
702it. For setups that do require every ounce of performance, NSD offers a number
703of configuration options.
704
705
706cpu-affinity, server-<N>-cpu-affinity and xfrd-cpu-affinity
707
708Modern computer systems have many cores available. By default the operating
709system's scheduling-algorithm determines which core a given task is allocated
710to. Processors build up state, like keeping frequently accessed data in cache
711memory, for the task (process/thread) that it is currently running. Whenever,
712a task switches cores, performance is degraded because the core it switched
713to has yet to build up said state. The cpu-affinity configuration options can
714be used to bind NSD to one or more cores.
715
716cpu-affinity can be used to designate a set of cores onto which NSD processes
717are scheduled. server-<N>-cpu-affinity and xfrd-cpu-affinity can be used to
718designate a specific core to each individual process. This improves L1/L2
719cache hits and reduces pipeline stalls/flushes.
720
721For example, a name server configured to fork two NSD servers that must run on
722dedicated cores 0 and 2, while the transfer daemon (xfrd) must run on core 1,
723the configuration becomes.
724
725	server:
726		server-count: 2
727		cpu-affinity: 0 1 2
728		server-1-cpu-affinity: 0
729		server-2-cpu-affinity: 2
730		xfrd-cpu-affinity: 1
731
732
733ip-address: x.x.x.x  servers=<N>
734
735ip-address options can be configured per (set of) server(s). Sockets that are
736configured for a specific server are closed by other servers on startup. This
737improves select/poll performance and avoids waking up multiple servers when a
738packet comes in.
739
740
741ip-address: x.x.x.x  bindtodevice=yes
742ip-address: x.x.x.x  setfib=<N>
743
744The bindtodevice attribute on Linux and the setfib ip-address attribute on
745FreeBSD can be used to skip the interface selection process in the kernel. This
746improves performance, and ensures responses written to the socket are pushed
747out the same interface the corresponding query came in on when multiple
748interfaces are configured to listen on the same subnet.
749
750The aforementioned options all complement eachother and best performance is
751achieved by assigning a socket to a single server that runs on a dedicated
752core and line that up with a dedicated network interface. Network interface
753interrupts are best handled by a core not designated to any NSD servers.
754
755	server:
756		server-count: 3
757		cpu-affinity: 0 1 2 4
758		server-1-cpu-affinity: 0
759		server-2-cpu-affinity: 1
760		server-3-cpu-affinity: 2
761		xfrd-cpu-affinity: 4
762		ip-address: 1.2.3.11  servers=1 setfib=1 bindtodevice=yes
763		ip-address: 1.2.3.12  servers=2 setfib=2 bindtodevice=yes
764		ip-address: 1.2.3.13  servers=3 setfib=3 bindtodevice=yes
765
766The number of NSD servers to fork and which cores are best used depends
767entirely on the hardware. cpu-affinity options are supported on Linux and
768FreeBSD.
769
770
7713.8 Zone verification
772
773NSD can be configured to verify a zone is correct before publishing it. This
774feature is primarily aimed at fortifying DNSSEC in the DNS
775notify/transfer-chain, but can be used to carry out any checks desired.
776
777An external verifier can be configured per zone. When a zone with verification
778enabled is received or updated via an (incremental) zone transfer, it will be
779submitted to the verifier for evaluation. If the verifier deems the updated
780zone correct (indicated with exit status 0), the zone will be served. NSD will
781discard the update and continue to serve the zone before the update if the
782exit status of the verifier is non-zero.
783
784Verifier options can be configured globally in the "verify:" clause, or
785specifically for a zone/pattern in the respective "zone:" and "pattern:"
786clauses. The global values are applied by default.
787
788The zone can be provided to the verifier in two ways.
789
790	1. The complete zone can be fed to the standard input of the verifier.
791
792	   This modus operandi is enabled by default and can be configured
793	   with the "verifier-feed-zone:" option.
794
795	   Examples for verifiers that read from the standard input are:
796	   "ldns-verify-zone -V2" (-V2 to suppress copying to stdout) or
797	   "validns -" (don't forget the dash (-) to read the zone from stdin).
798
799	2. The zone can be served to the verifier.
800
801	   This is disabled by default and can be enabled by configuring ip-
802	   addresses, with the "ip-address:" option in the "verify:" clause,
803	   on which the zone to be assessed will be served. Addresses can
804	   contain a port number to override the default, which is 5347 by
805	   default, but can be overridden with the "port:" option in the
806	   verify clause.
807
808	   For example to validate the SOA of a zone example.com by querying,
809	   with a certain DS record as the trust anchor (in file example.com.ds),
810	   the "verifier:" option could have the following value:
811	   "drill -S -k example.com.ds @localhost -p 5347 example.com SOA"
812
813A verifier is informed about the domain name of the zone to be verified and
814the accessibility of the system submitting the zone via environment variables.
815
816	VERIFY_ZONE
817		Domain name of the zone to be verified.
818
819	VERIFY_ZONE_ON_STDIN
820		Contains "yes" if the zone is fed over standard input,
821		otherwise "no".
822
823	VERIFY_IP_ADDRESSES
824		Contains a list of <ip-address>@<port>s on which the zone
825		to be verified can be queried.
826
827	VERIFY_IPV6_ADDRESS and VERIFY_IPV6_PORT
828                Contains the first configured IPv6 address and port.
829
830	VERIFY_IPV4_ADDRESS and VERIFY_IPV4_PORT
831		Contains the first configured IPv4 address and port.
832
833	VERIFY_IP_ADDRESS and VERIFY_PORT
834		Contains the first configured address and port.
835		IPv6 is preferred over IPv4.
836
837For each zone one verifier will be run at the same time, but when multiple
838to-be-verified zones are received, multiple verifiers may be run
839simultaneously. The number of verifiers that may be run simultaneously is
840configured with the "verifier-count:" option in the "verify:" clause and
841defaults to 1.
842
843The time a verifier may take can be configured with the "verifier-timeout:"
844option in the "verify:" clause (to make the general default) or in the "zone:"
845or "pattern:" clause to set it for a specific zone. When the time the verifier
846takes exceeds the timeout value, the zone to be verified will be considered
847bad. By default the value is 0, which means that the verifier may take as long
848as it needs.
849
850To enable verification for all zones.
851
852	verify:
853		enable: yes
854		verifier: <command>
855
856To enable verification only for a specific zone.
857
858	verify:
859		enable: yes
860		verify-zones: no
861
862	zone:
863		name: example.com
864		verify-zone: yes
865
866
8674.0 Support and Feedback
868
869NLnet Labs is committed to support NSD and its other software products on
870a best effort basis, free of charge. This form of community support is
871offered through a mailing lists and the 'bugzilla' web interface.
872
873	http://www.nlnetlabs.nl/bugs/
874
875If for any reason NLnet Labs would stop community support of NSD such
876would be announced on our web pages at least two years in advance.
877
878The community mailing list nsd-users@nlnetlabs.nl can be used to discuss
879issues with other users of NSD. Subscribe here
880
881	http://lists.nlnetlabs.nl/mailman/listinfo/nsd-users
882
883NLnet Labs recognizes that in some corporate environments this commitment to
884community support is not sufficient and that support needs to be codified.
885We therefore offer paid support contracts that come in 3 varieties.
886
887More information about these support varieties can be found at
888	<url on support varieties on www.nlnetlabs.nl>
889
890Alternatively you can contact mailto:nsd-support@nlnetlabs.nl .
891
892Support goes two ways.  By acquiring one of the support contracts you
893also support NLnet Labs to continue to participate in the development
894of the Internet architecture. We do this through our participation in
895the (IETF) standards process and by developing and maintaining
896reference implementations of standards and tools to support operation
897and deployment of new and existing Internet technology.
898
899We are interested in our users and in the environment you use NSD. Please
900drop us a mail when you use NSD. Indicate in what kind of operation you
901deploy NSD and let us know what your positive and negative experiences are.
902http://www.nlnetlabs.nl/nsd  and  mailto:nsd-info@nlnetlabs.nl
903
904
9054.1 Your Support
906
907NLnet Labs offers all of its software products as open source, most are
908published under a BSD license. You can download them, not only from the
909NLnet Labs website but also through the various OS distributions for
910which NSD, ldns, and Unbound are packaged. We therefore have little idea
911who uses our software in production environments and have no direct ties
912with 'our customers'.
913
914Therefore, we ask you to contact us at users@NLnetLabs.nl and tell us
915whether you use one of our products in your production environment,
916what that environment looks like, and maybe even share some praise.
917We would like to refer to the fact that your organization is using our
918products. We will only do that if you explicitly allow us. In all other
919cases we will keep the information you share with us to ourselves.
920
921In addition to the moral support you can also support us
922financially. NLnet Labs is a recognized not-for-profit charity foundation
923that is chartered to develop open-source software and open-standards
924for the Internet. If you use our software to satisfaction please express
925that by giving us a donation. For small donations PayPal can be used. For
926larger and regular donations please contact us at users@NLnetLabs.nl. Also
927see http://www.nlnetlabs.nl/labs/contributors/.
928
929
930$Id: README,v 1.2 2022/09/24 17:38:17 christos Exp $
931