Subnet Configuration¶
A subnet
defines a network in which the DHCP server will provide addresses
to clients, for example:
tnsr(config-kea-dhcp4)# subnet 10.2.0.0/24
tnsr(config-kea-subnet4)# id 1
tnsr(config-kea-subnet4)# interface GigabitEthernet0/14/2
From within the subnet4
configuration mode, the following commands can be
used:
- authoritative (true|false):
Specifies whether or not this DHCP server is authoritative for this subnet.
If the DHCP server is authoritative globally, there is no need for it to also be explicitly set as authoritative at the subnet level.
- id <id>:
Required. Sets the unique identifier for this subnet.
- interface <name>:
Required. The interface on which the subnet is located.
- option:
Defines an option specific to this subnet (DHCP Options).
- pool:
Defines a pool of addresses to serve inside this subnet. (Address Pool Configuration).
- reservation <ipv4-address>:
Defines a host reservation to tie a client MAC address to a static IP address assignment.
At a minimum, the subnet itself must contain an interface
definition and a
pool
.
Address Pool Configuration¶
A pool
controls which addresses inside the subnet
can be used by
clients, for example:
tnsr(config-kea-subnet4)# pool 10.2.0.128-10.2.0.191
tnsr(config-kea-subnet4-pool)#
A pool may be defined as an address range (inclusive) as shown above in
<ipv4-addr>-<ipv4-addr>
format, or as a prefix, such as 10.2.0.128/26
.
Options can be defined inside a pool that only apply to clients receiving addresses from that pool.
Host Reservations¶
A reservation
sets up a static IP address reservation for a client inside
a subnet. For example:
tnsr(config-kea-subnet4)# reservation 10.2.0.20
tnsr(config-kea-subnet4-reservation)#
This reservation ensures that a client always obtains the same IP address, and can also provide the client with DHCP options that differ from the main subnet configuration.
Reservations are defined from within config-kea-subnet4
mode, and take the
form of reservation <ipv4-address>
. That command then enters
config-kea-subnet4-reservation
mode, which contains the following options:
- hostname <hostname>:
The hostname for this client.
- mac-address <mac-address>:
Mandatory. The MAC address of the client, used to uniquely identify the client and assign this reserved IP address. The same MAC address cannot be used in more than one reservation on a single subnet.
- option <dhcp4-option>:
DHCP options specific to this client. See DHCP Options for details on configuring DHCP options.
At a minimum, a reservation entry requires the ipv4-address
which defines
the reservation itself, and a mac-address
to identify the client.
Warning
While it is possible to define a reservation inside a pool, this can lead to address conflicts in certain cases, such as when a different client already holds a lease for the new reservation.
The best practice is to keep reservations outside of the dynamic assignment pool.
Host reservation example:
tnsr(config-kea-subnet4)# reservation 10.2.0.20
tnsr(config-kea-subnet4-reservation)# mac-address 00:0c:29:4c:b3:9b
tnsr(config-kea-subnet4-reservation)# hostname mint-desktop
tnsr(config-kea-subnet4-reservation)# exit
tnsr(config-kea-subnet4)#