DHCP Configuration Module

DHCP configuration module implements DHCP clients, servers, and relays for IPv4 and IPv6.

Platform Support

DHCP clients are supported on these platforms:

Operating system

IPv4

IPv6

Default
route

Routing over
DHCP interfaces

Arista EOS

Cisco IOSv

Cisco IOS XE

Cumulus Linux

Linux (Ubuntu VM only)

DHCP servers are supported on these platforms:

Operating system

IPv4

IPv6

VRF-aware

Arista EOS

Cisco IOSv

Cisco IOS XE

dnsmasq

Linux (Ubuntu VM only)

DHCP relays are supported on these platforms:

Operating system

IPv4

IPv6

VRF-aware

Arista EOS

Cisco IOSv

Cisco IOS XE

Cumulus Linux

Linux (Ubuntu VM only)

Tip

  • VRF-aware DHCP relays use DHCP options specified in RFC 6607.

  • VRF-aware DHCP servers can use DHCP options specified in RFC 6607 to select the client subnet.

Node Parameters

The DHCP module supports the following node parameters:

  • dhcp.server (boolean) – the device should run a DHCP server

  • dhcp.vrf (boolean) – the DHCP relay or server should be VRF-aware. The default value of this parameter is set to true if the node performs inter-VRF DHCP relaying or has DHCP pools from VRF subnets. To override that behavior, you can set dhcp.vrf to false.

Tip

You have to set ‌dhcp.vrf to False on a Cisco IOS XE DHCP server when you use it with Arista EOS VRF-aware relays (more details).

Interface Parameters

  • To start a DHCP client on an interface, set ipv4 or ipv6 address to dhcp.

  • The DHCP client usually installs a default route to an IPv4 default gateway[1] sent in a DHCP reply. To disable this functionality, set dhcp.client.default interface parameter to False.

  • To start a DHCP relay on an interface, set dhcp.server interface parameter to a list of DHCP servers.

  • To enable inter-VRF DHCP relaying, set the dhcp.vrf interface parameter to the name of the destination VRF (or global).

Implementation Notes

  • The dhcp module is automatically enabled for nodes with DHCP clients. You don’t have to specify it in the module list. However, at least one topology node must use the dhcp module to enable netlab to recognize dhcp as a valid IPv4 or IPv6 address.

  • You must enable the dhcp module on DHCP relays and servers.

  • dnsmasq always uses the dhcp module and is configured as a DHCP server. There’s no need to set the module or dhcp.server node variable.

Examples

The following topology starts IPv4 DHCP clients on Cumulus Linux and Cisco IOSv and a DHCP server on Arista EOS:

nodes:
  r1:
    device: iosv
  r2:
    device: cumulus
  srv:
    device: eos
    module: [ dhcp ]
    dhcp.server: True

links:
- r1:
    ipv4: dhcp
  r2:
    ipv4: dhcp
  srv:

The following topology uses dnsmasq DHCP server and starts IPv4 and IPv6 DHCP clients on Arista EOS:

provider: clab

addressing.lan.ipv6: 2001:db8:cafe::/48

nodes:
  client:
    device: eos
  server:
    device: dnsmasq

links:
- client:
    ipv4: dhcp
    ipv6: dhcp
  server:

The following topology uses DHCP relaying on an Arista EOS switch to propagate DHCP requests from Cumulus Linux clients to a dnsmasq DHCP server.

provider: clab

module: [ dhcp ]

nodes:
  client:
    device: cumulus
  relay:
    device: eos
  server:
    device: dnsmasq

links:
- client:
    ipv4: dhcp
  relay:
    dhcp.server: server
- relay-server