]> git.ipfire.org Git - people/ms/dnsmasq.git/blob - man/dnsmasq.8
Final form of configuration for EDNS0 MAC-address code.
[people/ms/dnsmasq.git] / man / dnsmasq.8
1 .TH DNSMASQ 8
2 .SH NAME
3 dnsmasq \- A lightweight DHCP and caching DNS server.
4 .SH SYNOPSIS
5 .B dnsmasq
6 .I [OPTION]...
7 .SH "DESCRIPTION"
8 .BR dnsmasq
9 is a lightweight DNS, TFTP, PXE, router advertisement and DHCP server. It is intended to provide
10 coupled DNS and DHCP service to a LAN.
11 .PP
12 Dnsmasq accepts DNS queries and either answers them from a small, local,
13 cache or forwards them to a real, recursive, DNS server. It loads the
14 contents of /etc/hosts so that local hostnames
15 which do not appear in the global DNS can be resolved and also answers
16 DNS queries for DHCP configured hosts. It can also act as the
17 authoritative DNS server for one or more domains, allowing local names
18 to appear in the global DNS. It can be configured to do DNSSEC
19 validation.
20 .PP
21 The dnsmasq DHCP server supports static address assignments and multiple
22 networks. It automatically
23 sends a sensible default set of DHCP options, and can be configured to
24 send any desired set of DHCP options, including vendor-encapsulated
25 options. It includes a secure, read-only,
26 TFTP server to allow net/PXE boot of DHCP hosts and also supports BOOTP. The PXE support is full featured, and includes a proxy mode which supplies PXE information to clients whilst DHCP address allocation is done by another server.
27 .PP
28 The dnsmasq DHCPv6 server provides the same set of features as the
29 DHCPv4 server, and in addition, it includes router advertisements and
30 a neat feature which allows nameing for clients which use DHCPv4 and
31 stateless autoconfiguration only for IPv6 configuration. There is support for doing address allocation (both DHCPv6 and RA) from subnets which are dynamically delegated via DHCPv6 prefix delegation.
32 .PP
33 Dnsmasq is coded with small embedded systems in mind. It aims for the smallest possible memory footprint compatible with the supported functions, and allows uneeded functions to be omitted from the compiled binary.
34 .SH OPTIONS
35 Note that in general missing parameters are allowed and switch off
36 functions, for instance "--pid-file" disables writing a PID file. On
37 BSD, unless the GNU getopt library is linked, the long form of the
38 options does not work on the command line; it is still recognised in
39 the configuration file.
40 .TP
41 .B --test
42 Read and syntax check configuration file(s). Exit with code 0 if all
43 is OK, or a non-zero code otherwise. Do not start up dnsmasq.
44 .TP
45 .B \-h, --no-hosts
46 Don't read the hostnames in /etc/hosts.
47 .TP
48 .B \-H, --addn-hosts=<file>
49 Additional hosts file. Read the specified file as well as /etc/hosts. If -h is given, read
50 only the specified file. This option may be repeated for more than one
51 additional hosts file. If a directory is given, then read all the files contained in that directory.
52 .TP
53 .B --hostsdir=<path>
54 Read all the hosts files contained in the directory. New or changed files
55 are read automatically. See --dhcp-hostsdir for details.
56 .TP
57 .B \-E, --expand-hosts
58 Add the domain to simple names (without a period) in /etc/hosts
59 in the same way as for DHCP-derived names. Note that this does not
60 apply to domain names in cnames, PTR records, TXT records etc.
61 .TP
62 .B \-T, --local-ttl=<time>
63 When replying with information from /etc/hosts or the DHCP leases
64 file dnsmasq by default sets the time-to-live field to zero, meaning
65 that the requester should not itself cache the information. This is
66 the correct thing to do in almost all situations. This option allows a
67 time-to-live (in seconds) to be given for these replies. This will
68 reduce the load on the server at the expense of clients using stale
69 data under some circumstances.
70 .TP
71 .B --neg-ttl=<time>
72 Negative replies from upstream servers normally contain time-to-live
73 information in SOA records which dnsmasq uses for caching. If the
74 replies from upstream servers omit this information, dnsmasq does not
75 cache the reply. This option gives a default value for time-to-live
76 (in seconds) which dnsmasq uses to cache negative replies even in
77 the absence of an SOA record.
78 .TP
79 .B --max-ttl=<time>
80 Set a maximum TTL value that will be handed out to clients. The specified
81 maximum TTL will be given to clients instead of the true TTL value if it is
82 lower. The true TTL value is however kept in the cache to avoid flooding
83 the upstream DNS servers.
84 .TP
85 .B --max-cache-ttl=<time>
86 Set a maximum TTL value for entries in the cache.
87 .TP
88 .B --min-cache-ttl=<time>
89 Extend short TTL values to the time given when caching them. Note that
90 artificially extending TTL values is in general a bad idea, do not do it
91 unless you have a good reason, and understand what you are doing.
92 Dnsmasq limits the value of this option to one hour, unless recompiled.
93 .TP
94 .B --auth-ttl=<time>
95 Set the TTL value returned in answers from the authoritative server.
96 .TP
97 .B \-k, --keep-in-foreground
98 Do not go into the background at startup but otherwise run as
99 normal. This is intended for use when dnsmasq is run under daemontools
100 or launchd.
101 .TP
102 .B \-d, --no-daemon
103 Debug mode: don't fork to the background, don't write a pid file,
104 don't change user id, generate a complete cache dump on receipt on
105 SIGUSR1, log to stderr as well as syslog, don't fork new processes
106 to handle TCP queries. Note that this option is for use in debugging
107 only, to stop dnsmasq daemonising in production, use
108 .B -k.
109 .TP
110 .B \-q, --log-queries
111 Log the results of DNS queries handled by dnsmasq. Enable a full cache dump on receipt of SIGUSR1. If the argument "extra" is supplied, ie
112 .B --log-queries=extra
113 then the log has extra information at the start of each line.
114 This consists of a serial number which ties together the log lines associated with an individual query, and the IP address of the requestor.
115 .TP
116 .B \-8, --log-facility=<facility>
117 Set the facility to which dnsmasq will send syslog entries, this
118 defaults to DAEMON, and to LOCAL0 when debug mode is in operation. If
119 the facility given contains at least one '/' character, it is taken to
120 be a filename, and dnsmasq logs to the given file, instead of
121 syslog. If the facility is '-' then dnsmasq logs to stderr.
122 (Errors whilst reading configuration will still go to syslog,
123 but all output from a successful startup, and all output whilst
124 running, will go exclusively to the file.) When logging to a file,
125 dnsmasq will close and reopen the file when it receives SIGUSR2. This
126 allows the log file to be rotated without stopping dnsmasq.
127 .TP
128 .B --log-async[=<lines>]
129 Enable asynchronous logging and optionally set the limit on the
130 number of lines
131 which will be queued by dnsmasq when writing to the syslog is slow.
132 Dnsmasq can log asynchronously: this
133 allows it to continue functioning without being blocked by syslog, and
134 allows syslog to use dnsmasq for DNS queries without risking deadlock.
135 If the queue of log-lines becomes full, dnsmasq will log the
136 overflow, and the number of messages lost. The default queue length is
137 5, a sane value would be 5-25, and a maximum limit of 100 is imposed.
138 .TP
139 .B \-x, --pid-file=<path>
140 Specify an alternate path for dnsmasq to record its process-id in. Normally /var/run/dnsmasq.pid.
141 .TP
142 .B \-u, --user=<username>
143 Specify the userid to which dnsmasq will change after startup. Dnsmasq must normally be started as root, but it will drop root
144 privileges after startup by changing id to another user. Normally this user is "nobody" but that
145 can be over-ridden with this switch.
146 .TP
147 .B \-g, --group=<groupname>
148 Specify the group which dnsmasq will run
149 as. The defaults to "dip", if available, to facilitate access to
150 /etc/ppp/resolv.conf which is not normally world readable.
151 .TP
152 .B \-v, --version
153 Print the version number.
154 .TP
155 .B \-p, --port=<port>
156 Listen on <port> instead of the standard DNS port (53). Setting this
157 to zero completely disables DNS function, leaving only DHCP and/or TFTP.
158 .TP
159 .B \-P, --edns-packet-max=<size>
160 Specify the largest EDNS.0 UDP packet which is supported by the DNS
161 forwarder. Defaults to 4096, which is the RFC5625-recommended size.
162 .TP
163 .B \-Q, --query-port=<query_port>
164 Send outbound DNS queries from, and listen for their replies on, the
165 specific UDP port <query_port> instead of using random ports. NOTE
166 that using this option will make dnsmasq less secure against DNS
167 spoofing attacks but it may be faster and use less resources. Setting this option
168 to zero makes dnsmasq use a single port allocated to it by the
169 OS: this was the default behaviour in versions prior to 2.43.
170 .TP
171 .B --min-port=<port>
172 Do not use ports less than that given as source for outbound DNS
173 queries. Dnsmasq picks random ports as source for outbound queries:
174 when this option is given, the ports used will always to larger
175 than that specified. Useful for systems behind firewalls.
176 .TP
177 .B --max-port=<port>
178 Use ports lower than that given as source for outbound DNS queries.
179 Dnsmasq picks random ports as source for outbound queries:
180 when this option is given, the ports used will always be lower
181 than that specified. Useful for systems behind firewalls.
182 .TP
183
184 .B \-i, --interface=<interface name>
185 Listen only on the specified interface(s). Dnsmasq automatically adds
186 the loopback (local) interface to the list of interfaces to use when
187 the
188 .B \--interface
189 option is used. If no
190 .B \--interface
191 or
192 .B \--listen-address
193 options are given dnsmasq listens on all available interfaces except any
194 given in
195 .B \--except-interface
196 options. IP alias interfaces (eg "eth1:0") cannot be used with
197 .B --interface
198 or
199 .B --except-interface
200 options, use --listen-address instead. A simple wildcard, consisting
201 of a trailing '*', can be used in
202 .B \--interface
203 and
204 .B \--except-interface
205 options.
206 .TP
207 .B \-I, --except-interface=<interface name>
208 Do not listen on the specified interface. Note that the order of
209 .B \--listen-address
210 .B --interface
211 and
212 .B --except-interface
213 options does not matter and that
214 .B --except-interface
215 options always override the others.
216 .TP
217 .B --auth-server=<domain>,<interface>|<ip-address>
218 Enable DNS authoritative mode for queries arriving at an interface or address. Note that the interface or address
219 need not be mentioned in
220 .B --interface
221 or
222 .B --listen-address
223 configuration, indeed
224 .B --auth-server
225 will overide these and provide a different DNS service on the
226 specified interface. The <domain> is the "glue record". It should
227 resolve in the global DNS to a A and/or AAAA record which points to
228 the address dnsmasq is listening on. When an interface is specified,
229 it may be qualified with "/4" or "/6" to specify only the IPv4 or IPv6
230 addresses associated with the interface.
231 .TP
232 .B --local-service
233 Accept DNS queries only from hosts whose address is on a local subnet,
234 ie a subnet for which an interface exists on the server. This option
235 only has effect is there are no --interface --except-interface,
236 --listen-address or --auth-server options. It is intended to be set as
237 a default on installation, to allow unconfigured installations to be
238 useful but also safe from being used for DNS amplification attacks.
239 .TP
240 .B \-2, --no-dhcp-interface=<interface name>
241 Do not provide DHCP or TFTP on the specified interface, but do provide DNS service.
242 .TP
243 .B \-a, --listen-address=<ipaddr>
244 Listen on the given IP address(es). Both
245 .B \--interface
246 and
247 .B \--listen-address
248 options may be given, in which case the set of both interfaces and
249 addresses is used. Note that if no
250 .B \--interface
251 option is given, but
252 .B \--listen-address
253 is, dnsmasq will not automatically listen on the loopback
254 interface. To achieve this, its IP address, 127.0.0.1, must be
255 explicitly given as a
256 .B \--listen-address
257 option.
258 .TP
259 .B \-z, --bind-interfaces
260 On systems which support it, dnsmasq binds the wildcard address,
261 even when it is listening on only some interfaces. It then discards
262 requests that it shouldn't reply to. This has the advantage of
263 working even when interfaces come and go and change address. This
264 option forces dnsmasq to really bind only the interfaces it is
265 listening on. About the only time when this is useful is when
266 running another nameserver (or another instance of dnsmasq) on the
267 same machine. Setting this option also enables multiple instances of
268 dnsmasq which provide DHCP service to run in the same machine.
269 .TP
270 .B --bind-dynamic
271 Enable a network mode which is a hybrid between
272 .B --bind-interfaces
273 and the default. Dnsmasq binds the address of individual interfaces,
274 allowing multiple dnsmasq instances, but if new interfaces or
275 addresses appear, it automatically listens on those (subject to any
276 access-control configuration). This makes dynamically created
277 interfaces work in the same way as the default. Implementing this
278 option requires non-standard networking APIs and it is only available
279 under Linux. On other platforms it falls-back to --bind-interfaces mode.
280 .TP
281 .B \-y, --localise-queries
282 Return answers to DNS queries from /etc/hosts which depend on the interface over which the query was
283 received. If a name in /etc/hosts has more than one address associated with
284 it, and at least one of those addresses is on the same subnet as the
285 interface to which the query was sent, then return only the
286 address(es) on that subnet. This allows for a server to have multiple
287 addresses in /etc/hosts corresponding to each of its interfaces, and
288 hosts will get the correct address based on which network they are
289 attached to. Currently this facility is limited to IPv4.
290 .TP
291 .B \-b, --bogus-priv
292 Bogus private reverse lookups. All reverse lookups for private IP ranges (ie 192.168.x.x, etc)
293 which are not found in /etc/hosts or the DHCP leases file are answered
294 with "no such domain" rather than being forwarded upstream.
295 .TP
296 .B \-V, --alias=[<old-ip>]|[<start-ip>-<end-ip>],<new-ip>[,<mask>]
297 Modify IPv4 addresses returned from upstream nameservers; old-ip is
298 replaced by new-ip. If the optional mask is given then any address
299 which matches the masked old-ip will be re-written. So, for instance
300 .B --alias=1.2.3.0,6.7.8.0,255.255.255.0
301 will map 1.2.3.56 to 6.7.8.56 and 1.2.3.67 to 6.7.8.67. This is what
302 Cisco PIX routers call "DNS doctoring". If the old IP is given as
303 range, then only addresses in the range, rather than a whole subnet,
304 are re-written. So
305 .B --alias=192.168.0.10-192.168.0.40,10.0.0.0,255.255.255.0
306 maps 192.168.0.10->192.168.0.40 to 10.0.0.10->10.0.0.40
307 .TP
308 .B \-B, --bogus-nxdomain=<ipaddr>
309 Transform replies which contain the IP address given into "No such
310 domain" replies. This is intended to counteract a devious move made by
311 Verisign in September 2003 when they started returning the address of
312 an advertising web page in response to queries for unregistered names,
313 instead of the correct NXDOMAIN response. This option tells dnsmasq to
314 fake the correct response when it sees this behaviour. As at Sept 2003
315 the IP address being returned by Verisign is 64.94.110.11
316 .TP
317 .B \-B, --ignore-address=<ipaddr>
318 Ignore replies to A-record queries which include the specified address.
319 No error is generated, dnsmasq simply continues to listen for another reply.
320 This is useful to defeat blocking strategies which rely on quickly supplying a
321 forged answer to a DNS request for certain domain, before the correct answer can arrive.
322 .TP
323 .B \-f, --filterwin2k
324 Later versions of windows make periodic DNS requests which don't get sensible answers from
325 the public DNS and can cause problems by triggering dial-on-demand links. This flag turns on an option
326 to filter such requests. The requests blocked are for records of types SOA and SRV, and type ANY where the
327 requested name has underscores, to catch LDAP requests.
328 .TP
329 .B \-r, --resolv-file=<file>
330 Read the IP addresses of the upstream nameservers from <file>, instead of
331 /etc/resolv.conf. For the format of this file see
332 .BR resolv.conf (5).
333 The only lines relevant to dnsmasq are nameserver ones. Dnsmasq can
334 be told to poll more than one resolv.conf file, the first file name specified
335 overrides the default, subsequent ones add to the list. This is only
336 allowed when polling; the file with the currently latest modification
337 time is the one used.
338 .TP
339 .B \-R, --no-resolv
340 Don't read /etc/resolv.conf. Get upstream servers only from the command
341 line or the dnsmasq configuration file.
342 .TP
343 .B \-1, --enable-dbus[=<service-name>]
344 Allow dnsmasq configuration to be updated via DBus method calls. The
345 configuration which can be changed is upstream DNS servers (and
346 corresponding domains) and cache clear. Requires that dnsmasq has
347 been built with DBus support. If the service name is given, dnsmasq
348 provides service at that name, rather than the default which is
349 .B uk.org.thekelleys.dnsmasq
350 .TP
351 .B \-o, --strict-order
352 By default, dnsmasq will send queries to any of the upstream servers
353 it knows about and tries to favour servers that are known to
354 be up. Setting this flag forces dnsmasq to try each query with each
355 server strictly in the order they appear in /etc/resolv.conf
356 .TP
357 .B --all-servers
358 By default, when dnsmasq has more than one upstream server available,
359 it will send queries to just one server. Setting this flag forces
360 dnsmasq to send all queries to all available servers. The reply from
361 the server which answers first will be returned to the original requester.
362 .TP
363 .B --dns-loop-detect
364 Enable code to detect DNS forwarding loops; ie the situation where a query sent to one
365 of the upstream server eventually returns as a new query to the dnsmasq instance. The
366 process works by generating TXT queries of the form <hex>.test and sending them to
367 each upstream server. The hex is a UID which encodes the instance of dnsmasq sending the query
368 and the upstream server to which it was sent. If the query returns to the server which sent it, then
369 the upstream server through which it was sent is disabled and this event is logged. Each time the
370 set of upstream servers changes, the test is re-run on all of them, including ones which
371 were previously disabled.
372 .TP
373 .B --stop-dns-rebind
374 Reject (and log) addresses from upstream nameservers which are in the
375 private IP ranges. This blocks an attack where a browser behind a
376 firewall is used to probe machines on the local network.
377 .TP
378 .B --rebind-localhost-ok
379 Exempt 127.0.0.0/8 from rebinding checks. This address range is
380 returned by realtime black hole servers, so blocking it may disable
381 these services.
382 .TP
383 .B --rebind-domain-ok=[<domain>]|[[/<domain>/[<domain>/]
384 Do not detect and block dns-rebind on queries to these domains. The
385 argument may be either a single domain, or multiple domains surrounded
386 by '/', like the --server syntax, eg.
387 .B --rebind-domain-ok=/domain1/domain2/domain3/
388 .TP
389 .B \-n, --no-poll
390 Don't poll /etc/resolv.conf for changes.
391 .TP
392 .B --clear-on-reload
393 Whenever /etc/resolv.conf is re-read or the upstream servers are set
394 via DBus, clear the DNS cache.
395 This is useful when new nameservers may have different
396 data than that held in cache.
397 .TP
398 .B \-D, --domain-needed
399 Tells dnsmasq to never forward A or AAAA queries for plain names, without dots
400 or domain parts, to upstream nameservers. If the name is not known
401 from /etc/hosts or DHCP then a "not found" answer is returned.
402 .TP
403 .B \-S, --local, --server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
404 Specify IP address of upstream servers directly. Setting this flag does
405 not suppress reading of /etc/resolv.conf, use -R to do that. If one or
406 more
407 optional domains are given, that server is used only for those domains
408 and they are queried only using the specified server. This is
409 intended for private nameservers: if you have a nameserver on your
410 network which deals with names of the form
411 xxx.internal.thekelleys.org.uk at 192.168.1.1 then giving the flag
412 .B -S /internal.thekelleys.org.uk/192.168.1.1
413 will send all queries for
414 internal machines to that nameserver, everything else will go to the
415 servers in /etc/resolv.conf. DNSSEC validation is turned off for such
416 private nameservers, UNLESS a
417 .B --trust-anchor
418 is specified for the domain in question. An empty domain specification,
419 .B //
420 has the special meaning of "unqualified names only" ie names without any
421 dots in them. A non-standard port may be specified as
422 part of the IP
423 address using a # character.
424 More than one -S flag is allowed, with
425 repeated domain or ipaddr parts as required.
426
427 More specific domains take precendence over less specific domains, so:
428 .B --server=/google.com/1.2.3.4
429 .B --server=/www.google.com/2.3.4.5
430 will send queries for *.google.com to 1.2.3.4, except *www.google.com,
431 which will go to 2.3.4.5
432
433 The special server address '#' means, "use the standard servers", so
434 .B --server=/google.com/1.2.3.4
435 .B --server=/www.google.com/#
436 will send queries for *.google.com to 1.2.3.4, except *www.google.com which will
437 be forwarded as usual.
438
439 Also permitted is a -S
440 flag which gives a domain but no IP address; this tells dnsmasq that
441 a domain is local and it may answer queries from /etc/hosts or DHCP
442 but should never forward queries on that domain to any upstream
443 servers.
444 .B local
445 is a synonym for
446 .B server
447 to make configuration files clearer in this case.
448
449 IPv6 addresses may include a %interface scope-id, eg
450 fe80::202:a412:4512:7bbf%eth0.
451
452 The optional string after the @ character tells
453 dnsmasq how to set the source of the queries to this
454 nameserver. It should be an ip-address, which should belong to the machine on which
455 dnsmasq is running otherwise this server line will be logged and then
456 ignored, or an interface name. If an interface name is given, then
457 queries to the server will be forced via that interface; if an
458 ip-address is given then the source address of the queries will be set
459 to that address.
460 The query-port flag is ignored for any servers which have a
461 source address specified but the port may be specified directly as
462 part of the source address. Forcing queries to an interface is not
463 implemented on all platforms supported by dnsmasq.
464 .TP
465 .B --rev-server=<ip-address>/<prefix-len>,<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
466 This is functionally the same as
467 .B --server,
468 but provides some syntactic sugar to make specifying address-to-name queries easier. For example
469 .B --rev-server=1.2.3.0/24,192.168.0.1
470 is exactly equivalent to
471 .B --server=/3.2.1.in-addr.arpa/192.168.0.1
472 .TP
473 .B \-A, --address=/<domain>/[domain/][<ipaddr>]
474 Specify an IP address to return for any host in the given domains.
475 Queries in the domains are never forwarded and always replied to
476 with the specified IP address which may be IPv4 or IPv6. To give
477 both IPv4 and IPv6 addresses for a domain, use repeated -A flags.
478 Note that /etc/hosts and DHCP leases override this for individual
479 names. A common use of this is to redirect the entire doubleclick.net
480 domain to some friendly local web server to avoid banner ads. The
481 domain specification works in the same was as for --server, with the
482 additional facility that /#/ matches any domain. Thus
483 --address=/#/1.2.3.4 will always return 1.2.3.4 for any query not
484 answered from /etc/hosts or DHCP and not sent to an upstream
485 nameserver by a more specific --server directive. As for --server,
486 one or more domains with no address returns a no-such-domain answer, so
487 --address=/example.com/ is equivalent to --server=/example.com/ and returns
488 NXDOMAIN for example.com and all its subdomains.
489 .TP
490 .B --ipset=/<domain>/[domain/]<ipset>[,<ipset>]
491 Places the resolved IP addresses of queries for the specified domains
492 in the specified netfilter ip sets. Domains and subdomains are matched
493 in the same way as --address. These ip sets must already exist. See
494 ipset(8) for more details.
495 .TP
496 .B \-m, --mx-host=<mx name>[[,<hostname>],<preference>]
497 Return an MX record named <mx name> pointing to the given hostname (if
498 given), or
499 the host specified in the --mx-target switch
500 or, if that switch is not given, the host on which dnsmasq
501 is running. The default is useful for directing mail from systems on a LAN
502 to a central server. The preference value is optional, and defaults to
503 1 if not given. More than one MX record may be given for a host.
504 .TP
505 .B \-t, --mx-target=<hostname>
506 Specify the default target for the MX record returned by dnsmasq. See
507 --mx-host. If --mx-target is given, but not --mx-host, then dnsmasq
508 returns a MX record containing the MX target for MX queries on the
509 hostname of the machine on which dnsmasq is running.
510 .TP
511 .B \-e, --selfmx
512 Return an MX record pointing to itself for each local
513 machine. Local machines are those in /etc/hosts or with DHCP leases.
514 .TP
515 .B \-L, --localmx
516 Return an MX record pointing to the host given by mx-target (or the
517 machine on which dnsmasq is running) for each
518 local machine. Local machines are those in /etc/hosts or with DHCP
519 leases.
520 .TP
521 .B \-W, --srv-host=<_service>.<_prot>.[<domain>],[<target>[,<port>[,<priority>[,<weight>]]]]
522 Return a SRV DNS record. See RFC2782 for details. If not supplied, the
523 domain defaults to that given by
524 .B --domain.
525 The default for the target domain is empty, and the default for port
526 is one and the defaults for
527 weight and priority are zero. Be careful if transposing data from BIND
528 zone files: the port, weight and priority numbers are in a different
529 order. More than one SRV record for a given service/domain is allowed,
530 all that match are returned.
531 .TP
532 .B --host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>]
533 Add A, AAAA and PTR records to the DNS. This adds one or more names to
534 the DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may
535 appear in more than one
536 .B host-record
537 and therefore be assigned more than one address. Only the first
538 address creates a PTR record linking the address to the name. This is
539 the same rule as is used reading hosts-files.
540 .B host-record
541 options are considered to be read before host-files, so a name
542 appearing there inhibits PTR-record creation if it appears in
543 hosts-file also. Unlike hosts-files, names are not expanded, even when
544 .B expand-hosts
545 is in effect. Short and long names may appear in the same
546 .B host-record,
547 eg.
548 .B --host-record=laptop,laptop.thekelleys.org,192.168.0.1,1234::100
549 .TP
550 .B \-Y, --txt-record=<name>[[,<text>],<text>]
551 Return a TXT DNS record. The value of TXT record is a set of strings,
552 so any number may be included, delimited by commas; use quotes to put
553 commas into a string. Note that the maximum length of a single string
554 is 255 characters, longer strings are split into 255 character chunks.
555 .TP
556 .B --ptr-record=<name>[,<target>]
557 Return a PTR DNS record.
558 .TP
559 .B --naptr-record=<name>,<order>,<preference>,<flags>,<service>,<regexp>[,<replacement>]
560 Return an NAPTR DNS record, as specified in RFC3403.
561 .TP
562 .B --cname=<cname>,<target>
563 Return a CNAME record which indicates that <cname> is really
564 <target>. There are significant limitations on the target; it must be a
565 DNS name which is known to dnsmasq from /etc/hosts (or additional
566 hosts files), from DHCP, from --interface-name or from another
567 .B --cname.
568 If the target does not satisfy this
569 criteria, the whole cname is ignored. The cname must be unique, but it
570 is permissable to have more than one cname pointing to the same target.
571 .TP
572 .B --dns-rr=<name>,<RR-number>,[<hex data>]
573 Return an arbitrary DNS Resource Record. The number is the type of the
574 record (which is always in the C_IN class). The value of the record is
575 given by the hex data, which may be of the form 01:23:45 or 01 23 45 or
576 012345 or any mixture of these.
577 .TP
578 .B --interface-name=<name>,<interface>[/4|/6]
579 Return a DNS record associating the name with the primary address on
580 the given interface. This flag specifies an A or AAAA record for the given
581 name in the same way as an /etc/hosts line, except that the address is
582 not constant, but taken from the given interface. The interface may be
583 followed by "/4" or "/6" to specify that only IPv4 or IPv6 addresses
584 of the interface should be used. If the interface is
585 down, not configured or non-existent, an empty record is returned. The
586 matching PTR record is also created, mapping the interface address to
587 the name. More than one name may be associated with an interface
588 address by repeating the flag; in that case the first instance is used
589 for the reverse address-to-name mapping.
590 .TP
591 .B --synth-domain=<domain>,<address range>[,<prefix>]
592 Create artificial A/AAAA and PTR records for an address range. The
593 records use the address, with periods (or colons for IPv6) replaced
594 with dashes.
595
596 An example should make this clearer.
597 .B --synth-domain=thekelleys.org.uk,192.168.0.0/24,internal-
598 will result in a query for internal-192-168-0-56.thekelleys.org.uk returning
599 192.168.0.56 and a reverse query vice versa. The same applies to IPv6,
600 but IPv6 addresses may start with '::'
601 but DNS labels may not start with '-' so in this case if no prefix is
602 configured a zero is added in front of the label. ::1 becomes 0--1.
603
604 The address range can be of the form
605 <ip address>,<ip address> or <ip address>/<netmask>
606 .TP
607 .B --add-mac[=base64]
608 Add the MAC address of the requestor to DNS queries which are
609 forwarded upstream. This may be used to DNS filtering by the upstream
610 server. The MAC address can only be added if the requestor is on the same
611 subnet as the dnsmasq server. Note that the mechanism used to achieve this (an EDNS0 option)
612 is not yet standardised, so this should be considered
613 experimental. Also note that exposing MAC addresses in this way may
614 have security and privacy implications. The warning about caching
615 given for --add-subnet applies to --add-mac too. An alternative encoding of the
616 MAC, as base64, is enabled by adding the "base64" parameter.
617 .TP
618 .B --add-cpe-id=<string>
619 Add a arbitrary identifying string to o DNS queries which are
620 forwarded upstream.
621 .TP
622 .B --add-subnet[[=[<IPv4 address>/]<IPv4 prefix length>][,[<IPv6 address>/]<IPv6 prefix length>]]
623 Add a subnet address to the DNS queries which are forwarded
624 upstream. If an address is specified in the flag, it will be used,
625 otherwise, the address of the requestor will be used. The amount of
626 the address forwarded depends on the prefix length parameter: 32 (128
627 for IPv6) forwards the whole address, zero forwards none of it but
628 still marks the request so that no upstream nameserver will add client
629 address information either. The default is zero for both IPv4 and
630 IPv6. Note that upstream nameservers may be configured to return
631 different results based on this information, but the dnsmasq cache
632 does not take account. If a dnsmasq instance is configured such that
633 different results may be encountered, caching should be disabled.
634
635 For example,
636 .B --add-subnet=24,96
637 will add the /24 and /96 subnets of the requestor for IPv4 and IPv6 requestors, respectively.
638 .B --add-subnet=1.2.3.4/24
639 will add 1.2.3.0/24 for IPv4 requestors and ::/0 for IPv6 requestors.
640 .B --add-subnet=1.2.3.4/24,1.2.3.4/24
641 will add 1.2.3.0/24 for both IPv4 and IPv6 requestors.
642
643 .TP
644 .B \-c, --cache-size=<cachesize>
645 Set the size of dnsmasq's cache. The default is 150 names. Setting the cache size to zero disables caching.
646 .TP
647 .B \-N, --no-negcache
648 Disable negative caching. Negative caching allows dnsmasq to remember
649 "no such domain" answers from upstream nameservers and answer
650 identical queries without forwarding them again.
651 .TP
652 .B \-0, --dns-forward-max=<queries>
653 Set the maximum number of concurrent DNS queries. The default value is
654 150, which should be fine for most setups. The only known situation
655 where this needs to be increased is when using web-server log file
656 resolvers, which can generate large numbers of concurrent queries.
657 .TP
658 .B --dnssec
659 Validate DNS replies and cache DNSSEC data. When forwarding DNS queries, dnsmasq requests the
660 DNSSEC records needed to validate the replies. The replies are validated and the result returned as
661 the Authenticated Data bit in the DNS packet. In addition the DNSSEC records are stored in the cache, making
662 validation by clients more efficient. Note that validation by clients is the most secure DNSSEC mode, but for
663 clients unable to do validation, use of the AD bit set by dnsmasq is useful, provided that the network between
664 the dnsmasq server and the client is trusted. Dnsmasq must be compiled with HAVE_DNSSEC enabled, and DNSSEC
665 trust anchors provided, see
666 .B --trust-anchor.
667 Because the DNSSEC validation process uses the cache, it is not
668 permitted to reduce the cache size below the default when DNSSEC is
669 enabled. The nameservers upstream of dnsmasq must be DNSSEC-capable,
670 ie capable of returning DNSSEC records with data. If they are not,
671 then dnsmasq will not be able to determine the trusted status of
672 answers. In the default mode, this menas that all replies will be
673 marked as untrusted. If
674 .B --dnssec-check-unsigned
675 is set and the upstream servers don't support DNSSEC, then DNS service will be entirely broken.
676 .TP
677 .B --trust-anchor=[<class>],<domain>,<key-tag>,<algorithm>,<digest-type>,<digest>
678 Provide DS records to act a trust anchors for DNSSEC
679 validation. Typically these will be the DS record(s) for Zone Signing
680 key(s) of the root zone,
681 but trust anchors for limited domains are also possible. The current
682 root-zone trust anchors may be downloaded from https://data.iana.org/root-anchors/root-anchors.xml
683 .TP
684 .B --dnssec-check-unsigned
685 As a default, dnsmasq does not check that unsigned DNS replies are
686 legitimate: they are assumed to be valid and passed on (without the
687 "authentic data" bit set, of course). This does not protect against an
688 attacker forging unsigned replies for signed DNS zones, but it is
689 fast. If this flag is set, dnsmasq will check the zones of unsigned
690 replies, to ensure that unsigned replies are allowed in those
691 zones. The cost of this is more upstream queries and slower
692 performance. See also the warning about upstream servers in the
693 section on
694 .B --dnssec
695 .TP
696 .B --dnssec-no-timecheck
697 DNSSEC signatures are only valid for specified time windows, and should be rejected outside those windows. This generates an
698 interesting chicken-and-egg problem for machines which don't have a hardware real time clock. For these machines to determine the correct
699 time typically requires use of NTP and therefore DNS, but validating DNS requires that the correct time is already known. Setting this flag
700 removes the time-window checks (but not other DNSSEC validation.) only until the dnsmasq process receives SIGHUP. The intention is
701 that dnsmasq should be started with this flag when the platform determines that reliable time is not currently available. As soon as
702 reliable time is established, a SIGHUP should be sent to dnsmasq, which enables time checking, and purges the cache of DNS records
703 which have not been throughly checked.
704 .TP
705 .B --dnssec-timestamp=<path>
706 Enables an alternative way of checking the validity of the system time for DNSSEC (see --dnssec-no-timecheck). In this case, the
707 system time is considered to be valid once it becomes later than the timestamp on the specified file. The file is created and
708 its timestamp set automatically by dnsmasq. The file must be stored on a persistent filesystem, so that it and its mtime are carried
709 over system restarts. The timestamp file is created after dnsmasq has dropped root, so it must be in a location writable by the
710 unprivileged user that dnsmasq runs as.
711 .TP
712 .B --proxy-dnssec
713 Copy the DNSSEC Authenticated Data bit from upstream servers to downstream clients and cache it. This is an
714 alternative to having dnsmasq validate DNSSEC, but it depends on the security of the network between
715 dnsmasq and the upstream servers, and the trustworthiness of the upstream servers.
716 .TP
717 .B --dnssec-debug
718 Set debugging mode for the DNSSEC validation, set the Checking Disabled bit on upstream queries,
719 and don't convert replies which do not validate to responses with
720 a return code of SERVFAIL. Note that
721 setting this may affect DNS behaviour in bad ways, it is not an
722 extra-logging flag and should not be set in production.
723 .TP
724 .B --auth-zone=<domain>[,<subnet>[/<prefix length>][,<subnet>[/<prefix length>].....]]
725 Define a DNS zone for which dnsmasq acts as authoritative server. Locally defined DNS records which are in the domain
726 will be served. If subnet(s) are given, A and AAAA records must be in one of the
727 specified subnets.
728
729 As alternative to directly specifying the subnets, it's possible to
730 give the name of an interface, in which case the subnets implied by
731 that interface's configured addresses and netmask/prefix-length are
732 used; this is useful when using constructed DHCP ranges as the actual
733 address is dynamic and not known when configuring dnsmasq. The
734 interface addresses may be confined to only IPv6 addresses using
735 <interface>/6 or to only IPv4 using <interface>/4. This is useful when
736 an interface has dynamically determined global IPv6 addresses which should
737 appear in the zone, but RFC1918 IPv4 addresses which should not.
738 Interface-name and address-literal subnet specifications may be used
739 freely in the same --auth-zone declaration.
740
741 The subnet(s) are also used to define in-addr.arpa and
742 ip6.arpa domains which are served for reverse-DNS queries. If not
743 specified, the prefix length defaults to 24 for IPv4 and 64 for IPv6.
744 For IPv4 subnets, the prefix length should be have the value 8, 16 or 24
745 unless you are familiar with RFC 2317 and have arranged the
746 in-addr.arpa delegation accordingly. Note that if no subnets are
747 specified, then no reverse queries are answered.
748 .TP
749 .B --auth-soa=<serial>[,<hostmaster>[,<refresh>[,<retry>[,<expiry>]]]]
750 Specify fields in the SOA record associated with authoritative
751 zones. Note that this is optional, all the values are set to sane defaults.
752 .TP
753 .B --auth-sec-servers=<domain>[,<domain>[,<domain>...]]
754 Specify any secondary servers for a zone for which dnsmasq is
755 authoritative. These servers must be configured to get zone data from
756 dnsmasq by zone transfer, and answer queries for the same
757 authoritative zones as dnsmasq.
758 .TP
759 .B --auth-peer=<ip-address>[,<ip-address>[,<ip-address>...]]
760 Specify the addresses of secondary servers which are allowed to
761 initiate zone transfer (AXFR) requests for zones for which dnsmasq is
762 authoritative. If this option is not given, then AXFR requests will be
763 accepted from any secondary.
764 .TP
765 .B --conntrack
766 Read the Linux connection track mark associated with incoming DNS
767 queries and set the same mark value on upstream traffic used to answer
768 those queries. This allows traffic generated by dnsmasq to be
769 associated with the queries which cause it, useful for bandwidth
770 accounting and firewalling. Dnsmasq must have conntrack support
771 compiled in and the kernel must have conntrack support
772 included and configured. This option cannot be combined with
773 --query-port.
774 .TP
775 .B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-addr>[,<end-addr>][,<mode>][,<netmask>[,<broadcast>]][,<lease time>]
776 .TP
777 .B \-F, --dhcp-range=[tag:<tag>[,tag:<tag>],][set:<tag>,]<start-IPv6addr>[,<end-IPv6addr>|constructor:<interface>][,<mode>][,<prefix-len>][,<lease time>]
778
779 Enable the DHCP server. Addresses will be given out from the range
780 <start-addr> to <end-addr> and from statically defined addresses given
781 in
782 .B dhcp-host
783 options. If the lease time is given, then leases
784 will be given for that length of time. The lease time is in seconds,
785 or minutes (eg 45m) or hours (eg 1h) or "infinite". If not given,
786 the default lease time is one hour. The
787 minimum lease time is two minutes. For IPv6 ranges, the lease time
788 maybe "deprecated"; this sets the preferred lifetime sent in a DHCP
789 lease or router advertisement to zero, which causes clients to use
790 other addresses, if available, for new connections as a prelude to renumbering.
791
792 This option may be repeated, with different addresses, to enable DHCP
793 service to more than one network. For directly connected networks (ie,
794 networks on which the machine running dnsmasq has an interface) the
795 netmask is optional: dnsmasq will determine it from the interface
796 configuration. For networks which receive DHCP service via a relay
797 agent, dnsmasq cannot determine the netmask itself, so it should be
798 specified, otherwise dnsmasq will have to guess, based on the class (A, B or
799 C) of the network address. The broadcast address is
800 always optional. It is always
801 allowed to have more than one dhcp-range in a single subnet.
802
803 For IPv6, the parameters are slightly different: instead of netmask
804 and broadcast address, there is an optional prefix length which must
805 be equal to or larger then the prefix length on the local interface. If not
806 given, this defaults to 64. Unlike the IPv4 case, the prefix length is not
807 automatically derived from the interface configuration. The mimimum
808 size of the prefix length is 64.
809
810 IPv6 (only) supports another type of range. In this, the start address and optional end address contain only the network part (ie ::1) and they are followed by
811 .B constructor:<interface>.
812 This forms a template which describes how to create ranges, based on the addresses assigned to the interface. For instance
813
814 .B --dhcp-range=::1,::400,constructor:eth0
815
816 will look for addresses on
817 eth0 and then create a range from <network>::1 to <network>::400. If
818 the interface is assigned more than one network, then the
819 corresponding ranges will be automatically created, and then
820 deprecated and finally removed again as the address is deprecated and
821 then deleted. The interface name may have a final "*" wildcard. Note
822 that just any address on eth0 will not do: it must not be an
823 autoconfigured or privacy address, or be deprecated.
824
825 If a dhcp-range is only being used for stateless DHCP and/or SLAAC,
826 then the address can be simply ::
827
828 .B --dhcp-range=::,constructor:eth0
829
830
831 The optional
832 .B set:<tag>
833 sets an alphanumeric label which marks this network so that
834 dhcp options may be specified on a per-network basis.
835 When it is prefixed with 'tag:' instead, then its meaning changes from setting
836 a tag to matching it. Only one tag may be set, but more than one tag
837 may be matched.
838
839 The optional <mode> keyword may be
840 .B static
841 which tells dnsmasq to enable DHCP for the network specified, but not
842 to dynamically allocate IP addresses: only hosts which have static
843 addresses given via
844 .B dhcp-host
845 or from /etc/ethers will be served. A static-only subnet with address
846 all zeros may be used as a "catch-all" address to enable replies to all
847 Information-request packets on a subnet which is provided with
848 stateless DHCPv6, ie
849 .B --dhcp-range=::,static
850
851 For IPv4, the <mode> may be
852 .B proxy
853 in which case dnsmasq will provide proxy-DHCP on the specified
854 subnet. (See
855 .B pxe-prompt
856 and
857 .B pxe-service
858 for details.)
859
860 For IPv6, the mode may be some combination of
861 .B ra-only, slaac, ra-names, ra-stateless, ra-advrouter, off-link.
862
863 .B ra-only
864 tells dnsmasq to offer Router Advertisement only on this subnet,
865 and not DHCP.
866
867 .B slaac
868 tells dnsmasq to offer Router Advertisement on this subnet and to set
869 the A bit in the router advertisement, so that the client will use
870 SLAAC addresses. When used with a DHCP range or static DHCP address
871 this results in the client having both a DHCP-assigned and a SLAAC
872 address.
873
874 .B ra-stateless
875 sends router advertisements with the O and A bits set, and provides a
876 stateless DHCP service. The client will use a SLAAC address, and use
877 DHCP for other configuration information.
878
879 .B ra-names
880 enables a mode
881 which gives DNS names to dual-stack hosts which do SLAAC for
882 IPv6. Dnsmasq uses the host's IPv4 lease to derive the name, network
883 segment and MAC address and assumes that the host will also have an
884 IPv6 address calculated using the SLAAC algorithm, on the same network
885 segment. The address is pinged, and if a reply is received, an AAAA
886 record is added to the DNS for this IPv6
887 address. Note that this is only happens for directly-connected
888 networks, (not one doing DHCP via a relay) and it will not work
889 if a host is using privacy extensions.
890 .B ra-names
891 can be combined with
892 .B ra-stateless
893 and
894 .B slaac.
895
896 .B ra-advrouter
897 enables a mode where router address(es) rather than prefix(es) are included in the advertisements.
898 This is described in RFC-3775 section 7.2 and is used in mobile IPv6. In this mode the interval option
899 is also included, as described in RFC-3775 section 7.3.
900
901 .B off-link
902 tells dnsmasq to advertise the prefix without the on-link (aka L) bit set.
903
904 .TP
905 .B \-G, --dhcp-host=[<hwaddr>][,id:<client_id>|*][,set:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]
906 Specify per host parameters for the DHCP server. This allows a machine
907 with a particular hardware address to be always allocated the same
908 hostname, IP address and lease time. A hostname specified like this
909 overrides any supplied by the DHCP client on the machine. It is also
910 allowable to omit the hardware address and include the hostname, in
911 which case the IP address and lease times will apply to any machine
912 claiming that name. For example
913 .B --dhcp-host=00:20:e0:3b:13:af,wap,infinite
914 tells dnsmasq to give
915 the machine with hardware address 00:20:e0:3b:13:af the name wap, and
916 an infinite DHCP lease.
917 .B --dhcp-host=lap,192.168.0.199
918 tells
919 dnsmasq to always allocate the machine lap the IP address
920 192.168.0.199.
921
922 Addresses allocated like this are not constrained to be
923 in the range given by the --dhcp-range option, but they must be in
924 the same subnet as some valid dhcp-range. For
925 subnets which don't need a pool of dynamically allocated addresses,
926 use the "static" keyword in the dhcp-range declaration.
927
928 It is allowed to use client identifiers (called client
929 DUID in IPv6-land rather than
930 hardware addresses to identify hosts by prefixing with 'id:'. Thus:
931 .B --dhcp-host=id:01:02:03:04,.....
932 refers to the host with client identifier 01:02:03:04. It is also
933 allowed to specify the client ID as text, like this:
934 .B --dhcp-host=id:clientidastext,.....
935
936 A single
937 .B dhcp-host
938 may contain an IPv4 address or an IPv6 address, or both. IPv6 addresses must be bracketed by square brackets thus:
939 .B --dhcp-host=laptop,[1234::56]
940 IPv6 addresses may contain only the host-identifier part:
941 .B --dhcp-host=laptop,[::56]
942 in which case they act as wildcards in constructed dhcp ranges, with
943 the appropriate network part inserted.
944 Note that in IPv6 DHCP, the hardware address may not be
945 available, though it normally is for direct-connected clients, or
946 clients using DHCP relays which support RFC 6939.
947
948
949 For DHCPv4, the special option id:* means "ignore any client-id
950 and use MAC addresses only." This is useful when a client presents a client-id sometimes
951 but not others.
952
953 If a name appears in /etc/hosts, the associated address can be
954 allocated to a DHCP lease, but only if a
955 .B --dhcp-host
956 option specifying the name also exists. Only one hostname can be
957 given in a
958 .B dhcp-host
959 option, but aliases are possible by using CNAMEs. (See
960 .B --cname
961 ).
962
963 The special keyword "ignore"
964 tells dnsmasq to never offer a DHCP lease to a machine. The machine
965 can be specified by hardware address, client ID or hostname, for
966 instance
967 .B --dhcp-host=00:20:e0:3b:13:af,ignore
968 This is
969 useful when there is another DHCP server on the network which should
970 be used by some machines.
971
972 The set:<tag> construct sets the tag
973 whenever this dhcp-host directive is in use. This can be used to
974 selectively send DHCP options just for this host. More than one tag
975 can be set in a dhcp-host directive (but not in other places where
976 "set:<tag>" is allowed). When a host matches any
977 dhcp-host directive (or one implied by /etc/ethers) then the special
978 tag "known" is set. This allows dnsmasq to be configured to
979 ignore requests from unknown machines using
980 .B --dhcp-ignore=tag:!known
981 Ethernet addresses (but not client-ids) may have
982 wildcard bytes, so for example
983 .B --dhcp-host=00:20:e0:3b:13:*,ignore
984 will cause dnsmasq to ignore a range of hardware addresses. Note that
985 the "*" will need to be escaped or quoted on a command line, but not
986 in the configuration file.
987
988 Hardware addresses normally match any
989 network (ARP) type, but it is possible to restrict them to a single
990 ARP type by preceding them with the ARP-type (in HEX) and "-". so
991 .B --dhcp-host=06-00:20:e0:3b:13:af,1.2.3.4
992 will only match a
993 Token-Ring hardware address, since the ARP-address type for token ring
994 is 6.
995
996 As a special case, in DHCPv4, it is possible to include more than one
997 hardware address. eg:
998 .B --dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
999 This allows an IP address to be associated with
1000 multiple hardware addresses, and gives dnsmasq permission to abandon a
1001 DHCP lease to one of the hardware addresses when another one asks for
1002 a lease. Beware that this is a dangerous thing to do, it will only
1003 work reliably if only one of the hardware addresses is active at any
1004 time and there is no way for dnsmasq to enforce this. It is, for instance,
1005 useful to allocate a stable IP address to a laptop which
1006 has both wired and wireless interfaces.
1007 .TP
1008 .B --dhcp-hostsfile=<path>
1009 Read DHCP host information from the specified file. If a directory
1010 is given, then read all the files contained in that directory. The file contains
1011 information about one host per line. The format of a line is the same
1012 as text to the right of '=' in --dhcp-host. The advantage of storing DHCP host information
1013 in this file is that it can be changed without re-starting dnsmasq:
1014 the file will be re-read when dnsmasq receives SIGHUP.
1015 .TP
1016 .B --dhcp-optsfile=<path>
1017 Read DHCP option information from the specified file. If a directory
1018 is given, then read all the files contained in that directory. The advantage of
1019 using this option is the same as for --dhcp-hostsfile: the
1020 dhcp-optsfile will be re-read when dnsmasq receives SIGHUP. Note that
1021 it is possible to encode the information in a
1022 .TP
1023 .B --dhcp-hostsdir=<path>
1024 This is equivalent to dhcp-hostsfile, except for the following. The path MUST be a
1025 directory, and not an individual file. Changed or new files within
1026 the directory are read automatically, without the need to send SIGHUP.
1027 If a file is deleted for changed after it has been read by dnsmasq, then the
1028 host record it contained will remain until dnsmasq recieves a SIGHUP, or
1029 is restarted; ie host records are only added dynamically.
1030 .TP
1031 .B --dhcp-optsdir=<path>
1032 This is equivalent to dhcp-optsfile, with the differences noted for --dhcp-hostsdir.
1033 .TP
1034 .B --dhcp-boot
1035 flag as DHCP options, using the options names bootfile-name,
1036 server-ip-address and tftp-server. This allows these to be included
1037 in a dhcp-optsfile.
1038 .TP
1039 .B \-Z, --read-ethers
1040 Read /etc/ethers for information about hosts for the DHCP server. The
1041 format of /etc/ethers is a hardware address, followed by either a
1042 hostname or dotted-quad IP address. When read by dnsmasq these lines
1043 have exactly the same effect as
1044 .B --dhcp-host
1045 options containing the same information. /etc/ethers is re-read when
1046 dnsmasq receives SIGHUP. IPv6 addresses are NOT read from /etc/ethers.
1047 .TP
1048 .B \-O, --dhcp-option=[tag:<tag>,[tag:<tag>,]][encap:<opt>,][vi-encap:<enterprise>,][vendor:[<vendor-class>],][<opt>|option:<opt-name>|option6:<opt>|option6:<opt-name>],[<value>[,<value>]]
1049 Specify different or extra options to DHCP clients. By default,
1050 dnsmasq sends some standard options to DHCP clients, the netmask and
1051 broadcast address are set to the same as the host running dnsmasq, and
1052 the DNS server and default route are set to the address of the machine
1053 running dnsmasq. (Equivalent rules apply for IPv6.) If the domain name option has been set, that is sent.
1054 This configuration allows these defaults to be overridden,
1055 or other options specified. The option, to be sent may be given as a
1056 decimal number or as "option:<option-name>" The option numbers are
1057 specified in RFC2132 and subsequent RFCs. The set of option-names
1058 known by dnsmasq can be discovered by running "dnsmasq --help dhcp".
1059 For example, to set the default route option to
1060 192.168.4.4, do
1061 .B --dhcp-option=3,192.168.4.4
1062 or
1063 .B --dhcp-option = option:router, 192.168.4.4
1064 and to set the time-server address to 192.168.0.4, do
1065 .B --dhcp-option = 42,192.168.0.4
1066 or
1067 .B --dhcp-option = option:ntp-server, 192.168.0.4
1068 The special address 0.0.0.0 is taken to mean "the address of the
1069 machine running dnsmasq".
1070
1071 Data types allowed are comma separated
1072 dotted-quad IPv4 addresses, []-wrapped IPv6 addresses, a decimal number, colon-separated hex digits
1073 and a text string. If the optional tags are given then
1074 this option is only sent when all the tags are matched.
1075
1076 Special processing is done on a text argument for option 119, to
1077 conform with RFC 3397. Text or dotted-quad IP addresses as arguments
1078 to option 120 are handled as per RFC 3361. Dotted-quad IP addresses
1079 which are followed by a slash and then a netmask size are encoded as
1080 described in RFC 3442.
1081
1082 IPv6 options are specified using the
1083 .B option6:
1084 keyword, followed by the option number or option name. The IPv6 option
1085 name space is disjoint from the IPv4 option name space. IPv6 addresses
1086 in options must be bracketed with square brackets, eg.
1087 .B --dhcp-option=option6:ntp-server,[1234::56]
1088 For IPv6, [::] means "the global address of
1089 the machine running dnsmasq", whilst [fd00::] is replaced with the
1090 ULA, if it exists, and [fe80::] with the link-local address.
1091
1092 Be careful: no checking is done that the correct type of data for the
1093 option number is sent, it is quite possible to
1094 persuade dnsmasq to generate illegal DHCP packets with injudicious use
1095 of this flag. When the value is a decimal number, dnsmasq must determine how
1096 large the data item is. It does this by examining the option number and/or the
1097 value, but can be overridden by appending a single letter flag as follows:
1098 b = one byte, s = two bytes, i = four bytes. This is mainly useful with
1099 encapsulated vendor class options (see below) where dnsmasq cannot
1100 determine data size from the option number. Option data which
1101 consists solely of periods and digits will be interpreted by dnsmasq
1102 as an IP address, and inserted into an option as such. To force a
1103 literal string, use quotes. For instance when using option 66 to send
1104 a literal IP address as TFTP server name, it is necessary to do
1105 .B --dhcp-option=66,"1.2.3.4"
1106
1107 Encapsulated Vendor-class options may also be specified (IPv4 only) using
1108 --dhcp-option: for instance
1109 .B --dhcp-option=vendor:PXEClient,1,0.0.0.0
1110 sends the encapsulated vendor
1111 class-specific option "mftp-address=0.0.0.0" to any client whose
1112 vendor-class matches "PXEClient". The vendor-class matching is
1113 substring based (see --dhcp-vendorclass for details). If a
1114 vendor-class option (number 60) is sent by dnsmasq, then that is used
1115 for selecting encapsulated options in preference to any sent by the
1116 client. It is
1117 possible to omit the vendorclass completely;
1118 .B --dhcp-option=vendor:,1,0.0.0.0
1119 in which case the encapsulated option is always sent.
1120
1121 Options may be encapsulated (IPv4 only) within other options: for instance
1122 .B --dhcp-option=encap:175, 190, "iscsi-client0"
1123 will send option 175, within which is the option 190. If multiple
1124 options are given which are encapsulated with the same option number
1125 then they will be correctly combined into one encapsulated option.
1126 encap: and vendor: are may not both be set in the same dhcp-option.
1127
1128 The final variant on encapsulated options is "Vendor-Identifying
1129 Vendor Options" as specified by RFC3925. These are denoted like this:
1130 .B --dhcp-option=vi-encap:2, 10, "text"
1131 The number in the vi-encap: section is the IANA enterprise number
1132 used to identify this option. This form of encapsulation is supported
1133 in IPv6.
1134
1135 The address 0.0.0.0 is not treated specially in
1136 encapsulated options.
1137 .TP
1138 .B --dhcp-option-force=[tag:<tag>,[tag:<tag>,]][encap:<opt>,][vi-encap:<enterprise>,][vendor:[<vendor-class>],]<opt>,[<value>[,<value>]]
1139 This works in exactly the same way as
1140 .B --dhcp-option
1141 except that the option will always be sent, even if the client does
1142 not ask for it in the parameter request list. This is sometimes
1143 needed, for example when sending options to PXELinux.
1144 .TP
1145 .B --dhcp-no-override
1146 (IPv4 only) Disable re-use of the DHCP servername and filename fields as extra
1147 option space. If it can, dnsmasq moves the boot server and filename
1148 information (from dhcp-boot) out of their dedicated fields into
1149 DHCP options. This make extra space available in the DHCP packet for
1150 options but can, rarely, confuse old or broken clients. This flag
1151 forces "simple and safe" behaviour to avoid problems in such a case.
1152 .TP
1153 .B --dhcp-relay=<local address>,<server address>[,<interface]
1154 Configure dnsmasq to do DHCP relay. The local address is an address
1155 allocated to an interface on the host running dnsmasq. All DHCP
1156 requests arriving on that interface will we relayed to a remote DHCP
1157 server at the server address. It is possible to relay from a single local
1158 address to multiple remote servers by using multiple dhcp-relay
1159 configs with the same local address and different server
1160 addresses. A server address must be an IP literal address, not a
1161 domain name. In the case of DHCPv6, the server address may be the
1162 ALL_SERVERS multicast address, ff05::1:3. In this case the interface
1163 must be given, not be wildcard, and is used to direct the multicast to the
1164 correct interface to reach the DHCP server.
1165
1166 Access control for DHCP clients has the same rules as for the DHCP
1167 server, see --interface, --except-interface, etc. The optional
1168 interface name in the dhcp-relay config has a different function: it
1169 controls on which interface DHCP replies from the server will be
1170 accepted. This is intended for configurations which have three
1171 interfaces: one being relayed from, a second connecting the DHCP
1172 server, and a third untrusted network, typically the wider
1173 internet. It avoids the possibility of spoof replies arriving via this
1174 third interface.
1175
1176 It is allowed to have dnsmasq act as a DHCP server on one set of
1177 interfaces and relay from a disjoint set of interfaces. Note that
1178 whilst it is quite possible to write configurations which appear to
1179 act as a server and a relay on the same interface, this is not
1180 supported: the relay function will take precedence.
1181
1182 Both DHCPv4 and DHCPv6 relay is supported. It's not possible to relay
1183 DHCPv4 to a DHCPv6 server or vice-versa.
1184 .TP
1185 .B \-U, --dhcp-vendorclass=set:<tag>,[enterprise:<IANA-enterprise number>,]<vendor-class>
1186 Map from a vendor-class string to a tag. Most DHCP clients provide a
1187 "vendor class" which represents, in some sense, the type of host. This option
1188 maps vendor classes to tags, so that DHCP options may be selectively delivered
1189 to different classes of hosts. For example
1190 .B dhcp-vendorclass=set:printers,Hewlett-Packard JetDirect
1191 will allow options to be set only for HP printers like so:
1192 .B --dhcp-option=tag:printers,3,192.168.4.4
1193 The vendor-class string is
1194 substring matched against the vendor-class supplied by the client, to
1195 allow fuzzy matching. The set: prefix is optional but allowed for
1196 consistency.
1197
1198 Note that in IPv6 only, vendorclasses are namespaced with an
1199 IANA-allocated enterprise number. This is given with enterprise:
1200 keyword and specifies that only vendorclasses matching the specified
1201 number should be searched.
1202 .TP
1203 .B \-j, --dhcp-userclass=set:<tag>,<user-class>
1204 Map from a user-class string to a tag (with substring
1205 matching, like vendor classes). Most DHCP clients provide a
1206 "user class" which is configurable. This option
1207 maps user classes to tags, so that DHCP options may be selectively delivered
1208 to different classes of hosts. It is possible, for instance to use
1209 this to set a different printer server for hosts in the class
1210 "accounts" than for hosts in the class "engineering".
1211 .TP
1212 .B \-4, --dhcp-mac=set:<tag>,<MAC address>
1213 Map from a MAC address to a tag. The MAC address may include
1214 wildcards. For example
1215 .B --dhcp-mac=set:3com,01:34:23:*:*:*
1216 will set the tag "3com" for any host whose MAC address matches the pattern.
1217 .TP
1218 .B --dhcp-circuitid=set:<tag>,<circuit-id>, --dhcp-remoteid=set:<tag>,<remote-id>
1219 Map from RFC3046 relay agent options to tags. This data may
1220 be provided by DHCP relay agents. The circuit-id or remote-id is
1221 normally given as colon-separated hex, but is also allowed to be a
1222 simple string. If an exact match is achieved between the circuit or
1223 agent ID and one provided by a relay agent, the tag is set.
1224
1225 .B dhcp-remoteid
1226 (but not dhcp-circuitid) is supported in IPv6.
1227 .TP
1228 .B --dhcp-subscrid=set:<tag>,<subscriber-id>
1229 (IPv4 and IPv6) Map from RFC3993 subscriber-id relay agent options to tags.
1230 .TP
1231 .B --dhcp-proxy[=<ip addr>]......
1232 (IPv4 only) A normal DHCP relay agent is only used to forward the initial parts of
1233 a DHCP interaction to the DHCP server. Once a client is configured, it
1234 communicates directly with the server. This is undesirable if the
1235 relay agent is adding extra information to the DHCP packets, such as
1236 that used by
1237 .B dhcp-circuitid
1238 and
1239 .B dhcp-remoteid.
1240 A full relay implementation can use the RFC 5107 serverid-override
1241 option to force the DHCP server to use the relay as a full proxy, with all
1242 packets passing through it. This flag provides an alternative method
1243 of doing the same thing, for relays which don't support RFC
1244 5107. Given alone, it manipulates the server-id for all interactions
1245 via relays. If a list of IP addresses is given, only interactions via
1246 relays at those addresses are affected.
1247 .TP
1248 .B --dhcp-match=set:<tag>,<option number>|option:<option name>|vi-encap:<enterprise>[,<value>]
1249 Without a value, set the tag if the client sends a DHCP
1250 option of the given number or name. When a value is given, set the tag only if
1251 the option is sent and matches the value. The value may be of the form
1252 "01:ff:*:02" in which case the value must match (apart from wildcards)
1253 but the option sent may have unmatched data past the end of the
1254 value. The value may also be of the same form as in
1255 .B dhcp-option
1256 in which case the option sent is treated as an array, and one element
1257 must match, so
1258
1259 --dhcp-match=set:efi-ia32,option:client-arch,6
1260
1261 will set the tag "efi-ia32" if the the number 6 appears in the list of
1262 architectures sent by the client in option 93. (See RFC 4578 for
1263 details.) If the value is a string, substring matching is used.
1264
1265 The special form with vi-encap:<enterprise number> matches against
1266 vendor-identifying vendor classes for the specified enterprise. Please
1267 see RFC 3925 for more details of these rare and interesting beasts.
1268 .TP
1269 .B --tag-if=set:<tag>[,set:<tag>[,tag:<tag>[,tag:<tag>]]]
1270 Perform boolean operations on tags. Any tag appearing as set:<tag> is set if
1271 all the tags which appear as tag:<tag> are set, (or unset when tag:!<tag> is used)
1272 If no tag:<tag> appears set:<tag> tags are set unconditionally.
1273 Any number of set: and tag: forms may appear, in any order.
1274 Tag-if lines ares executed in order, so if the tag in tag:<tag> is a
1275 tag set by another
1276 .B tag-if,
1277 the line which sets the tag must precede the one which tests it.
1278 .TP
1279 .B \-J, --dhcp-ignore=tag:<tag>[,tag:<tag>]
1280 When all the given tags appear in the tag set ignore the host and do
1281 not allocate it a DHCP lease.
1282 .TP
1283 .B --dhcp-ignore-names[=tag:<tag>[,tag:<tag>]]
1284 When all the given tags appear in the tag set, ignore any hostname
1285 provided by the host. Note that, unlike dhcp-ignore, it is permissible
1286 to supply no tags, in which case DHCP-client supplied hostnames
1287 are always ignored, and DHCP hosts are added to the DNS using only
1288 dhcp-host configuration in dnsmasq and the contents of /etc/hosts and
1289 /etc/ethers.
1290 .TP
1291 .B --dhcp-generate-names=tag:<tag>[,tag:<tag>]
1292 (IPv4 only) Generate a name for DHCP clients which do not otherwise have one,
1293 using the MAC address expressed in hex, separated by dashes. Note that
1294 if a host provides a name, it will be used by preference to this,
1295 unless
1296 .B --dhcp-ignore-names
1297 is set.
1298 .TP
1299 .B --dhcp-broadcast[=tag:<tag>[,tag:<tag>]]
1300 (IPv4 only) When all the given tags appear in the tag set, always use broadcast to
1301 communicate with the host when it is unconfigured. It is permissible
1302 to supply no tags, in which case this is unconditional. Most DHCP clients which
1303 need broadcast replies set a flag in their requests so that this
1304 happens automatically, some old BOOTP clients do not.
1305 .TP
1306 .B \-M, --dhcp-boot=[tag:<tag>,]<filename>,[<servername>[,<server address>|<tftp_servername>]]
1307 (IPv4 only) Set BOOTP options to be returned by the DHCP server. Server name and
1308 address are optional: if not provided, the name is left empty, and the
1309 address set to the address of the machine running dnsmasq. If dnsmasq
1310 is providing a TFTP service (see
1311 .B --enable-tftp
1312 ) then only the filename is required here to enable network booting.
1313 If the optional tag(s) are given,
1314 they must match for this configuration to be sent.
1315 Instead of an IP address, the TFTP server address can be given as a domain
1316 name which is looked up in /etc/hosts. This name can be associated in
1317 /etc/hosts with multiple IP addresses, which are used round-robin.
1318 This facility can be used to load balance the tftp load among a set of servers.
1319 .TP
1320 .B --dhcp-sequential-ip
1321 Dnsmasq is designed to choose IP addresses for DHCP clients using a
1322 hash of the client's MAC address. This normally allows a client's
1323 address to remain stable long-term, even if the client sometimes allows its DHCP
1324 lease to expire. In this default mode IP addresses are distributed
1325 pseudo-randomly over the entire available address range. There are
1326 sometimes circumstances (typically server deployment) where it is more
1327 convenient to have IP
1328 addresses allocated sequentially, starting from the lowest available
1329 address, and setting this flag enables this mode. Note that in the
1330 sequential mode, clients which allow a lease to expire are much more
1331 likely to move IP address; for this reason it should not be generally used.
1332 .TP
1333 .B --pxe-service=[tag:<tag>,]<CSA>,<menu text>[,<basename>|<bootservicetype>][,<server address>|<server_name>]
1334 Most uses of PXE boot-ROMS simply allow the PXE
1335 system to obtain an IP address and then download the file specified by
1336 .B dhcp-boot
1337 and execute it. However the PXE system is capable of more complex
1338 functions when supported by a suitable DHCP server.
1339
1340 This specifies a boot option which may appear in a PXE boot menu. <CSA> is
1341 client system type, only services of the correct type will appear in a
1342 menu. The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86,
1343 Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI; an
1344 integer may be used for other types. The
1345 parameter after the menu text may be a file name, in which case dnsmasq acts as a
1346 boot server and directs the PXE client to download the file by TFTP,
1347 either from itself (
1348 .B enable-tftp
1349 must be set for this to work) or another TFTP server if the final server
1350 address/name is given.
1351 Note that the "layer"
1352 suffix (normally ".0") is supplied by PXE, and should not be added to
1353 the basename. If an integer boot service type, rather than a basename
1354 is given, then the PXE client will search for a
1355 suitable boot service for that type on the network. This search may be done
1356 by broadcast, or direct to a server if its IP address/name is provided.
1357 If no boot service type or filename is provided (or a boot service type of 0 is specified)
1358 then the menu entry will abort the net boot procedure and
1359 continue booting from local media. The server address can be given as a domain
1360 name which is looked up in /etc/hosts. This name can be associated in
1361 /etc/hosts with multiple IP addresses, which are used round-robin.
1362 .TP
1363 .B --pxe-prompt=[tag:<tag>,]<prompt>[,<timeout>]
1364 Setting this provides a prompt to be displayed after PXE boot. If the
1365 timeout is given then after the
1366 timeout has elapsed with no keyboard input, the first available menu
1367 option will be automatically executed. If the timeout is zero then the first available menu
1368 item will be executed immediately. If
1369 .B pxe-prompt
1370 is omitted the system will wait for user input if there are multiple
1371 items in the menu, but boot immediately if
1372 there is only one. See
1373 .B pxe-service
1374 for details of menu items.
1375
1376 Dnsmasq supports PXE "proxy-DHCP", in this case another DHCP server on
1377 the network is responsible for allocating IP addresses, and dnsmasq
1378 simply provides the information given in
1379 .B pxe-prompt
1380 and
1381 .B pxe-service
1382 to allow netbooting. This mode is enabled using the
1383 .B proxy
1384 keyword in
1385 .B dhcp-range.
1386 .TP
1387 .B \-X, --dhcp-lease-max=<number>
1388 Limits dnsmasq to the specified maximum number of DHCP leases. The
1389 default is 1000. This limit is to prevent DoS attacks from hosts which
1390 create thousands of leases and use lots of memory in the dnsmasq
1391 process.
1392 .TP
1393 .B \-K, --dhcp-authoritative
1394 Should be set when dnsmasq is definitely the only DHCP server on a network.
1395 For DHCPv4, it changes the behaviour from strict RFC compliance so that DHCP requests on
1396 unknown leases from unknown hosts are not ignored. This allows new hosts
1397 to get a lease without a tedious timeout under all circumstances. It also
1398 allows dnsmasq to rebuild its lease database without each client needing to
1399 reacquire a lease, if the database is lost. For DHCPv6 it sets the
1400 priority in replies to 255 (the maximum) instead of 0 (the minimum).
1401 .TP
1402 .B --dhcp-alternate-port[=<server port>[,<client port>]]
1403 (IPv4 only) Change the ports used for DHCP from the default. If this option is
1404 given alone, without arguments, it changes the ports used for DHCP
1405 from 67 and 68 to 1067 and 1068. If a single argument is given, that
1406 port number is used for the server and the port number plus one used
1407 for the client. Finally, two port numbers allows arbitrary
1408 specification of both server and client ports for DHCP.
1409 .TP
1410 .B \-3, --bootp-dynamic[=<network-id>[,<network-id>]]
1411 (IPv4 only) Enable dynamic allocation of IP addresses to BOOTP clients. Use this
1412 with care, since each address allocated to a BOOTP client is leased
1413 forever, and therefore becomes permanently unavailable for re-use by
1414 other hosts. if this is given without tags, then it unconditionally
1415 enables dynamic allocation. With tags, only when the tags are all
1416 set. It may be repeated with different tag sets.
1417 .TP
1418 .B \-5, --no-ping
1419 (IPv4 only) By default, the DHCP server will attempt to ensure that an address is
1420 not in use before allocating it to a host. It does this by sending an
1421 ICMP echo request (aka "ping") to the address in question. If it gets
1422 a reply, then the address must already be in use, and another is
1423 tried. This flag disables this check. Use with caution.
1424 .TP
1425 .B --log-dhcp
1426 Extra logging for DHCP: log all the options sent to DHCP clients and
1427 the tags used to determine them.
1428 .TP
1429 .B --quiet-dhcp, --quiet-dhcp6, --quiet-ra
1430 Suppress logging of the routine operation of these protocols. Errors and
1431 problems will still be logged. --quiet-dhcp and quiet-dhcp6 are
1432 over-ridden by --log-dhcp.
1433 .TP
1434 .B \-l, --dhcp-leasefile=<path>
1435 Use the specified file to store DHCP lease information.
1436 .TP
1437 .B --dhcp-duid=<enterprise-id>,<uid>
1438 (IPv6 only) Specify the server persistent UID which the DHCPv6 server
1439 will use. This option is not normally required as dnsmasq creates a
1440 DUID automatically when it is first needed. When given, this option
1441 provides dnsmasq the data required to create a DUID-EN type DUID. Note
1442 that once set, the DUID is stored in the lease database, so to change between DUID-EN and
1443 automatically created DUIDs or vice-versa, the lease database must be
1444 re-intialised. The enterprise-id is assigned by IANA, and the uid is a
1445 string of hex octets unique to a particular device.
1446 .TP
1447 .B \-6 --dhcp-script=<path>
1448 Whenever a new DHCP lease is created, or an old one destroyed, or a
1449 TFTP file transfer completes, the
1450 executable specified by this option is run. <path>
1451 must be an absolute pathname, no PATH search occurs.
1452 The arguments to the process
1453 are "add", "old" or "del", the MAC
1454 address of the host (or DUID for IPv6) , the IP address, and the hostname,
1455 if known. "add" means a lease has been created, "del" means it has
1456 been destroyed, "old" is a notification of an existing lease when
1457 dnsmasq starts or a change to MAC address or hostname of an existing
1458 lease (also, lease length or expiry and client-id, if leasefile-ro is set).
1459 If the MAC address is from a network type other than ethernet,
1460 it will have the network type prepended, eg "06-01:23:45:67:89:ab" for
1461 token ring. The process is run as root (assuming that dnsmasq was originally run as
1462 root) even if dnsmasq is configured to change UID to an unprivileged user.
1463
1464 The environment is inherited from the invoker of dnsmasq, with some or
1465 all of the following variables added
1466
1467 For both IPv4 and IPv6:
1468
1469 DNSMASQ_DOMAIN if the fully-qualified domain name of the host is
1470 known, this is set to the domain part. (Note that the hostname passed
1471 to the script as an argument is never fully-qualified.)
1472
1473 If the client provides a hostname, DNSMASQ_SUPPLIED_HOSTNAME
1474
1475 If the client provides user-classes, DNSMASQ_USER_CLASS0..DNSMASQ_USER_CLASSn
1476
1477 If dnsmasq was compiled with HAVE_BROKEN_RTC, then
1478 the length of the lease (in seconds) is stored in
1479 DNSMASQ_LEASE_LENGTH, otherwise the time of lease expiry is stored in
1480 DNSMASQ_LEASE_EXPIRES. The number of seconds until lease expiry is
1481 always stored in DNSMASQ_TIME_REMAINING.
1482
1483 If a lease used to have a hostname, which is
1484 removed, an "old" event is generated with the new state of the lease,
1485 ie no name, and the former name is provided in the environment
1486 variable DNSMASQ_OLD_HOSTNAME.
1487
1488 DNSMASQ_INTERFACE stores the name of
1489 the interface on which the request arrived; this is not set for "old"
1490 actions when dnsmasq restarts.
1491
1492 DNSMASQ_RELAY_ADDRESS is set if the client
1493 used a DHCP relay to contact dnsmasq and the IP address of the relay
1494 is known.
1495
1496 DNSMASQ_TAGS contains all the tags set during the
1497 DHCP transaction, separated by spaces.
1498
1499 DNSMASQ_LOG_DHCP is set if
1500 .B --log-dhcp
1501 is in effect.
1502
1503 For IPv4 only:
1504
1505 DNSMASQ_CLIENT_ID if the host provided a client-id.
1506
1507 DNSMASQ_CIRCUIT_ID, DNSMASQ_SUBSCRIBER_ID, DNSMASQ_REMOTE_ID if a
1508 DHCP relay-agent added any of these options.
1509
1510 If the client provides vendor-class, DNSMASQ_VENDOR_CLASS.
1511
1512 For IPv6 only:
1513
1514 If the client provides vendor-class, DNSMASQ_VENDOR_CLASS_ID,
1515 containing the IANA enterprise id for the class, and
1516 DNSMASQ_VENDOR_CLASS0..DNSMASQ_VENDOR_CLASSn for the data.
1517
1518 DNSMASQ_SERVER_DUID containing the DUID of the server: this is the same for
1519 every call to the script.
1520
1521 DNSMASQ_IAID containing the IAID for the lease. If the lease is a
1522 temporary allocation, this is prefixed to 'T'.
1523
1524 DNSMASQ_MAC containing the MAC address of the client, if known.
1525
1526 Note that the supplied hostname, vendorclass and userclass data is
1527 only supplied for
1528 "add" actions or "old" actions when a host resumes an existing lease,
1529 since these data are not held in dnsmasq's lease
1530 database.
1531
1532
1533
1534 All file descriptors are
1535 closed except stdin, stdout and stderr which are open to /dev/null
1536 (except in debug mode).
1537
1538 The script is not invoked concurrently: at most one instance
1539 of the script is ever running (dnsmasq waits for an instance of script to exit
1540 before running the next). Changes to the lease database are which
1541 require the script to be invoked are queued awaiting exit of a running instance.
1542 If this queueing allows multiple state changes occur to a single
1543 lease before the script can be run then
1544 earlier states are discarded and the current state of that lease is
1545 reflected when the script finally runs.
1546
1547 At dnsmasq startup, the script will be invoked for
1548 all existing leases as they are read from the lease file. Expired
1549 leases will be called with "del" and others with "old". When dnsmasq
1550 receives a HUP signal, the script will be invoked for existing leases
1551 with an "old" event.
1552
1553
1554 There are four further actions which may appear as the first argument
1555 to the script, "init", "arp", "arp-old" and "tftp". More may be added in the future, so
1556 scripts should be written to ignore unknown actions. "init" is
1557 described below in
1558 .B --leasefile-ro
1559 The "tftp" action is invoked when a TFTP file transfer completes: the
1560 arguments are the file size in bytes, the address to which the file
1561 was sent, and the complete pathname of the file.
1562
1563 The "arp" and "arp-old" actions are only called if enabled with
1564 .B --script-arp
1565 They are are supplied with a MAC address and IP address as arguments. "arp" indicates
1566 the arrival of a new entry in the ARP or neighbour table, and arp-old indicates the deletion of same.
1567
1568 .TP
1569 .B --dhcp-luascript=<path>
1570 Specify a script written in Lua, to be run when leases are created,
1571 destroyed or changed. To use this option, dnsmasq must be compiled
1572 with the correct support. The Lua interpreter is intialised once, when
1573 dnsmasq starts, so that global variables persist between lease
1574 events. The Lua code must define a
1575 .B lease
1576 function, and may provide
1577 .B init
1578 and
1579 .B shutdown
1580 functions, which are called, without arguments when dnsmasq starts up
1581 and terminates. It may also provide a
1582 .B tftp
1583 function.
1584
1585 The
1586 .B lease
1587 function receives the information detailed in
1588 .B --dhcp-script.
1589 It gets two arguments, firstly the action, which is a string
1590 containing, "add", "old" or "del", and secondly a table of tag value
1591 pairs. The tags mostly correspond to the environment variables
1592 detailed above, for instance the tag "domain" holds the same data as
1593 the environment variable DNSMASQ_DOMAIN. There are a few extra tags
1594 which hold the data supplied as arguments to
1595 .B --dhcp-script.
1596 These are
1597 .B mac_address, ip_address
1598 and
1599 .B hostname
1600 for IPv4, and
1601 .B client_duid, ip_address
1602 and
1603 .B hostname
1604 for IPv6.
1605
1606 The
1607 .B tftp
1608 function is called in the same way as the lease function, and the
1609 table holds the tags
1610 .B destination_address,
1611 .B file_name
1612 and
1613 .B file_size.
1614
1615 The
1616 .B arp
1617 and
1618 .B arp-old
1619 functions are called only when enabled with
1620 .B --script-arp
1621 and have a table which holds the tags
1622 .B mac_addres
1623 and
1624 .B client_address.
1625 .TP
1626 .B --dhcp-scriptuser
1627 Specify the user as which to run the lease-change script or Lua script. This defaults to root, but can be changed to another user using this flag.
1628 .TP
1629 .B --script-arp
1630 Enable the "arp" and "arp-old" functions in the dhcp-script and dhcp-luascript.
1631 .TP
1632 .B \-9, --leasefile-ro
1633 Completely suppress use of the lease database file. The file will not
1634 be created, read, or written. Change the way the lease-change
1635 script (if one is provided) is called, so that the lease database may
1636 be maintained in external storage by the script. In addition to the
1637 invocations given in
1638 .B --dhcp-script
1639 the lease-change script is called once, at dnsmasq startup, with the
1640 single argument "init". When called like this the script should write
1641 the saved state of the lease database, in dnsmasq leasefile format, to
1642 stdout and exit with zero exit code. Setting this
1643 option also forces the leasechange script to be called on changes
1644 to the client-id and lease length and expiry time.
1645 .TP
1646 .B --bridge-interface=<interface>,<alias>[,<alias>]
1647 Treat DHCP (v4 and v6) request and IPv6 Router Solicit packets
1648 arriving at any of the <alias> interfaces as if they had arrived at
1649 <interface>. This option allows dnsmasq to provide DHCP and RA
1650 service over unaddressed and unbridged Ethernet interfaces, e.g. on an
1651 OpenStack compute host where each such interface is a TAP interface to
1652 a VM, or as in "old style bridging" on BSD platforms. A trailing '*'
1653 wildcard can be used in each <alias>.
1654 .TP
1655 .B \-s, --domain=<domain>[,<address range>[,local]]
1656 Specifies DNS domains for the DHCP server. Domains may be be given
1657 unconditionally (without the IP range) or for limited IP ranges. This has two effects;
1658 firstly it causes the DHCP server to return the domain to any hosts
1659 which request it, and secondly it sets the domain which it is legal
1660 for DHCP-configured hosts to claim. The intention is to constrain
1661 hostnames so that an untrusted host on the LAN cannot advertise
1662 its name via dhcp as e.g. "microsoft.com" and capture traffic not
1663 meant for it. If no domain suffix is specified, then any DHCP
1664 hostname with a domain part (ie with a period) will be disallowed
1665 and logged. If suffix is specified, then hostnames with a domain
1666 part are allowed, provided the domain part matches the suffix. In
1667 addition, when a suffix is set then hostnames without a domain
1668 part have the suffix added as an optional domain part. Eg on my network I can set
1669 .B --domain=thekelleys.org.uk
1670 and have a machine whose DHCP hostname is "laptop". The IP address for that machine is available from
1671 .B dnsmasq
1672 both as "laptop" and "laptop.thekelleys.org.uk". If the domain is
1673 given as "#" then the domain is read from the first "search" directive
1674 in /etc/resolv.conf (or equivalent).
1675
1676 The address range can be of the form
1677 <ip address>,<ip address> or <ip address>/<netmask> or just a single
1678 <ip address>. See
1679 .B --dhcp-fqdn
1680 which can change the behaviour of dnsmasq with domains.
1681
1682 If the address range is given as ip-address/network-size, then a
1683 additional flag "local" may be supplied which has the effect of adding
1684 --local declarations for forward and reverse DNS queries. Eg.
1685 .B --domain=thekelleys.org.uk,192.168.0.0/24,local
1686 is identical to
1687 .B --domain=thekelleys.org.uk,192.168.0.0/24
1688 --local=/thekelleys.org.uk/ --local=/0.168.192.in-addr.arpa/
1689 The network size must be 8, 16 or 24 for this to be legal.
1690 .TP
1691 .B --dhcp-fqdn
1692 In the default mode, dnsmasq inserts the unqualified names of
1693 DHCP clients into the DNS. For this reason, the names must be unique,
1694 even if two clients which have the same name are in different
1695 domains. If a second DHCP client appears which has the same name as an
1696 existing client, the name is transferred to the new client. If
1697 .B --dhcp-fqdn
1698 is set, this behaviour changes: the unqualified name is no longer
1699 put in the DNS, only the qualified name. Two DHCP clients with the
1700 same name may both keep the name, provided that the domain part is
1701 different (ie the fully qualified names differ.) To ensure that all
1702 names have a domain part, there must be at least
1703 .B --domain
1704 without an address specified when
1705 .B --dhcp-fqdn
1706 is set.
1707 .TP
1708 .B --dhcp-client-update
1709 Normally, when giving a DHCP lease, dnsmasq sets flags in the FQDN
1710 option to tell the client not to attempt a DDNS update with its name
1711 and IP address. This is because the name-IP pair is automatically
1712 added into dnsmasq's DNS view. This flag suppresses that behaviour,
1713 this is useful, for instance, to allow Windows clients to update
1714 Active Directory servers. See RFC 4702 for details.
1715 .TP
1716 .B --enable-ra
1717 Enable dnsmasq's IPv6 Router Advertisement feature. DHCPv6 doesn't
1718 handle complete network configuration in the same way as DHCPv4. Router
1719 discovery and (possibly) prefix discovery for autonomous address
1720 creation are handled by a different protocol. When DHCP is in use,
1721 only a subset of this is needed, and dnsmasq can handle it, using
1722 existing DHCP configuration to provide most data. When RA is enabled,
1723 dnsmasq will advertise a prefix for each dhcp-range, with default
1724 router as the relevant link-local address on
1725 the machine running dnsmasq. By default, the "managed address" bits are set, and
1726 the "use SLAAC" bit is reset. This can be changed for individual
1727 subnets with the mode keywords described in
1728 .B --dhcp-range.
1729 RFC6106 DNS parameters are included in the advertisements. By default,
1730 the relevant link-local address of the machine running dnsmasq is sent
1731 as recursive DNS server. If provided, the DHCPv6 options dns-server and
1732 domain-search are used for the DNS server (RDNSS) and the domain serach list (DNSSL).
1733 .TP
1734 .B --ra-param=<interface>,[high|low],[[<ra-interval>],<router lifetime>]
1735 Set non-default values for router advertisements sent via an
1736 interface. The priority field for the router may be altered from the
1737 default of medium with eg
1738 .B --ra-param=eth0,high.
1739 The interval between router advertisements may be set (in seconds) with
1740 .B --ra-param=eth0,60.
1741 The lifetime of the route may be changed or set to zero, which allows
1742 a router to advertise prefixes but not a route via itself.
1743 .B --ra-parm=eth0,0,0
1744 (A value of zero for the interval means the default value.) All three parameters may be set at once.
1745 .B --ra-param=low,60,1200
1746 The interface field may include a wildcard.
1747 .TP
1748 .B --enable-tftp[=<interface>[,<interface>]]
1749 Enable the TFTP server function. This is deliberately limited to that
1750 needed to net-boot a client. Only reading is allowed; the tsize and
1751 blksize extensions are supported (tsize is only supported in octet
1752 mode). Without an argument, the TFTP service is provided to the same set of interfaces as DHCP service.
1753 If the list of interfaces is provided, that defines which interfaces recieve TFTP service.
1754 .TP
1755 .B --tftp-root=<directory>[,<interface>]
1756 Look for files to transfer using TFTP relative to the given
1757 directory. When this is set, TFTP paths which include ".." are
1758 rejected, to stop clients getting outside the specified root.
1759 Absolute paths (starting with /) are allowed, but they must be within
1760 the tftp-root. If the optional interface argument is given, the
1761 directory is only used for TFTP requests via that interface.
1762 .TP
1763 .B --tftp-no-fail
1764 Do not abort startup if specified tftp root directories are inaccessible.
1765 .TP
1766 .B --tftp-unique-root
1767 Add the IP address of the TFTP client as a path component on the end
1768 of the TFTP-root (in standard dotted-quad format). Only valid if a
1769 tftp-root is set and the directory exists. For instance, if tftp-root is "/tftp" and client
1770 1.2.3.4 requests file "myfile" then the effective path will be
1771 "/tftp/1.2.3.4/myfile" if /tftp/1.2.3.4 exists or /tftp/myfile otherwise.
1772 .TP
1773 .B --tftp-secure
1774 Enable TFTP secure mode: without this, any file which is readable by
1775 the dnsmasq process under normal unix access-control rules is
1776 available via TFTP. When the --tftp-secure flag is given, only files
1777 owned by the user running the dnsmasq process are accessible. If
1778 dnsmasq is being run as root, different rules apply: --tftp-secure
1779 has no effect, but only files which have the world-readable bit set
1780 are accessible. It is not recommended to run dnsmasq as root with TFTP
1781 enabled, and certainly not without specifying --tftp-root. Doing so
1782 can expose any world-readable file on the server to any host on the net.
1783 .TP
1784 .B --tftp-lowercase
1785 Convert filenames in TFTP requests to all lowercase. This is useful
1786 for requests from Windows machines, which have case-insensitive
1787 filesystems and tend to play fast-and-loose with case in filenames.
1788 Note that dnsmasq's tftp server always converts "\\" to "/" in filenames.
1789 .TP
1790 .B --tftp-max=<connections>
1791 Set the maximum number of concurrent TFTP connections allowed. This
1792 defaults to 50. When serving a large number of TFTP connections,
1793 per-process file descriptor limits may be encountered. Dnsmasq needs
1794 one file descriptor for each concurrent TFTP connection and one
1795 file descriptor per unique file (plus a few others). So serving the
1796 same file simultaneously to n clients will use require about n + 10 file
1797 descriptors, serving different files simultaneously to n clients will
1798 require about (2*n) + 10 descriptors. If
1799 .B --tftp-port-range
1800 is given, that can affect the number of concurrent connections.
1801 .TP
1802 .B --tftp-no-blocksize
1803 Stop the TFTP server from negotiating the "blocksize" option with a
1804 client. Some buggy clients request this option but then behave badly
1805 when it is granted.
1806 .TP
1807 .B --tftp-port-range=<start>,<end>
1808 A TFTP server listens on a well-known port (69) for connection initiation,
1809 but it also uses a dynamically-allocated port for each
1810 connection. Normally these are allocated by the OS, but this option
1811 specifies a range of ports for use by TFTP transfers. This can be
1812 useful when TFTP has to traverse a firewall. The start of the range
1813 cannot be lower than 1025 unless dnsmasq is running as root. The number
1814 of concurrent TFTP connections is limited by the size of the port range.
1815 .TP
1816 .B \-C, --conf-file=<file>
1817 Specify a different configuration file. The conf-file option is also allowed in
1818 configuration files, to include multiple configuration files. A
1819 filename of "-" causes dnsmasq to read configuration from stdin.
1820 .TP
1821 .B \-7, --conf-dir=<directory>[,<file-extension>......],
1822 Read all the files in the given directory as configuration
1823 files. If extension(s) are given, any files which end in those
1824 extensions are skipped. Any files whose names end in ~ or start with . or start and end
1825 with # are always skipped. If the extension starts with * then only files
1826 which have that extension are loaded. So
1827 .B --conf-dir=/path/to/dir,*.conf
1828 loads all files with the suffix .conf in /path/to/dir. This flag may be given on the command
1829 line or in a configuration file. If giving it on the command line, be sure to
1830 escape * characters.
1831 .TP
1832 .B --servers-file=<file>
1833 A special case of
1834 .B --conf-file
1835 which differs in two respects. Firstly, only --server and --rev-server are allowed
1836 in the configuration file included. Secondly, the file is re-read and the configuration
1837 therein is updated when dnsmasq recieves SIGHUP.
1838 .SH CONFIG FILE
1839 At startup, dnsmasq reads
1840 .I /etc/dnsmasq.conf,
1841 if it exists. (On
1842 FreeBSD, the file is
1843 .I /usr/local/etc/dnsmasq.conf
1844 ) (but see the
1845 .B \-C
1846 and
1847 .B \-7
1848 options.) The format of this
1849 file consists of one option per line, exactly as the long options detailed
1850 in the OPTIONS section but without the leading "--". Lines starting with # are comments and ignored. For
1851 options which may only be specified once, the configuration file overrides
1852 the command line. Quoting is allowed in a config file:
1853 between " quotes the special meanings of ,:. and # are removed and the
1854 following escapes are allowed: \\\\ \\" \\t \\e \\b \\r and \\n. The later
1855 corresponding to tab, escape, backspace, return and newline.
1856 .SH NOTES
1857 When it receives a SIGHUP,
1858 .B dnsmasq
1859 clears its cache and then re-loads
1860 .I /etc/hosts
1861 and
1862 .I /etc/ethers
1863 and any file given by --dhcp-hostsfile, --dhcp-hostsdir, --dhcp-optsfile,
1864 --dhcp-optsdir, --addn-hosts or --hostsdir.
1865 The dhcp lease change script is called for all
1866 existing DHCP leases. If
1867 .B
1868 --no-poll
1869 is set SIGHUP also re-reads
1870 .I /etc/resolv.conf.
1871 SIGHUP
1872 does NOT re-read the configuration file.
1873 .PP
1874 When it receives a SIGUSR1,
1875 .B dnsmasq
1876 writes statistics to the system log. It writes the cache size,
1877 the number of names which have had to removed from the cache before
1878 they expired in order to make room for new names and the total number
1879 of names that have been inserted into the cache. The number of cache hits and
1880 misses and the number of authoritative queries answered are also given. For each upstream
1881 server it gives the number of queries sent, and the number which
1882 resulted in an error. In
1883 .B --no-daemon
1884 mode or when full logging is enabled (-q), a complete dump of the
1885 contents of the cache is made.
1886
1887 The cache statistics are also available in the DNS as answers to
1888 queries of class CHAOS and type TXT in domain bind. The domain names are cachesize.bind, insertions.bind, evictions.bind,
1889 misses.bind, hits.bind, auth.bind and servers.bind. An example command to query this, using the
1890 .B dig
1891 utility would be
1892
1893 dig +short chaos txt cachesize.bind
1894
1895 .PP
1896 When it receives SIGUSR2 and it is logging direct to a file (see
1897 .B --log-facility
1898 )
1899 .B dnsmasq
1900 will close and reopen the log file. Note that during this operation,
1901 dnsmasq will not be running as root. When it first creates the logfile
1902 dnsmasq changes the ownership of the file to the non-root user it will run
1903 as. Logrotate should be configured to create a new log file with
1904 the ownership which matches the existing one before sending SIGUSR2.
1905 If TCP DNS queries are in progress, the old logfile will remain open in
1906 child processes which are handling TCP queries and may continue to be
1907 written. There is a limit of 150 seconds, after which all existing TCP
1908 processes will have expired: for this reason, it is not wise to
1909 configure logfile compression for logfiles which have just been
1910 rotated. Using logrotate, the required options are
1911 .B create
1912 and
1913 .B delaycompress.
1914
1915
1916 .PP
1917 Dnsmasq is a DNS query forwarder: it it not capable of recursively
1918 answering arbitrary queries starting from the root servers but
1919 forwards such queries to a fully recursive upstream DNS server which is
1920 typically provided by an ISP. By default, dnsmasq reads
1921 .I /etc/resolv.conf
1922 to discover the IP
1923 addresses of the upstream nameservers it should use, since the
1924 information is typically stored there. Unless
1925 .B --no-poll
1926 is used,
1927 .B dnsmasq
1928 checks the modification time of
1929 .I /etc/resolv.conf
1930 (or equivalent if
1931 .B \--resolv-file
1932 is used) and re-reads it if it changes. This allows the DNS servers to
1933 be set dynamically by PPP or DHCP since both protocols provide the
1934 information.
1935 Absence of
1936 .I /etc/resolv.conf
1937 is not an error
1938 since it may not have been created before a PPP connection exists. Dnsmasq
1939 simply keeps checking in case
1940 .I /etc/resolv.conf
1941 is created at any
1942 time. Dnsmasq can be told to parse more than one resolv.conf
1943 file. This is useful on a laptop, where both PPP and DHCP may be used:
1944 dnsmasq can be set to poll both
1945 .I /etc/ppp/resolv.conf
1946 and
1947 .I /etc/dhcpc/resolv.conf
1948 and will use the contents of whichever changed
1949 last, giving automatic switching between DNS servers.
1950 .PP
1951 Upstream servers may also be specified on the command line or in
1952 the configuration file. These server specifications optionally take a
1953 domain name which tells dnsmasq to use that server only to find names
1954 in that particular domain.
1955 .PP
1956 In order to configure dnsmasq to act as cache for the host on which it is running, put "nameserver 127.0.0.1" in
1957 .I /etc/resolv.conf
1958 to force local processes to send queries to
1959 dnsmasq. Then either specify the upstream servers directly to dnsmasq
1960 using
1961 .B \--server
1962 options or put their addresses real in another file, say
1963 .I /etc/resolv.dnsmasq
1964 and run dnsmasq with the
1965 .B \-r /etc/resolv.dnsmasq
1966 option. This second technique allows for dynamic update of the server
1967 addresses by PPP or DHCP.
1968 .PP
1969 Addresses in /etc/hosts will "shadow" different addresses for the same
1970 names in the upstream DNS, so "mycompany.com 1.2.3.4" in /etc/hosts will ensure that
1971 queries for "mycompany.com" always return 1.2.3.4 even if queries in
1972 the upstream DNS would otherwise return a different address. There is
1973 one exception to this: if the upstream DNS contains a CNAME which
1974 points to a shadowed name, then looking up the CNAME through dnsmasq
1975 will result in the unshadowed address associated with the target of
1976 the CNAME. To work around this, add the CNAME to /etc/hosts so that
1977 the CNAME is shadowed too.
1978
1979 .PP
1980 The tag system works as follows: For each DHCP request, dnsmasq
1981 collects a set of valid tags from active configuration lines which
1982 include set:<tag>, including one from the
1983 .B dhcp-range
1984 used to allocate the address, one from any matching
1985 .B dhcp-host
1986 (and "known" if a dhcp-host matches)
1987 The tag "bootp" is set for BOOTP requests, and a tag whose name is the
1988 name of the interface on which the request arrived is also set.
1989
1990 Any configuration lines which include one or more tag:<tag> constructs
1991 will only be valid if all that tags are matched in the set derived
1992 above. Typically this is dhcp-option.
1993 .B dhcp-option
1994 which has tags will be used in preference to an untagged
1995 .B dhcp-option,
1996 provided that _all_ the tags match somewhere in the
1997 set collected as described above. The prefix '!' on a tag means 'not'
1998 so --dhcp-option=tag:!purple,3,1.2.3.4 sends the option when the
1999 tag purple is not in the set of valid tags. (If using this in a
2000 command line rather than a configuration file, be sure to escape !,
2001 which is a shell metacharacter)
2002
2003 When selecting dhcp-options, a tag from dhcp-range is second class
2004 relative to other tags, to make it easy to override options for
2005 individual hosts, so
2006 .B dhcp-range=set:interface1,......
2007 .B dhcp-host=set:myhost,.....
2008 .B dhcp-option=tag:interface1,option:nis-domain,"domain1"
2009 .B dhcp-option=tag:myhost,option:nis-domain,"domain2"
2010 will set the NIS-domain to domain1 for hosts in the range, but
2011 override that to domain2 for a particular host.
2012
2013 .PP
2014 Note that for
2015 .B dhcp-range
2016 both tag:<tag> and set:<tag> are allowed, to both select the range in
2017 use based on (eg) dhcp-host, and to affect the options sent, based on
2018 the range selected.
2019
2020 This system evolved from an earlier, more limited one and for backward
2021 compatibility "net:" may be used instead of "tag:" and "set:" may be
2022 omitted. (Except in
2023 .B dhcp-host,
2024 where "net:" may be used instead of "set:".) For the same reason, '#'
2025 may be used instead of '!' to indicate NOT.
2026 .PP
2027 The DHCP server in dnsmasq will function as a BOOTP server also,
2028 provided that the MAC address and IP address for clients are given,
2029 either using
2030 .B dhcp-host
2031 configurations or in
2032 .I /etc/ethers
2033 , and a
2034 .B dhcp-range
2035 configuration option is present to activate the DHCP server
2036 on a particular network. (Setting --bootp-dynamic removes the need for
2037 static address mappings.) The filename
2038 parameter in a BOOTP request is used as a tag,
2039 as is the tag "bootp", allowing some control over the options returned to
2040 different classes of hosts.
2041
2042 .SH AUTHORITATIVE CONFIGURATION
2043 .PP
2044 Configuring dnsmasq to act as an authoritative DNS server is
2045 complicated by the fact that it involves configuration of external DNS
2046 servers to provide delegation. We will walk through three scenarios of
2047 increasing complexity. Prerequisites for all of these scenarios
2048 are a globally accessible IP address, an A or AAAA record pointing to that address,
2049 and an external DNS server capable of doing delegation of the zone in
2050 question. For the first part of this explanation, we will call the A (or AAAA) record
2051 for the globally accessible address server.example.com, and the zone
2052 for which dnsmasq is authoritative our.zone.com.
2053
2054 The simplest configuration consists of two lines of dnsmasq configuration; something like
2055
2056 .nf
2057 .B auth-server=server.example.com,eth0
2058 .B auth-zone=our.zone.com,1.2.3.0/24
2059 .fi
2060
2061 and two records in the external DNS
2062
2063 .nf
2064 server.example.com A 192.0.43.10
2065 our.zone.com NS server.example.com
2066 .fi
2067
2068 eth0 is the external network interface on which dnsmasq is listening,
2069 and has (globally accessible) address 192.0.43.10.
2070
2071 Note that the external IP address may well be dynamic (ie assigned
2072 from an ISP by DHCP or PPP) If so, the A record must be linked to this
2073 dynamic assignment by one of the usual dynamic-DNS systems.
2074
2075 A more complex, but practically useful configuration has the address
2076 record for the globally accessible IP address residing in the
2077 authoritative zone which dnsmasq is serving, typically at the root. Now
2078 we have
2079
2080 .nf
2081 .B auth-server=our.zone.com,eth0
2082 .B auth-zone=our.zone.com,1.2.3.0/24
2083 .fi
2084
2085 .nf
2086 our.zone.com A 1.2.3.4
2087 our.zone.com NS our.zone.com
2088 .fi
2089
2090 The A record for our.zone.com has now become a glue record, it solves
2091 the chicken-and-egg problem of finding the IP address of the
2092 nameserver for our.zone.com when the A record is within that
2093 zone. Note that this is the only role of this record: as dnsmasq is
2094 now authoritative from our.zone.com it too must provide this
2095 record. If the external address is static, this can be done with an
2096 .B /etc/hosts
2097 entry or
2098 .B --host-record.
2099
2100 .nf
2101 .B auth-server=our.zone.com,eth0
2102 .B host-record=our.zone.com,1.2.3.4
2103 .B auth-zone=our.zone.com,1.2.3.0/24
2104 .fi
2105
2106 If the external address is dynamic, the address
2107 associated with our.zone.com must be derived from the address of the
2108 relevant interface. This is done using
2109 .B interface-name
2110 Something like:
2111
2112 .nf
2113 .B auth-server=our.zone.com,eth0
2114 .B interface-name=our.zone.com,eth0
2115 .B auth-zone=our.zone.com,1.2.3.0/24,eth0
2116 .fi
2117
2118 (The "eth0" argument in auth-zone adds the subnet containing eth0's
2119 dynamic address to the zone, so that the interface-name returns the
2120 address in outside queries.)
2121
2122 Our final configuration builds on that above, but also adds a
2123 secondary DNS server. This is another DNS server which learns the DNS data
2124 for the zone by doing zones transfer, and acts as a backup should
2125 the primary server become inaccessible. The configuration of the
2126 secondary is beyond the scope of this man-page, but the extra
2127 configuration of dnsmasq is simple:
2128
2129 .nf
2130 .B auth-sec-servers=secondary.myisp.com
2131 .fi
2132
2133 and
2134
2135 .nf
2136 our.zone.com NS secondary.myisp.com
2137 .fi
2138
2139 Adding auth-sec-servers enables zone transfer in dnsmasq, to allow the
2140 secondary to collect the DNS data. If you wish to restrict this data
2141 to particular hosts then
2142
2143 .nf
2144 .B auth-peer=<IP address of secondary>
2145 .fi
2146
2147 will do so.
2148
2149 Dnsmasq acts as an authoritative server for in-addr.arpa and
2150 ip6.arpa domains associated with the subnets given in auth-zone
2151 declarations, so reverse (address to name) lookups can be simply
2152 configured with a suitable NS record, for instance in this example,
2153 where we allow 1.2.3.0/24 addresses.
2154
2155 .nf
2156 3.2.1.in-addr.arpa NS our.zone.com
2157 .fi
2158
2159 Note that at present, reverse (in-addr.arpa and ip6.arpa) zones are
2160 not available in zone transfers, so there is no point arranging
2161 secondary servers for reverse lookups.
2162
2163 .PP
2164 When dnsmasq is configured to act as an authoritative server, the
2165 following data is used to populate the authoritative zone.
2166 .PP
2167 .B --mx-host, --srv-host, --dns-rr, --txt-record, --naptr-record
2168 , as long as the record names are in the authoritative domain.
2169 .PP
2170 .B --cname
2171 as long as the record name is in the authoritative domain. If the
2172 target of the CNAME is unqualified, then it is qualified with the
2173 authoritative zone name.
2174 .PP
2175 IPv4 and IPv6 addresses from /etc/hosts (and
2176 .B --addn-hosts
2177 ) and
2178 .B --host-record
2179 and
2180 .B --interface-name
2181 provided the address falls into one of the subnets specified in the
2182 .B --auth-zone.
2183 .PP
2184 Addresses of DHCP leases, provided the address falls into one of the subnets specified in the
2185 .B --auth-zone.
2186 (If contructed DHCP ranges are is use, which depend on the address dynamically
2187 assigned to an interface, then the form of
2188 .B --auth-zone
2189 which defines subnets by the dynamic address of an interface should
2190 be used to ensure this condition is met.)
2191 .PP
2192 In the default mode, where a DHCP lease
2193 has an unqualified name, and possibly a qualified name constructed
2194 using
2195 .B --domain
2196 then the name in the authoritative zone is constructed from the
2197 unqualified name and the zone's domain. This may or may not equal
2198 that specified by
2199 .B --domain.
2200 If
2201 .B --dhcp-fqdn
2202 is set, then the fully qualified names associated with DHCP leases are
2203 used, and must match the zone's domain.
2204
2205
2206
2207 .SH EXIT CODES
2208 .PP
2209 0 - Dnsmasq successfully forked into the background, or terminated
2210 normally if backgrounding is not enabled.
2211 .PP
2212 1 - A problem with configuration was detected.
2213 .PP
2214 2 - A problem with network access occurred (address in use, attempt
2215 to use privileged ports without permission).
2216 .PP
2217 3 - A problem occurred with a filesystem operation (missing
2218 file/directory, permissions).
2219 .PP
2220 4 - Memory allocation failure.
2221 .PP
2222 5 - Other miscellaneous problem.
2223 .PP
2224 11 or greater - a non zero return code was received from the
2225 lease-script process "init" call. The exit code from dnsmasq is the
2226 script's exit code with 10 added.
2227
2228 .SH LIMITS
2229 The default values for resource limits in dnsmasq are generally
2230 conservative, and appropriate for embedded router type devices with
2231 slow processors and limited memory. On more capable hardware, it is
2232 possible to increase the limits, and handle many more clients. The
2233 following applies to dnsmasq-2.37: earlier versions did not scale as well.
2234
2235 .PP
2236 Dnsmasq is capable of handling DNS and DHCP for at least a thousand
2237 clients. The DHCP lease times should not be very short (less than one hour). The
2238 value of
2239 .B --dns-forward-max
2240 can be increased: start with it equal to
2241 the number of clients and increase if DNS seems slow. Note that DNS
2242 performance depends too on the performance of the upstream
2243 nameservers. The size of the DNS cache may be increased: the hard
2244 limit is 10000 names and the default (150) is very low. Sending
2245 SIGUSR1 to dnsmasq makes it log information which is useful for tuning
2246 the cache size. See the
2247 .B NOTES
2248 section for details.
2249
2250 .PP
2251 The built-in TFTP server is capable of many simultaneous file
2252 transfers: the absolute limit is related to the number of file-handles
2253 allowed to a process and the ability of the select() system call to
2254 cope with large numbers of file handles. If the limit is set too high
2255 using
2256 .B --tftp-max
2257 it will be scaled down and the actual limit logged at
2258 start-up. Note that more transfers are possible when the same file is
2259 being sent than when each transfer sends a different file.
2260
2261 .PP
2262 It is possible to use dnsmasq to block Web advertising by using a list
2263 of known banner-ad servers, all resolving to 127.0.0.1 or 0.0.0.0, in
2264 .B /etc/hosts
2265 or an additional hosts file. The list can be very long,
2266 dnsmasq has been tested successfully with one million names. That size
2267 file needs a 1GHz processor and about 60Mb of RAM.
2268
2269 .SH INTERNATIONALISATION
2270 Dnsmasq can be compiled to support internationalisation. To do this,
2271 the make targets "all-i18n" and "install-i18n" should be used instead of
2272 the standard targets "all" and "install". When internationalisation
2273 is compiled in, dnsmasq will produce log messages in the local
2274 language and support internationalised domain names (IDN). Domain
2275 names in /etc/hosts, /etc/ethers and /etc/dnsmasq.conf which contain
2276 non-ASCII characters will be translated to the DNS-internal punycode
2277 representation. Note that
2278 dnsmasq determines both the language for messages and the assumed
2279 charset for configuration
2280 files from the LANG environment variable. This should be set to the system
2281 default value by the script which is responsible for starting
2282 dnsmasq. When editing the configuration files, be careful to do so
2283 using only the system-default locale and not user-specific one, since
2284 dnsmasq has no direct way of determining the charset in use, and must
2285 assume that it is the system default.
2286
2287 .SH FILES
2288 .IR /etc/dnsmasq.conf
2289
2290 .IR /usr/local/etc/dnsmasq.conf
2291
2292 .IR /etc/resolv.conf
2293 .IR /var/run/dnsmasq/resolv.conf
2294 .IR /etc/ppp/resolv.conf
2295 .IR /etc/dhcpc/resolv.conf
2296
2297 .IR /etc/hosts
2298
2299 .IR /etc/ethers
2300
2301 .IR /var/lib/misc/dnsmasq.leases
2302
2303 .IR /var/db/dnsmasq.leases
2304
2305 .IR /var/run/dnsmasq.pid
2306 .SH SEE ALSO
2307 .BR hosts (5),
2308 .BR resolver (5)
2309 .SH AUTHOR
2310 This manual page was written by Simon Kelley <simon@thekelleys.org.uk>.
2311
2312