Dnsmasq: Difference between revisions

From Leo's Notes
This page was last edited on 24 February 2017, at 04:30.
No edit summary
m Text replacement - "{{hltext | code =" to "{{highlight|lang=terminal|code="
Line 14: Line 14:
You will get a list of numbers and their associated options like so:
You will get a list of numbers and their associated options like so:


{{hltext | code =
{{highlight|lang=terminal|code=
Known DHCP options:
Known DHCP options:
   1 netmask
   1 netmask

Revision as of 04:30, 24 February 2017

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.

For example:

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>

PXE Boot

To define the next-server and boot filename (like you would in dhcpd for instance), edit the dnsmasq configuration file with the following line, or append it to the dnsmasq options (with --dhcp-boot or -M).

dhcp-boot=pxelinux.0,,172.20.1.10

where pxelinux.0 is the file to boot and 172.20.1.10 is the PXE TFTP server. The empty option between the filename and IP address is the servername which dnsmasq would lookup in the local /etc/hosts file.

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>