DHCP Relay#
DHCP → DRDHCP Relays
The DHCP protocol is used to dynamically assign IP addresses to a host that asks for one. Because a requesting host has no assigned address yet, the initial DHCP Discover is sent from source IP 0.0.0.0 to the limited broadcast 255.255.255.255, which routers do not forward across subnet boundaries. This is a problem in cases where the DHCP server manages multiple subnets: it would need to be reachable in every broadcast domain, which is often not feasible.
Instead, we use a DHCP relay that intercepts the broadcast DHCP message and forwards it as a unicast packet to the DHCP server, recording its own IP address as the gateway address. This intermediary device then relays messages in both directions: DHCP client requests are forwarded as unicast packets to the server, and server responses are forwarded back to the client.
The DHCPRelay can be configured on two interface types, which are always tied to a virtual Router:
- An
IRBInterfacethat connects to aBridgeDomain, which can have many sub-interfaces connected to it - A
RoutedInterfaceis essentially a broadcast domain on a single physical interface, although there may of course be many devices behind that interface
Sub-options#
DHCP relay options can be defined which add additional information to the DHCP request, such as the sub-interface on which the relay received the DHCP request.
For DHCPv4, the following options are supported:
CircuitIDRemoteID
For DHCPv6, the following options are supported:
RemoteIDInterfaceIDClientLinkLayerAddress
instance 2 (dhcp-router),
transmitted DHCP Boot Request to 10.10.10.10 Port 67
H/W Type: Ethernet(10Mb) H/W Address Length: 6
ciaddr: 192.168.0.119 yiaddr: 0.0.0.0
siaddr: 0.0.0.0 giaddr: 192.168.0.14
chaddr: aa:13:8c:4d:db:8d xid: 0x54dea877
DHCP options:
[82] Relay agent information: len = 40
[1] Circuit-id: dc1-leaf4|dhcp-router|irb0|0:0 <-- Added by the DHCP relay
[2] Remote-id: (hex) aa 13 8c 4d db 8d <-- Added by the DHCP relay
[53] Message type: Request
[57] Max msg size: 576
[55] Param request list: len = 7
1 Subnet mask
3 Router
6 Domain name server
12 Host name
15 Domain name
28 Broadcast addr
42 NTP server
[60] Class id: udhcp 1.36.1
[61] Client id: (hex) 01 aa 13 8c 4d db 8d
[255] End
Dependencies#
The DHCPRelay resource has no dependencies. However, it is only configured on a particular node if at least one IRBInterface or RoutedInterface is present on that node.
Referenced resources#
IRBInterface#
If the DHCP relay is configured on IRBInterfaces (which connect a BridgeDomain to a Router), then those IRB interfaces should exist and be configured with at least one primary IP address. If an IRBInterface does not have a primary IP on a node, the DHCP relay will not be deployed on that interface.
RoutedInterface#
If the DHCP relay is configured on RoutedInterfaces (which connect an Interface to a Router), then those routed interfaces should exist and be configured with at least one primary IP address. If a RoutedInterface does not have a primary IP on a node, the DHCP relay will not be deployed on that interface.
Examples#
Custom Resource Definition#
To browse the Custom Resource Definition go to crd.eda.dev.
DHCPRelay
SPEC
The DHCPRelay enables the forwarding of DHCP requests and responses between clients and servers across different networks. This resource allows for the configuration of various DHCP relay sub-options, such as CircuitID, RemoteID, and ClientLinkLayerAddress, to provide detailed client information. It also includes settings for specifying the router to reach the DHCP server, the list of DHCP servers to forward requests to, and selectors for Routed and IRB interfaces where the relay will be configured. Additionally, the GI Address option can be set to derive the Gateway IP address from the selected interface, ensuring correct routing of DHCP messages.
-
Set GI Address to the IP derived from the IRBInterface or RoutedInterface on which the DHCP relay is configured.
-
Label selector to select the IRBInterface on which to configure the DHCP relay.
-
Label selector to select the RoutedInterface on which to configure the DHCP relay.
-
Router to be used to reach the DHCP server, if not specified the Router under which the source IRBInterface or RoutedInterface resides will be used.
-
List of servers to send the DHCP relayed packet to. These can be IP addresses or FQDN.
-
DHCP Relay sub-options; available options are CircuitID, RemoteID, and ClientLinkLayerAddress.
STATUS
DHCPRelayStatus defines the observed state of DHCPRelay