]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/unbound/doc/unbound-control.8
Upgrade Unbound to 1.6.5. More to follow.
[FreeBSD/FreeBSD.git] / contrib / unbound / doc / unbound-control.8
1 .TH "unbound-control" "8" "Jun 27, 2017" "NLnet Labs" "unbound 1.6.4"
2 .\"
3 .\" unbound-control.8 -- unbound remote control manual
4 .\"
5 .\" Copyright (c) 2008, NLnet Labs. All rights reserved.
6 .\"
7 .\" See LICENSE for the license.
8 .\"
9 .\"
10 .SH "NAME"
11 .B unbound\-control,
12 .B unbound\-control\-setup
13 \- Unbound remote server control utility.
14 .SH "SYNOPSIS"
15 .B unbound\-control
16 .RB [ \-hq ]
17 .RB [ \-c 
18 .IR cfgfile ]
19 .RB [ \-s 
20 .IR server ]
21 .IR command
22 .SH "DESCRIPTION"
23 .B Unbound\-control
24 performs remote administration on the \fIunbound\fR(8) DNS server.
25 It reads the configuration file, contacts the unbound server over SSL
26 sends the command and displays the result.
27 .P
28 The available options are:
29 .TP
30 .B \-h
31 Show the version and commandline option help.
32 .TP
33 .B \-c \fIcfgfile
34 The config file to read with settings.  If not given the default
35 config file /var/unbound/unbound.conf is used.
36 .TP
37 .B \-s \fIserver[@port]
38 IPv4 or IPv6 address of the server to contact.  If not given, the
39 address is read from the config file.
40 .TP
41 .B \-q
42 quiet, if the option is given it does not print anything if it works ok.
43 .SH "COMMANDS"
44 There are several commands that the server understands.
45 .TP
46 .B start
47 Start the server. Simply execs \fIunbound\fR(8).  The unbound executable 
48 is searched for in the \fBPATH\fR set in the environment.  It is started 
49 with the config file specified using \fI\-c\fR or the default config file.
50 .TP
51 .B stop
52 Stop the server. The server daemon exits.
53 .TP
54 .B reload
55 Reload the server. This flushes the cache and reads the config file fresh.
56 .TP
57 .B verbosity \fInumber
58 Change verbosity value for logging. Same values as \fBverbosity\fR keyword in
59 \fIunbound.conf\fR(5).  This new setting lasts until the server is issued
60 a reload (taken from config file again), or the next verbosity control command.
61 .TP
62 .B log_reopen
63 Reopen the logfile, close and open it.  Useful for logrotation to make the
64 daemon release the file it is logging to.  If you are using syslog it will
65 attempt to close and open the syslog (which may not work if chrooted).
66 .TP
67 .B stats
68 Print statistics. Resets the internal counters to zero, this can be 
69 controlled using the \fBstatistics\-cumulative\fR config statement. 
70 Statistics are printed with one [name]: [value] per line.
71 .TP
72 .B stats_noreset
73 Peek at statistics. Prints them like the \fBstats\fR command does, but does not
74 reset the internal counters to zero.
75 .TP
76 .B status
77 Display server status. Exit code 3 if not running (the connection to the 
78 port is refused), 1 on error, 0 if running.
79 .TP
80 .B local_zone \fIname\fR \fItype
81 Add new local zone with name and type. Like \fBlocal\-zone\fR config statement.
82 If the zone already exists, the type is changed to the given argument.
83 .TP
84 .B local_zone_remove \fIname
85 Remove the local zone with the given name.  Removes all local data inside
86 it.  If the zone does not exist, the command succeeds.
87 .TP
88 .B local_data \fIRR data...
89 Add new local data, the given resource record. Like \fBlocal\-data\fR
90 config statement, except for when no covering zone exists.  In that case
91 this remote control command creates a transparent zone with the same 
92 name as this record.  This command is not good at returning detailed syntax 
93 errors.
94 .TP
95 .B local_data_remove \fIname
96 Remove all RR data from local name.  If the name already has no items,
97 nothing happens.  Often results in NXDOMAIN for the name (in a static zone),
98 but if the name has become an empty nonterminal (there is still data in 
99 domain names below the removed name), NOERROR nodata answers are the 
100 result for that name.
101 .TP
102 .B local_zones
103 Add local zones read from stdin of unbound\-control. Input is read per line,
104 with name space type on a line. For bulk additions.
105 .TP
106 .B local_zones_remove
107 Remove local zones read from stdin of unbound\-control. Input is one name per
108 line. For bulk removals.
109 .TP
110 .B local_datas
111 Add local data RRs read from stdin of unbound\-control. Input is one RR per
112 line. For bulk additions.
113 .TP
114 .B local_datas_remove
115 Remove local data RRs read from stdin of unbound\-control. Input is one name per
116 line. For bulk removals.
117 .TP
118 .B dump_cache
119 The contents of the cache is printed in a text format to stdout. You can
120 redirect it to a file to store the cache in a file.
121 .TP
122 .B load_cache
123 The contents of the cache is loaded from stdin.  Uses the same format as
124 dump_cache uses.  Loading the cache with old, or wrong data can result
125 in old or wrong data returned to clients.  Loading data into the cache
126 in this way is supported in order to aid with debugging.
127 .TP
128 .B lookup \fIname
129 Print to stdout the name servers that would be used to look up the 
130 name specified.
131 .TP
132 .B flush \fIname
133 Remove the name from the cache. Removes the types
134 A, AAAA, NS, SOA, CNAME, DNAME, MX, PTR, SRV and NAPTR.
135 Because that is fast to do. Other record types can be removed using 
136 .B flush_type 
137 or 
138 .B flush_zone\fR.
139 .TP
140 .B flush_type \fIname\fR \fItype
141 Remove the name, type information from the cache.
142 .TP
143 .B flush_zone \fIname
144 Remove all information at or below the name from the cache. 
145 The rrsets and key entries are removed so that new lookups will be performed.
146 This needs to walk and inspect the entire cache, and is a slow operation.
147 .TP
148 .B flush_bogus
149 Remove all bogus data from the cache.
150 .TP
151 .B flush_negative
152 Remove all negative data from the cache.  This is nxdomain answers,
153 nodata answers and servfail answers.  Also removes bad key entries
154 (which could be due to failed lookups) from the dnssec key cache, and
155 iterator last-resort lookup failures from the rrset cache.
156 .TP
157 .B flush_stats
158 Reset statistics to zero.
159 .TP
160 .B flush_requestlist
161 Drop the queries that are worked on.  Stops working on the queries that the
162 server is working on now.  The cache is unaffected.  No reply is sent for
163 those queries, probably making those users request again later.
164 Useful to make the server restart working on queries with new settings,
165 such as a higher verbosity level.
166 .TP
167 .B dump_requestlist
168 Show what is worked on.  Prints all queries that the server is currently
169 working on.  Prints the time that users have been waiting.  For internal
170 requests, no time is printed.  And then prints out the module status.
171 This prints the queries from the first thread, and not queries that are
172 being serviced from other threads.
173 .TP
174 .B flush_infra \fIall|IP
175 If all then entire infra cache is emptied.  If a specific IP address, the
176 entry for that address is removed from the cache.  It contains EDNS, ping
177 and lameness data.
178 .TP
179 .B dump_infra
180 Show the contents of the infra cache.
181 .TP
182 .B set_option \fIopt: val
183 Set the option to the given value without a reload.  The cache is
184 therefore not flushed.  The option must end with a ':' and whitespace
185 must be between the option and the value.  Some values may not have an
186 effect if set this way, the new values are not written to the config file,
187 not all options are supported.  This is different from the set_option call
188 in libunbound, where all values work because unbound has not been initialized.
189 .IP
190 The values that work are: statistics\-interval, statistics\-cumulative,
191 do\-not\-query\-localhost, harden\-short\-bufsize, harden\-large\-queries,
192 harden\-glue, harden\-dnssec\-stripped, harden\-below\-nxdomain,
193 harden\-referral\-path, prefetch, prefetch\-key, log\-queries,
194 hide\-identity, hide\-version, identity, version, val\-log\-level,
195 val\-log\-squelch, ignore\-cd\-flag, add\-holddown, del\-holddown,
196 keep\-missing, tcp\-upstream, ssl\-upstream, max\-udp\-size, ratelimit,
197 ip\-ratelimit, cache\-max\-ttl, cache\-min\-ttl, cache\-max\-negative\-ttl.
198 .TP
199 .B get_option \fIopt
200 Get the value of the option.  Give the option name without a trailing ':'.
201 The value is printed.  If the value is "", nothing is printed
202 and the connection closes.  On error 'error ...' is printed (it gives
203 a syntax error on unknown option).  For some options a list of values,
204 one on each line, is printed.  The options are shown from the config file
205 as modified with set_option.  For some options an override may have been
206 taken that does not show up with this command, not results from e.g. the
207 verbosity and forward control commands.  Not all options work, see list_stubs,
208 list_forwards, list_local_zones and list_local_data for those.
209 .TP
210 .B list_stubs
211 List the stub zones in use.  These are printed one by one to the output.
212 This includes the root hints in use.
213 .TP
214 .B list_forwards
215 List the forward zones in use.  These are printed zone by zone to the output.
216 .TP
217 .B list_insecure
218 List the zones with domain\-insecure.
219 .TP
220 .B list_local_zones
221 List the local zones in use.  These are printed one per line with zone type.
222 .TP
223 .B list_local_data
224 List the local data RRs in use.  The resource records are printed.
225 .TP
226 .B insecure_add \fIzone
227 Add a \fBdomain\-insecure\fR for the given zone, like the statement in unbound.conf.
228 Adds to the running unbound without affecting the cache contents (which may
229 still be bogus, use \fBflush_zone\fR to remove it), does not affect the config file.
230 .TP
231 .B insecure_remove \fIzone
232 Removes domain\-insecure for the given zone.
233 .TP
234 .B forward_add \fR[\fI+i\fR] \fIzone addr ...
235 Add a new forward zone to running unbound.  With +i option also adds a
236 \fIdomain\-insecure\fR for the zone (so it can resolve insecurely if you have
237 a DNSSEC root trust anchor configured for other names).
238 The addr can be IP4, IP6 or nameserver names, like \fIforward-zone\fR config
239 in unbound.conf.
240 .TP
241 .B forward_remove \fR[\fI+i\fR] \fIzone
242 Remove a forward zone from running unbound.  The +i also removes a
243 \fIdomain\-insecure\fR for the zone.
244 .TP
245 .B stub_add \fR[\fI+ip\fR] \fIzone addr ...
246 Add a new stub zone to running unbound.  With +i option also adds a
247 \fIdomain\-insecure\fR for the zone.  With +p the stub zone is set to prime,
248 without it it is set to notprime.  The addr can be IP4, IP6 or nameserver
249 names, like the \fIstub-zone\fR config in unbound.conf.
250 .TP
251 .B stub_remove \fR[\fI+i\fR] \fIzone
252 Remove a stub zone from running unbound.  The +i also removes a
253 \fIdomain\-insecure\fR for the zone.
254 .TP
255 .B forward \fR[\fIoff\fR | \fIaddr ...\fR ]
256 Setup forwarding mode.  Configures if the server should ask other upstream
257 nameservers, should go to the internet root nameservers itself, or show 
258 the current config.  You could pass the nameservers after a DHCP update.
259 .IP
260 Without arguments the current list of addresses used to forward all queries
261 to is printed.  On startup this is from the forward\-zone "." configuration.
262 Afterwards it shows the status.  It prints off when no forwarding is used.
263 .IP
264 If \fIoff\fR is passed, forwarding is disabled and the root nameservers
265 are used.  This can be used to avoid to avoid buggy or non\-DNSSEC supporting
266 nameservers returned from DHCP.  But may not work in hotels or hotspots.
267 .IP
268 If one or more IPv4 or IPv6 addresses are given, those are then used to forward
269 queries to.  The addresses must be separated with spaces.  With '@port' the
270 port number can be set explicitly (default port is 53 (DNS)).
271 .IP
272 By default the forwarder information from the config file for the root "." is
273 used.  The config file is not changed, so after a reload these changes are
274 gone.  Other forward zones from the config file are not affected by this command.
275 .TP
276 .B ratelimit_list \fR[\fI+a\fR]
277 List the domains that are ratelimited.  Printed one per line with current
278 estimated qps and qps limit from config.  With +a it prints all domains, not
279 just the ratelimited domains, with their estimated qps.  The ratelimited
280 domains return an error for uncached (new) queries, but cached queries work
281 as normal.
282 .TP
283 .B ip_ratelimit_list \fR[\fI+a\fR]
284 List the ip addresses that are ratelimited.  Printed one per line with current
285 estimated qps and qps limit from config.  With +a it prints all ips, not
286 just the ratelimited ips, with their estimated qps.  The ratelimited
287 ips are dropped before checking the cache.
288 .TP
289 .B view_list_local_zones \fIview\fR
290 \fIlist_local_zones\fR for given view.
291 .TP
292 .B view_local_zone \fIview\fR \fIname\fR \fItype
293 \fIlocal_zone\fR for given view.
294 .TP
295 .B view_local_zone_remove \fIview\fR \fIname
296 \fIlocal_zone_remove\fR for given view.
297 .TP
298 .B view_list_local_data \fIview\fR
299 \fIlist_local_data\fR for given view.
300 .TP
301 .B view_local_data \fIview\fR \fIRR data...
302 \fIlocal_data\fR for given view.
303 .TP
304 .B view_local_data_remove \fIview\fR \fIname
305 \fIlocal_data_remove\fR for given view.
306 .SH "EXIT CODE"
307 The unbound\-control program exits with status code 1 on error, 0 on success.
308 .SH "SET UP"
309 The setup requires a self\-signed certificate and private keys for both 
310 the server and client.  The script \fIunbound\-control\-setup\fR generates
311 these in the default run directory, or with \-d in another directory.
312 If you change the access control permissions on the key files you can decide
313 who can use unbound\-control, by default owner and group but not all users.
314 Run the script under the same username as you have configured in unbound.conf
315 or as root, so that the daemon is permitted to read the files, for example with:
316 .nf
317     sudo \-u unbound unbound\-control\-setup
318 .fi
319 If you have not configured
320 a username in unbound.conf, the keys need read permission for the user
321 credentials under which the daemon is started.
322 The script preserves private keys present in the directory.
323 After running the script as root, turn on \fBcontrol\-enable\fR in 
324 \fIunbound.conf\fR.
325 .SH "STATISTIC COUNTERS"
326 The \fIstats\fR command shows a number of statistic counters.
327 .TP
328 .I threadX.num.queries
329 number of queries received by thread
330 .TP
331 .I threadX.num.queries_ip_ratelimited
332 number of queries rate limited by thread
333 .TP
334 .I threadX.num.cachehits
335 number of queries that were successfully answered using a cache lookup
336 .TP
337 .I threadX.num.cachemiss
338 number of queries that needed recursive processing
339 .TP
340 .I threadX.num.prefetch
341 number of cache prefetches performed.  This number is included in
342 cachehits, as the original query had the unprefetched answer from cache,
343 and resulted in recursive processing, taking a slot in the requestlist.
344 Not part of the recursivereplies (or the histogram thereof) or cachemiss,
345 as a cache response was sent.
346 .TP
347 .I threadX.num.zero_ttl
348 number of replies with ttl zero, because they served an expired cache entry.
349 .TP
350 .I threadX.num.recursivereplies
351 The number of replies sent to queries that needed recursive processing. Could be smaller than threadX.num.cachemiss if due to timeouts no replies were sent for some queries.
352 .TP
353 .I threadX.requestlist.avg
354 The average number of requests in the internal recursive processing request list on insert of a new incoming recursive processing query.
355 .TP
356 .I threadX.requestlist.max
357 Maximum size attained by the internal recursive processing request list.
358 .TP
359 .I threadX.requestlist.overwritten
360 Number of requests in the request list that were overwritten by newer entries. This happens if there is a flood of queries that recursive processing and the server has a hard time.
361 .TP
362 .I threadX.requestlist.exceeded
363 Queries that were dropped because the request list was full. This happens if a flood of queries need recursive processing, and the server can not keep up.
364 .TP
365 .I threadX.requestlist.current.all
366 Current size of the request list, includes internally generated queries (such
367 as priming queries and glue lookups).
368 .TP
369 .I threadX.requestlist.current.user
370 Current size of the request list, only the requests from client queries.
371 .TP
372 .I threadX.recursion.time.avg
373 Average time it took to answer queries that needed recursive processing. Note that queries that were answered from the cache are not in this average.
374 .TP
375 .I threadX.recursion.time.median
376 The median of the time it took to answer queries that needed recursive
377 processing.  The median means that 50% of the user queries were answered in 
378 less than this time.  Because of big outliers (usually queries to non 
379 responsive servers), the average can be bigger than the median.  This median
380 has been calculated by interpolation from a histogram.
381 .TP
382 .I threadX.tcpusage
383 The currently held tcp buffers for incoming connections.  A spot value on
384 the time of the request.  This helps you spot if the incoming\-num\-tcp
385 buffers are full.
386 .TP
387 .I total.num.queries
388 summed over threads.
389 .TP
390 .I total.num.cachehits
391 summed over threads.
392 .TP
393 .I total.num.cachemiss
394 summed over threads.
395 .TP
396 .I total.num.prefetch
397 summed over threads.
398 .TP
399 .I total.num.zero_ttl
400 summed over threads.
401 .TP
402 .I total.num.recursivereplies
403 summed over threads.
404 .TP
405 .I total.requestlist.avg
406 averaged over threads.
407 .TP
408 .I total.requestlist.max
409 the maximum of the thread requestlist.max values.
410 .TP
411 .I total.requestlist.overwritten
412 summed over threads.
413 .TP
414 .I total.requestlist.exceeded
415 summed over threads.
416 .TP
417 .I total.requestlist.current.all
418 summed over threads.
419 .TP
420 .I total.recursion.time.median
421 averaged over threads.
422 .TP
423 .I total.tcpusage
424 summed over threads.
425 .TP
426 .I time.now
427 current time in seconds since 1970.
428 .TP
429 .I time.up
430 uptime since server boot in seconds.
431 .TP
432 .I time.elapsed
433 time since last statistics printout, in seconds.
434 .SH EXTENDED STATISTICS
435 .TP
436 .I mem.cache.rrset
437 Memory in bytes in use by the RRset cache.
438 .TP
439 .I mem.cache.message
440 Memory in bytes in use by the message cache.
441 .TP
442 .I mem.mod.iterator
443 Memory in bytes in use by the iterator module.
444 .TP
445 .I mem.mod.validator
446 Memory in bytes in use by the validator module. Includes the key cache and
447 negative cache.
448 .TP
449 .I histogram.<sec>.<usec>.to.<sec>.<usec>
450 Shows a histogram, summed over all threads. Every element counts the
451 recursive queries whose reply time fit between the lower and upper bound.
452 Times larger or equal to the lowerbound, and smaller than the upper bound.
453 There are 40 buckets, with bucket sizes doubling.
454 .TP
455 .I num.query.type.A
456 The total number of queries over all threads with query type A.
457 Printed for the other query types as well, but only for the types for which
458 queries were received, thus =0 entries are omitted for brevity.
459 .TP
460 .I num.query.type.other
461 Number of queries with query types 256\-65535.
462 .TP
463 .I num.query.class.IN
464 The total number of queries over all threads with query class IN (internet).
465 Also printed for other classes (such as CH (CHAOS) sometimes used for
466 debugging), or NONE, ANY, used by dynamic update.
467 num.query.class.other is printed for classes 256\-65535.
468 .TP
469 .I num.query.opcode.QUERY
470 The total number of queries over all threads with query opcode QUERY.
471 Also printed for other opcodes, UPDATE, ...
472 .TP
473 .I num.query.tcp
474 Number of queries that were made using TCP towards the unbound server.
475 .TP
476 .I num.query.tcpout
477 Number of queries that the unbound server made using TCP outgoing towards
478 other servers.
479 .TP
480 .I num.query.ipv6
481 Number of queries that were made using IPv6 towards the unbound server.
482 .TP
483 .I num.query.flags.RD
484 The number of queries that had the RD flag set in the header.
485 Also printed for flags QR, AA, TC, RA, Z, AD, CD.
486 Note that queries with flags QR, AA or TC may have been rejected 
487 because of that.
488 .TP
489 .I num.query.edns.present
490 number of queries that had an EDNS OPT record present.
491 .TP
492 .I num.query.edns.DO
493 number of queries that had an EDNS OPT record with the DO (DNSSEC OK) bit set.
494 These queries are also included in the num.query.edns.present number.
495 .TP
496 .I num.answer.rcode.NXDOMAIN
497 The number of answers to queries, from cache or from recursion, that had the
498 return code NXDOMAIN. Also printed for the other return codes.
499 .TP
500 .I num.answer.rcode.nodata
501 The number of answers to queries that had the pseudo return code nodata.
502 This means the actual return code was NOERROR, but additionally, no data was
503 carried in the answer (making what is called a NOERROR/NODATA answer).
504 These queries are also included in the num.answer.rcode.NOERROR number.
505 Common for AAAA lookups when an A record exists, and no AAAA.
506 .TP
507 .I num.answer.secure
508 Number of answers that were secure.  The answer validated correctly. 
509 The AD bit might have been set in some of these answers, where the client
510 signalled (with DO or AD bit in the query) that they were ready to accept
511 the AD bit in the answer.
512 .TP
513 .I num.answer.bogus
514 Number of answers that were bogus.  These answers resulted in SERVFAIL
515 to the client because the answer failed validation.
516 .TP
517 .I num.rrset.bogus
518 The number of rrsets marked bogus by the validator.  Increased for every
519 RRset inspection that fails.
520 .TP
521 .I unwanted.queries
522 Number of queries that were refused or dropped because they failed the
523 access control settings.
524 .TP
525 .I unwanted.replies
526 Replies that were unwanted or unsolicited.  Could have been random traffic,
527 delayed duplicates, very late answers, or could be spoofing attempts.
528 Some low level of late answers and delayed duplicates are to be expected
529 with the UDP protocol.  Very high values could indicate a threat (spoofing).
530 .TP
531 .I msg.cache.count
532 The number of items (DNS replies) in the message cache.
533 .TP
534 .I rrset.cache.count
535 The number of RRsets in the rrset cache.  This includes rrsets used by
536 the messages in the message cache, but also delegation information.
537 .TP
538 .I infra.cache.count
539 The number of items in the infra cache.  These are IP addresses with their
540 timing and protocol support information.
541 .TP
542 .I key.cache.count
543 The number of items in the key cache.  These are DNSSEC keys, one item
544 per delegation point, and their validation status.
545 .SH "FILES"
546 .TP
547 .I /var/unbound/unbound.conf
548 unbound configuration file.
549 .TP
550 .I /var/unbound
551 directory with private keys (unbound_server.key and unbound_control.key) and
552 self\-signed certificates (unbound_server.pem and unbound_control.pem).
553 .SH "SEE ALSO"
554 \fIunbound.conf\fR(5), 
555 \fIunbound\fR(8).