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