Dnsmasq

From Leo's Notes
Revision as of 19:44, 1 June 2013 by Leo (talk | contribs)
This page was last edited on 1 June 2013, at 19:44.

dnsmasq is a simple DNS, DHCP, and TFTP server all built into one binary.

Usage

You can either run dnsmasq using the /etc/dnsmasq.conf configuration file, or specify the configuration as command line arguments.

Eg:

dnsmasq --no-daemon --port=0 --log-queries --dhcp-range=192.168.192.11,192.168.192.250,1h --dhcp-option=6,192.168.192.10 --dhcp-option=3,192.168.192.10

DHCP Options

To get a list of options that you can pass to --dhcp-option, run

dnsmasq --help dhcp

You will get a list of numbers and their associated options like so:

Known DHCP options:
  1 netmask
  2 time-offset
  3 router
  6 dns-server
  7 log-server
  9 lpr-server
 12 hostname
 13 boot-file-size
 15 domain-name
 16 swap-server
 17 root-path
 18 extension-path
 19 ip-forward-enable
 20 non-local-source-routing
 21 policy-filter
 22 max-datagram-reassembly
 23 default-ttl
 26 mtu
 27 all-subnets-local
 28 broadcast
 31 router-discovery
 32 router-solicitation
 33 static-route
 34 trailer-encapsulation
 35 arp-timeout
 36 ethernet-encap
 37 tcp-ttl
 38 tcp-keepalive
 40 nis-domain
 41 nis-server
 42 ntp-server
 44 netbios-ns
 45 netbios-dd
 46 netbios-nodetype
 47 netbios-scope
 48 x-windows-fs
 49 x-windows-dm
 50 requested-address
 54 server-identifier
 60 vendor-class
 64 nis+-domain
 65 nis+-server
 66 tftp-server
 67 bootfile-name
 68 mobile-ip-home
 69 smtp-server
 70 pop3-server
 71 nntp-server
 74 irc-server
 77 user-class
 93 client-arch
 94 client-interface-id
 97 client-machine-id
119 domain-search
120 sip-server
121 classless-static-route

You may specify options using either:

dnsmasq --dhcp-option=<option number>,<value>
dnsmasq --dhcp-option=option:<option name>,<value>

IPv6 options are specified using:

dnsmasq --dhcp-options=option6:<option name>,<value>

Tips

DHCP Only Server

The DNS service in dnsmasq can be disabled by setting the port number to 0 and enabling DHCP by specifying the range.

dnsmasq --port=0 --dhcp-range=<start ip>,<end ip>,<lease time>