DHCP

From RFC 2131:

The DHCP provides a framework for passing configuration information to hosts on a TCP/IP network.

DHCP utilizes a server/client model to deliver the protocol. DHCP servers allocate network addresses to clients and provide them with network configurations.

DHCP Server

Soodar uses Kea DHCP as a backend to provide DHCP server functionalities. These functionalities include:

  • Add IP pools and define subnet and ip ranges to allocate to hosts

  • Provide clients DNS server addresses

  • Provide clients gateway address

  • Provide clients NTP server addresses

  • Set leasing time for each pool

  • Show/Clear bindings

Configuring Pool

[no] ip dhcp pool DHCP4POOL

Create a new DHCP4 pool. Each pool has a subnet. This subnet determines which pool should be used for incoming requests by matchin pool subnet with ingress interface subent. The negate form, removes a pool from pools.

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)#
[no] network A.B.C.D/M

Set pool’s subnet address.

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# network 192.168.1.0/24
[no] included-address A.B.C.D A.B.C.D

Define a range of addresses that could be used for allocating to clients from subnet. Each pool can have multiple included-address command.

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# included-address 192.168.1.100 192.168.1.120
soodar(dhcp-config)# included-address 192.168.1.140 192.168.1.165
[no] dns-server A.B.C.D ...

Configure DNS server address(es) that is fed to clients. User can provide all addresses in one command or issue multiple commands.

Note

Up to 8 DNS server can be set. It is not allowed to set more than 8 servers.

Example:

Following lines set 1.1.1.1, 4.2.2.4 and 8.8.8.8 as DNS servers:

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# dns-server 4.2.2.4 1.1.1.1
soodar(dhcp-config)# dns-server 8.8.8.8
[no] default-router A.B.C.D ...

Set gateway address(es) for presenting to clients. User can provide all addresses in one command or issue multiple commands.

Note

Up to 8 gateway can be set. It is not allowed to set more than 8 addresses.

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# default-router 192.168.1.1
[no] ntp-server NTP ...

Configure NTP server address(es) that is fed to clients. User can provide all addresses in one command or issue multiple commands.

Note

Up to 8 NTP server can be set. It is not allowed to set more than 8 servers.

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# ntp-server ir.pool.ntp.org
[no] domain-name NAME

Specifies the domain name for clients

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# domain-name example.org
[no] lease <(0-365) (0-23) (0-59)|infinite>

Set DHCP lease time in days, hours and minutes or infinite to disable lease time. Default lease time is 24 hours( 1 day). Negating resets lease time to default value.

soodar(config)# ip dhcp pool p1
soodar(dhcp-config)# ! set lease time to 30 days
soodar(dhcp-config)# lease 30 0 0

Configure interfaces

[no] ip dhcp server

Enable DHCP serving on interface. Negation disables DHCP serving.

soodar(config-if)# ip dhcp server

Pool status and management

show ip dhcp pool

Show general information about pool(s)

soodar# show ip dhcp pool p1

Pool p1 :
 Total addresses: 47
 Leased addresses:        1
 Declined addresses:      0
 2 ranges are currently in the pool :
 Range's low       Range's high
 192.168.1.100     192.168.1.120
 192.168.1.140     192.168.1.165
show ip dhcp binding [<DHCP4POOL|A.B.C.D>]

Show information about current bindings.

soodar# show ip dhcp binding
  IP Address   Client hostname   Client HW address   Lease expiration           Pool   Type        State
  1.1.1.100    n4                00:00:00:aa:00:01   Wed Nov  3 11:20:06 2021   p2     Automatic   Leased
clear ip dhcp binding <*|A.B.C.D>

Removes a binding from lease database. If * is the input argument, clears all bindings