dnsmasq.conf sample

Navigation
computing: software: dnsmasq: dnsmasq.conf: sample

Overview
This is a sample of dnsmasq.conf, mainly included because of all the comments. I'm stripping all the comments out of my actual file so I can see which lines are actually in use. This is a fairly basic configuration which uses /etc/hosts as well as having additional local-machinename definitions in a file called /etc/dnsmasqhosts.

Contents
# domain-needed bogus-priv resolv-file=/etc/dnsmasqupstreamservers addn-hosts=/etc/dnsmasqhosts dhcp-range=192.168.0.50,192.168.0.150,12h # 11:22:33:44:55:66 to be "fred" dhcp-host=00:0e:2e:0d:44:be,Bunsen,192.168.0.106 dhcp-option=3,192.168.0.1
 * 1) Configuration file for dnsmasq.
 * 1) Format is one option per line, legal options are the same
 * 2) as the long options legal on the command line. See
 * 3) "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
 * 1) The following two options make you a better netizen, since they
 * 2) tell dnsmasq to filter out queries which the public DNS cannot
 * 3) answer, and which load the servers (especially the root servers)
 * 4) uneccessarily. If you have a dial-on-demand link they also stop
 * 5) these requests from bringing up the link uneccessarily.
 * 1) Never forward plain names (without a dot or domain part)
 * 1) Never forward addresses in the non-routed address spaces.
 * 1) Uncomment this to filter useless windows-originated DNS requests
 * 2) which can trigger dial-on-demand links needlessly.
 * 3) Note that (amongst other things) this blocks all SRV requests,
 * 4) so don't use it if you use eg Kerberos.
 * 5) This option only affects forwarding, SRV records originating for
 * 6) dnsmasq (via srv-host= lines) are not suppressed by it.
 * 7) filterwin2k
 * 1) Change this line if you want dns to get its upstream servers from
 * 2) somewhere other that /etc/resolv.conf
 * 3) resolv-file=
 * 1) By  default,  dnsmasq  will  send queries to any of the upstream
 * 2) servers it knows about and tries to favour servers to are  known
 * 3) to  be  up.  Uncommenting this forces dnsmasq to try each query
 * 4) with  each  server  strictly  in  the  order  they   appear   in
 * 5) /etc/resolv.conf
 * 6) strict-order
 * 1) If you don't want dnsmasq to read /etc/resolv.conf or any other
 * 2) file, getting its servers from this file instead (see below), then
 * 3) uncomment this
 * 4) no-resolv
 * 1) If you don't want dnsmasq to poll /etc/resolv.conf or other resolv
 * 2) files for changes and re-read them then uncomment this.
 * 3) no-poll
 * 1) Add other name servers here, with domain specs if they are for
 * 2) non-public domains.
 * 3) server=/localnet/192.168.0.1
 * 4) server=166.70.63.3
 * 1) Add local-only domains here, queries in these domains are answered
 * 2) from /etc/hosts or DHCP only.
 * 3) local=/localnet/
 * 1) Add domains which you want to force to an IP address here.
 * 2) The example below send any host in doubleclick.net to a local
 * 3) webserver.
 * 4) address=/doubleclick.net/127.0.0.1
 * 1) If you want dnsmasq to change uid and gid to something other
 * 2) than the default, edit the following lines.
 * 3) user=
 * 4) group=
 * 1) If you want dnsmasq to listen for DHCP and DNS requests only on
 * 2) specified interfaces (and the loopback) give the name of the
 * 3) interface (eg eth0) here.
 * 4) Repeat the line for more than one interface.
 * 5) interface=
 * 6) Or you can specify which interface _not_ to listen on
 * 7) except-interface=
 * 8) Or which to listen on by address (remember to include 127.0.0.1 if
 * 9) you use this.)
 * 10) listen-address=
 * 11) If you want dnsmasq to provide only DNS service on an interface,
 * 12) configure it as shown above, and then use the following line to
 * 13) disable DHCP on it.
 * 14) no-dhcp-interface=
 * 1) On systems which support it, dnsmasq binds the wildcard address,
 * 2) even when it is listening on only some interfaces. It then discards
 * 3) requests that it shouldn't reply to. This has the advantage of
 * 4) working even when interfaces come and go and change address. If you
 * 5) want dnsmasq to really bind only the interfaces it is listening on,
 * 6) uncomment this option. About the only time you may need this is when
 * 7) running another nameserver on the same machine.
 * 8) bind-interfaces
 * 1) If you don't want dnsmasq to read /etc/hosts, uncomment the
 * 2) following line.
 * 3) no-hosts
 * 4) or if you want it to read another file, as well as /etc/hosts, use
 * 5) this.
 * 6) addn-hosts=/etc/banner_add_hosts
 * 1) Set this (and domain: see below) if you want to have a domain
 * 2) automatically added to simple names in a hosts-file.
 * 3) expand-hosts
 * 1) Set the domain for dnsmasq. this is optional, but if it is set, it
 * 2) does the following things.
 * 3) 1) Allows DHCP hosts to have fully qualified domain names, as long
 * 4)     as the domain part matches this setting.
 * 5) 2) Sets the "domain" DHCP option thereby potentially setting the
 * 6)    domain of all systems configured by DHCP
 * 7) 3) Provides the domain part for "expand-hosts"
 * 8) domain=thekelleys.org.uk
 * 1) Uncomment this to enable the integrated DHCP server, you need
 * 2) to supply the range of addresses available for lease and optionally
 * 3) a lease time. If you have more than one network, you will need to
 * 4) repeat this for each network on which you want to supply DHCP
 * 5) service.
 * 1) This is an example of a DHCP range where the netmask is given. This
 * 2) is needed for networks we reach the dnsmasq DHCP server via a relay
 * 3) agent. If you don't know what a DHCP relay agent is, you probably
 * 4) don't need to worry about this.
 * 5) dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
 * 1) This is an example of a DHCP range with a network-id, so that
 * 2) some DHCP options may be set only for this network.
 * 3) dhcp-range=red,192.168.0.50,192.168.0.150
 * 1) Supply parameters for specified hosts using DHCP. There are lots
 * 2) of valid alternatives, so we will give examples of each. Note that
 * 3) IP addresses DO NOT have to be in the range given above, they just
 * 4) need to be on the same network. The order of the parameters in these
 * 5) do not matter, it's permissble to give name,adddress and MAC in any order
 * 1) Always allocate the host with ethernet address 11:22:33:44:55:66
 * 2) The IP address 192.168.0.60
 * 3) dhcp-host=11:22:33:44:55:66,192.168.0.60
 * 1) Always set the name of the host with hardware address
 * 1) dhcp-host=11:22:33:44:55:66,fred
 * 1) Always give the host with ethernet address 11:22:33:44:55:66
 * 2) the name fred and IP address 192.168.0.60 and lease time 45 minutes
 * 3) dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m
 * 1) Give the machine which says it's name is "bert" IP address
 * 2) 192.168.0.70 and an infinite lease
 * 3) dhcp-host=bert,192.168.0.70,infinite
 * 1) Always give the host with client identifier 01:02:02:04
 * 2) the IP address 192.168.0.60
 * 3) dhcp-host=id:01:02:02:04,192.168.0.60
 * 1) Always give the host with client identifier "marjorie"
 * 2) the IP address 192.168.0.60
 * 3) dhcp-host=id:marjorie,192.168.0.60
 * 1) Enable the address given for "judge" in /etc/hosts
 * 2) to be given to a machine presenting the name "judge" when
 * 3) it asks for a DHCP lease.
 * 4) dhcp-host=judge
 * 1) Never offer DHCP service to a machine whose ethernet
 * 2) address is 11:22:33:44:55:66
 * 3) dhcp-host=11:22:33:44:55:66,ignore
 * 1) Ignore any client-id presented by the machine with ethernet
 * 2) address 11:22:33:44:55:66. This is useful to prevent a machine
 * 3) being treated differently when running under different OS's or
 * 4) between PXE boot and OS boot.
 * 5) dhcp-host=11:22:33:44:55:66,id:*
 * 1) Send extra options which are tagged as "red" to
 * 2) the machine with ethernet address 11:22:33:44:55:66
 * 3) dhcp-host=11:22:33:44:55:66,net:red
 * 1) Send extra options which are tagged as "red" to
 * 2) any machine with ethernet address starting 11:22:33:
 * 3) dhcp-host=11:22:33:*:*:*,net:red
 * 1) Send extra options which are tagged as "red" to any machine whose
 * 2) DHCP vendorclass string includes the substring "Linux"
 * 3) dhcp-vendorclass=red,Linux
 * 1) Send extra options which are tagged as "red" to any machine one
 * 2) of whose DHCP userclass strings includes the substring "accounts"
 * 3) dhcp-userclass=red,accounts
 * 1) If this line is uncommented, dnsmasq will read /etc/ethers and act
 * 2) on the ethernet-address/IP pairs found there just as if they had
 * 3) been given as --dhcp-host options. Useful if you keep
 * 4) MAC-address/host mappings there for other purposes.
 * 5) read-ethers
 * 1) Send options to hosts which ask for a DHCP lease.
 * 2) See RFC 2132 for details of available options.
 * 3) Note that all the common settings, such as netmask and
 * 4) broadcast address, DNS server and default route, are given
 * 5) sane defaults by dnsmasq. You very likely will not need any
 * 6) any dhcp-options. If you use Windows clients and Samba, there
 * 7) are some options which are recommended, they are detailed at the
 * 8) end of this section.
 * 9) For reference, the common options are:
 * 10) subnet mask - 1
 * 11) default router - 3
 * 12) DNS server - 6
 * 13) broadcast address - 28
 * 1) Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
 * 2) dhcp-option=42,192.168.0.4,10.10.0.5
 * 1) Set the NTP time server address to be the same machine as
 * 2) is running dnsmasq
 * 3) dhcp-option=42,0.0.0.0
 * 1) Set the NIS domain name to "welly"
 * 2) dhcp-option=40,welly
 * 1) Set the default time-to-live to 50
 * 2) dhcp-option=23,50
 * 1) Set the "all subnets are local" flag
 * 2) dhcp-option=27,1
 * 1) Send the etherboot magic flag and then etherboot options (a string).
 * 2) dhcp-option=128,e4:45:74:68:00:00
 * 3) dhcp-option=129,NIC=eepro100
 * 1) Specify an option which will only be sent to the "red" network
 * 2) (see dhcp-range for the declaration of the "red" network)
 * 3) dhcp-option=red,42,192.168.1.1
 * 1) The following DHCP options set up dnsmasq in the same way as is specified
 * 2) for the ISC dhcpcd in
 * 3) http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
 * 4) adapted for a typical dnsmasq installation where the host running
 * 5) dnsmasq is also the host running samba.
 * 6) you may want to uncomment them if you use Windows clients and Samba.
 * 7) dhcp-option=19,0          # option ip-forwarding off
 * 8) dhcp-option=44,0.0.0.0    # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
 * 9) dhcp-option=45,0.0.0.0    # netbios datagram distribution server
 * 10) dhcp-option=46,8          # netbios node type
 * 11) dhcp-option=47            # empty netbios scope.
 * 1) Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client
 * 2) probably doesn't support this......
 * 3) dhcp-option=119,eng.apple.com,marketing.apple.com
 * 1) Send encapsulated vendor-class specific options. The vendor-class
 * 2) is sent as DHCP option 60, and all the options marked with the
 * 3) vendor class are send encapsulated in DHCP option 43. The meaning of
 * 4) the options is defined by the vendor-class. This example sets the
 * 5) mtftp address to 0.0.0.0 for PXEClients
 * 6) dhcp-option=vendor:PXEClient,1,0.0.0.0
 * 1) Set the boot filename and tftpd server name and address
 * 2) for BOOTP. You will only need this is you want to
 * 3) boot machines over the network.
 * 4) dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3
 * 1) Set the limit on DHCP leases, the default is 150
 * 2) dhcp-lease-max=150
 * 1) The DHCP server needs somewhere on disk to keep its lease database.
 * 2) This defaults to a sane location, but if you want to change it, use
 * 3) the line below.
 * 4) dhcp-leasefile=/var/lib/misc/dnsmasq.leases
 * 1) Set the DHCP server to authoritative mode. In this mode it will barge in
 * 2) and take over the lease for any client which broadcasts on the network,
 * 3) whether it has a record of the lease or not. This avoids long timeouts
 * 4) when a machine wakes up on a new network. DO NOT enable this if there's
 * 5) the slighest chance that you might end up accidentally configuring a DHCP
 * 6) server for your campus/company accidentally. The ISC server uses the same
 * 7) the same option, and this URL provides more information:
 * 8) http://www.isc.org/index.pl?/sw/dhcp/authoritative.php
 * 9) dhcp-authoritative
 * 1) Set the cachesize here.
 * 2) cache-size=150
 * 1) If you want to disable negative caching, uncomment this.
 * 2) no-negcache
 * 1) Normally responses which come form /etc/hosts and the DHCP lease
 * 2) file have Time-To-Live set as zero, which conventionally means
 * 3) do not cache further. If you are happy to trade lower load on the
 * 4) server for potentially stale date, you can set a time-to-live (in
 * 5) seconds) here.
 * 6) local-ttl=
 * 1) If you want dnsmasq to detect attempts by Verisign to send queries
 * 2) to unregistered .com and .net hosts to its sitefinder service and
 * 3) have dnsmasq instead return the correct NXDOMAIN response, uncomment
 * 4) this line. You can add similar lines to do the same for other
 * 5) registries which have implemented wildcard A records.
 * 6) bogus-nxdomain=64.94.110.11
 * 1) If you want to fix up DNS results from upstream servers, use the
 * 2) alias option. This only works for IPv4.
 * 3) This alias makes a result of 1.2.3.4 appear as 5.6.7.8
 * 4) alias=1.2.3.4,5.6.7.8
 * 5) and this maps 1.2.3.x to 5.6.7.x
 * 6) alias=1.2.3.0,5.6.7.0,255.255.255.0
 * 1) Change these lines if you want dnsmasq to serve MX records.
 * 1) Return an MX record named "maildomain.com" with target
 * 2) servermachine.com and preference 50
 * 3) mx-host=maildomain.com,servermachine.com,50
 * 1) Set the default target for MX records created using the localmx option.
 * 2) mx-target=servermachine.com
 * 1) Return an MX record pointing to the mx-target for all local
 * 2) machines.
 * 3) localmx
 * 1) Return an MX record pointing to itself for all local machines.
 * 2) selfmx
 * 1) Change the following lines if you want dnsmasq to serve SRV
 * 2) records.  These are useful if you want to serve ldap requests for
 * 3) Active Directory and other windows-originated DNS requests.
 * 4) See RFC 2782.
 * 5) You may add multiple srv-host lines.
 * 6) The fields are, , , ,
 * 7) If the domain part if missing from the name (so that is just has the
 * 8) service and protocol sections) then the domain given by the domain=
 * 9) config option is used. (Note that expand-hosts does not need to be
 * 10) set for this to work.)
 * 1) A SRV record sending LDAP for the example.com domain to
 * 2) ldapserver.example.com port 289
 * 3) srv-host=_ldap._tcp.example.com,ldapserver.example.com,389
 * 1) A SRV record sending LDAP for the example.com domain to
 * 2) ldapserver.example.com port 289 (using domain=)
 * 3) domain=example.com
 * 4) srv-host=_ldap._tcp,ldapserver.example.com,389
 * 1) Two SRV records for LDAP, each with different priorities
 * 2) srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
 * 3) srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2
 * 1) A SRV record indicating that there is no LDAP server for the domain
 * 2) example.com
 * 3) srv-host=_ldap._tcp.example.com
 * 1) Change the following lines to enable dnsmasq to serve TXT records.
 * 2) These are used for things like SPF and zeroconf. (Note that the
 * 3) domain-name expansion done for SRV records _does_not
 * 4) occur for TXT records.)
 * 1) Example SPF.
 * 2) txt-record=example.com,v=spf1 a -all
 * 1) Example zeroconf
 * 2) txt-record=_http._tcp.example.com,name=value,paper=A4
 * 1) For debugging purposes, log each DNS query as it passes through
 * 2) dnsmasq.
 * 3) log-queries
 * 1) Include a another lot of configuration options.
 * 2) conf-file=/etc/dnsmasq.more.conf