source: src/router/dnsmasq/man/dnsmasq.8 @ 31543

Last change on this file since 31543 was 31543, checked in by brainslayer, 4 weeks ago

latest dnsmasq code

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