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