--[[ * Pi-hole: A black hole for Internet advertisements * (c) 2023 Pi-hole, LLC (https://pi-hole.net) * Network-wide ad blocking via your own hardware. * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. --]] mg.include('scripts/lua/header_authenticated.lp','r') -- Page title and level selector PageTitle = "DHCP Settings" mg.include('scripts/lua/settings_header.lp','r') ?>
Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!
Leave the netmask field empty to have Pi-hole infer it from the configured IP address of your device. If you want to specify a netmask, you can use the format 255.255.255.0
.
Enable this option to enable IPv6 support for the Pi-hole DHCP server. This will allow the Pi-hole to hand out IPv6 addresses to clients and also provide IPv6 router advertisements (RA) to clients. This option is only useful if the Pi-hole is configured with an IPv6 address.
The lease time can be in seconds, minutes (e.g., "45m"), hours (e.g., "1h"), days (like "2d"), or even weeks ("1w"). If no lease time is specified (empty), dnsmasq
's default lease time is one hour for IPv4 and one day for IPv6. You may also use "infinite" as string but be aware of the drawbacks: assigned addresses are will only be made available again after the lease time has passed or when leases are manually deleted below.
The DHCPv4 rapid commit option allows the Pi-hole DHCP server to assign an IP address to a client right away. This can notably speed up the address assignment process and you will notice, e.g., faster WiFi joins in your network. This option should only be enabled if the Pi-hole DHCP server is the only DHCP server in your network.
Advertise DNS server multiple times to clients. Some devices will add their own proprietary DNS servers to the list of DNS servers, which can cause issues with Pi-hole. This option will advertise the Pi-hole DNS server multiple times to clients, which should prevent this from happening.
If this option is set, Pi-hole ignores all clients which are not explicitly configured through dhcp.hosts. This can be useful to prevent unauthorized clients from getting an IP address from the DHCP server.
It should be noted that this option is not a security feature, as clients can still assign themselves an IP address and use the network. It is merely a convenience feature to prevent unknown clients from getting a valid IP configuration assigned automatically.
Note: When this feature is enabled you will need to configure new clients manually in dhcp.hosts
before they can use the network.
IP address | Hostname | MAC address | Expiration | Client ID |
---|
Specify per host parameters for the DHCP server. This allows a machine with a particular hardware address to be always allocated the same hostname, IP address and lease time. A hostname specified like this overrides any supplied by the DHCP client on the machine. It is also allowable to omit the hardware address and include the hostname, in which case the IP address and lease times will apply to any machine claiming that name.
Each entry should be on a separate line, and should be of the form:
[<hwaddr>][,id:<client_id>|*][,set:<tag>][,tag:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]
Only one entry per MAC address is allowed.
Examples:
00:20:e0:3b:13:af,192.168.0.123tells Pi-hole to give the machine with hardware address
00:20:e0:3b:13:af
the address 192.168.0.123
00:20:e0:3b:13:af,laptoptells Pi-hole to give the machine with hardware address
00:20:e0:3b:13:af
the name laptop
00:20:e0:3b:13:af,192.168.0.123,laptop,infinitetells Pi-hole to give the machine with hardware address
00:20:e0:3b:13:af
the address 192.168.0.123
, the name laptop
, and an infinite DHCP leaseid:
. Thus lines like id:01:02:03:04,.....
refer to the host with client identifier 01:02:03:04
. It is also allowed to specify the client ID as text, like this: id:clientidastext,.....
laptop,[1234::56]
IPv6 addresses may contain only the host-identifier part: laptop,[::56]
in which case they act as wildcards in constructed DHCP ranges, with the appropriate network part inserted. For IPv6, an address may include a prefix length: laptop,[1234:50/126]
which (in this case) specifies four addresses, 1234::50
to 1234::53
. This (and the ability to specify multiple addresses) is useful when a host presents either a consistent name or hardware-ID, but varying DUIDs, since it allows dnsmasq to honour the static address allocation but assign a different address for each DUID. This typically occurs when chain netbooting, as each stage of the chain gets in turn allocates an address.id:*
means "ignore any client-id and use MAC addresses only." This is useful when a client presents a client-id sometimes but not others./etc/hosts
, the associated address can be allocated to a DHCP lease, but only if a separate line specifying the name also exists. Only one hostname can be given per line, but aliases are possible by using CNAMEs. Note that /etc/hosts
is NOT used when the DNS server side of dnsmasq is disabled by setting the DNS server port to zero.ignore
tells Pi-hole to never offer a DHCP lease to a machine. The machine can be specified by hardware address, client ID or hostname, for instance 00:20:e0:3b:13:af,ignore
. This is useful when there is another DHCP server on the network which should be used by some machines.set:<tag>
construct sets the tag whenever this line is in use. This can be used to selectively send DHCP options just for this host. More than one tag can be set per line directive (but not in other places where "set:<tag>" is allowed). When a host matches any directive (or one implied by /etc/ethers
) then the special tag "known
"" is set. This allows Pi-hole to be configured to ignore requests from unknown machines using a custom config option dhcp-ignore=tag:!known
in your own config file. If the host matches only a directive which cannot be used because it specifies an address on different subnet, the tag "known-othernet
" is set.tag:<tag>
construct filters which directives are used; more than one can be provided, in this case the request must match all of them. Tagged directives are used in preference to untagged ones. Note that one of <hwaddr>
;, <client_id>
; or <hostname>
; still needs to be specified (can be a wildcard).00:20:e0:3b:13:*,ignore
will cause Pi-hole to ignore a range of hardware addresses.-
". so the line 06-00:20:e0:3b:13:af,1.2.3.4
will only match a Token-Ring hardware address, since the ARP-address type for token ring is 6
.11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.2
. This allows an IP address to be associated with multiple hardware addresses, and gives Pi-hole permission to abandon a DHCP lease to one of the hardware addresses when another one asks for a lease. Beware that this is a dangerous thing to do, it will only work reliably if only one of the hardware addresses is active at any time and there is no way for dnsmasq to enforce this. It is, for instance, useful to allocate a stable IP address to a laptop which has both wired and wireless interfaces.