Dnsmasq: Difference between revisions
m Text replacement - "</code>" to "}}" |
|||
| Line 82: | Line 82: | ||
=== PXE Boot === | === 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). | 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 {{code|--dhcp-boot}} or {{code|-M}}). | ||
{{highlight|lang=text|code= | |||
dhcp-boot=pxelinux.0,,172.20.1.10 | |||
}} | |||
The options passed to dhcp-boot are: | |||
# pxelinux.0 is the filename to boot | |||
# (empty) is the servername that is looked up in the local hosts file. | |||
# 172.20.1.10 is the next-server (ie. the PXE TFTP server) | |||
==== Example ==== | |||
Here is a working example of a PXE boot config that I've used on a RaspberryPi. | |||
{{highlight|lang=text|code= | |||
port=0 | |||
interface=eth0 | |||
bind-interfaces | |||
dhcp-range=10.130.4.110,10.130.4.169,24h | |||
dhcp-boot=/pxelinux.0 | |||
dhcp-option-force=66,10.130.4.254 | |||
enable-tftp | |||
tftp-root=/tftpboot | |||
}} | |||
== Tips == | == Tips == | ||
Revision as of 17:55, 23 May 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
The options passed to dhcp-boot are:
- pxelinux.0 is the filename to boot
- (empty) is the servername that is looked up in the local hosts file.
- 172.20.1.10 is the next-server (ie. the PXE TFTP server)
Example
Here is a working example of a PXE boot config that I've used on a RaspberryPi.
port=0
interface=eth0
bind-interfaces
dhcp-range=10.130.4.110,10.130.4.169,24h
dhcp-boot=/pxelinux.0
dhcp-option-force=66,10.130.4.254
enable-tftp
tftp-root=/tftpboot
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>
| ||||||