1. Introduction to DHCP
Dynamic Host Configuration Protocol (DHCP) is a standardized client/server network protocol that dynamically assigns IP addresses and other related configuration information to network devices.
DHCP provides an automated way to distribute and update IP addresses and other configuration information on a network. A DHCP server provides this information to a DHCP client through the exchange of a series of messages, known as the DHCP conversation or the DHCP transaction. If the DHCP server and DHCP clients are located on different subnets, a DHCP relay agent is used to facilitate the conversation.
1.1. DHCP Relay Agent
The DHCP relay agent functions as the interface between DHCP clients and the server. DHCP relay agent relays broadcast DHCP packets to configured DHCP server(s) located in other subnets whenever it receives packets from a DHCP client residing in that same subnet.
The following are the operation steps involved by DHCP relay agent with multiple clients and servers:
-
DHCP client sends DISCOVER packets onto the LAN.
-
DHCP relay agent receives the broadcast DISCOVER packet and forwards it to configured server(s) in different subnets. Relay agent also creates a client binding.
-
DHCP server replies with OFFER packet.
-
DHCP relay agent on receiving the OFFER, sends it to the client based on the binding.
-
DHCP client sends a REQUEST after receiving the OFFER.
-
DHCP relay agent forwards the REQUEST to configured server(s).
-
Selected DHCP server replies to the REQUEST with an ACK.
-
DHCP relay agent receives the ACK and forward it to client.
-
Client will start using the IP and configuration after receiving the ACK.
-
DHCP relay agent listen to the unicast communication between the client and server and update the bindings.
1.2. DHCP Relay in Proxy Mode
The DHCP relay proxy mode is an enhancement to DHCP relay which offers all the functionality of the relay and the server isolation. In this mode, the client would not be aware of the server that is offering the configuration parameters. The client assumes that the agent is the one that allocates the IP address and managing the lease. Server is more protected in this mode.
The following are the operation steps involved by DHCP relay agent in proxy mode with multiple clients and servers:
-
DHCP client sends DISCOVER packets onto the LAN.
-
DHCP relay agent receives the broadcast DISCOVER packet and forwards it to all configured server(s) in different subnets. The relay agent also creates a client binding.
-
DHCP server replies with OFFER packet.
-
DHCP relay agent on receiving OFFERs from multiple servers, select the OFFER from the first server, replaces the server identifier with relay agent address, update the binding and sends it to the client.
-
DHCP client sends a REQUEST to relay agent address after receiving the OFFER.
-
DHCP relay agent forwards the REQUEST to the selected DHCP server.
-
Selected DHCP server replies to the REQUEST with an ACK.
-
DHCP relay agent receives the ACK, replaces the server identifier with relay agent address and forward it to client.
-
Client will start using the IP and configuration after receiving the ACK.
-
Client request the relay agent for the lease renewals, which relay agent will forward to the selected server.
In all the steps above, the client remains unaware of the actual DHCP server.
2. DHCP Relay Configuration
DHCP relay requires a pre-provisioned logical interface (logical interface configured as untagged or with a VLAN and IP) where the client is expected to connect. This logical interface should be configured with the gateway IP of the client.
There are two steps to configuring relay:
-
DHCP server configuration
-
DHCP relay configuration
2.1. DHCP Server Configuration
You can configure the DHCP server that is used to relay the packets from the client.
Syntax:
Option | Description |
---|---|
server <server-name> |
Specifies the DHCP server name. |
address <address> |
Specifies the destination IPv4 address of DHCP server. |
source-address <source-address> |
Specifies the source IPv4 address to be used to reach DHCP server. |
instance <instance> |
Routing instance from which DHCP server is reachable. |
The following example shows typical DHCP server configuration.
{ "rtbrick-config:access": { "dhcp-server": [ { "server-name": "server1", "address": "121.0.0.1", "source-address": "121.0.0.2", "routing-instance": "default" } ] } }
2.2. DHCP Relay Configuration
You can enable the DHCP relay on server’s logical interfaces.
Syntax:
Option | Description |
---|---|
<interface-name> |
Logical interface name on which client packets are expected. |
dhcp-server <dhcp-server> |
DHCP server name to which client packets has to be forwarded (multiple servers can be configured). |
The following example shows typical DHCP relay configuration.
{ "rtbrick-config:access": { "dhcp-relay": [ { "interface": "ifl-0/0/1/1", "dhcp-server": [ "server1", "server2" ] } ] } }
2.3. DHCP Relay in Proxy Mode
The proxy mode can be enabled in the relay with the following command :
Syntax:
Option | Description |
---|---|
<interface-name> |
Logical interface name on which client packets are expected. |
<true|false> |
Specifies whether proxy mode should be enabled in the relay. |
The following example shows a typical DHCP relay configuration in proxy mode.
{ "rtbrick-config:access": { "dhcp-relay": [ { "interface": "ifl-0/0/1/1", "dhcp-server": [ "server1", "server2" ], "proxy-mode": "true" } ] } }
3. DHCP Relay Operational Commands
3.1. Show Commands
3.1.1. Viewing DHCP Server Configuration
The following command displays information about the DHCP server configuration.
Syntax:
Example: DHCP Server Configuration
supervisor@fwd-dut: cfg> show config access dhcp-server { "rtbrick-config:dhcp-server": [ { "server-name": "server1", "address": "121.0.0.2", "source-address": "121.0.0.1", "routing-instance": "default" } ] }
3.1.2. Viewing DHCP Relay Configuration
The following command displays information about the DHCP relay configuration.
Syntax:
Example: DHCP Relay Configuration
supervisor@fwd-dut: cfg> show config access dhcp-relay { "rtbrick-config:dhcp-relay": [ { "interface": "ifl-0/0/1/1", "dhcp-server": [ "server1", "server2" ] } ] }
3.1.3. Viewing DHCP Relay Bindings
The following command displays information about the existing DHCP relay bindings in the system.
Syntax:
supervisor@rtbrick: op> show dhcp relay binding Interface Hardware address Gateway IP IP address Server IP Lease time Expires in ifl-0/0/1/1 e2:f6:ee:53:bb:6f 192.168.10.1 192.168.10.57 121.0.0.2 600 sec 591 sec ifl-0/0/1/1 e2:f6:ee:53:bb:8f 192.168.10.1 192.168.10.58 121.0.0.2 600 sec 595 sec ifl-0/0/3/1 ae:cd:dc:41:1d:f7 172.168.10.1 172.168.10.12 121.0.0.2 600 sec 586 sec
The following command displays detailed information about the existing DHCP relay bindings in the system.
supervisor@rtbrick: op> show dhcp relay binding detail Client IP Address: 192.168.10.57 Hardware Address: e2:f6:ee:53:bb:6f Incoming Client Interface: ifl-0/0/1/1 Routing Instance: default Server IP Address: 121.0.0.2 Gateway IP Address: 192.168.56.1 Lease Time: 600 seconds Lease Start: Mon Apr 12 07:36:30 GMT +0000 2021 Lease Expires in: 361 seconds Last Packet Received: Mon Apr 12 07:36:30 GMT +0000 2021 Last Received Packet Type: ACK Last Packet Sent: Mon Apr 12 07:36:30 GMT +0000 2021 Last Sent Packet Type: ACK Client IP Address: 172.168.10.12 Hardware Address: ae:cd:dc:41:1d:f7 Incoming Client Interface: ifl-0/0/3/1 Routing Instance: default Server IP Address: 121.0.0.2 Gateway IP Address: 172.168.56.1 Lease Time: 600 seconds Lease Start: Mon Apr 12 07:36:30 GMT +0000 2021 Lease Expires in: 361 seconds Last Packet Received: Mon Apr 12 07:36:30 GMT +0000 2021 Last Received Packet Type: ACK Last Packet Sent: Mon Apr 12 07:36:30 GMT +0000 2021 Last Received Sent Type: ACK
The following command displays information about the existing DHCP relay bindings in the system for a particular interface.
supervisor@rtbrick: op> show dhcp relay binding ifl-0/0/1/1 Interface Hardware address Gateway IP IP address Server IP Lease time Expires in ifl-0/0/1/1 e2:f6:ee:53:bb:6f 192.168.10.1 192.168.10.57 121.0.0.2 600 sec 591 sec ifl-0/0/1/1 e2:f6:ee:53:bb:8f 192.168.10.1 192.168.10.58 121.0.0.2 600 sec 595 sec
The following command displays the existing DHCP relay bindings in the system for a particular interface in detail.
supervisor@rtbrick: op> show dhcp relay binding ifl-0/0/1/1 detail Client IP Address: 192.168.10.202 Hardware Address : 1a:b7:43:59:89:f2 Incoming Client Interface : ifl-0/0/1/1 Routing Instance : default Server IP Address : 121.0.0.2 Gateway IP Address : 192.168.10.1 Lease Time : 291 sec Lease Start : Tue Jun 15 17:07:16 GMT +0000 2021 Lease Expires : 151 sec Last Packet Received : Tue Jun 15 17:07:16 GMT +0000 2021 Last Received Packet Type : ACK Last Packet Sent : Tue Jun 15 17:07:16 GMT +0000 2021 Last Sent Packet Type : ACK
3.1.4. Viewing DHCP Relay Statistics
The following command displays the total DHCP relay statistics in the system.
supervisor@rtbrick: op> show dhcp relay statistics Packets Received: DHCP DISCOVER : 15 DHCP OFFER : 2 DHCP REQUEST : 16 DHCP DECLINE : 0 DHCP ACK : 16 DHCP NAK : 0 DHCP RELEASE : 0 DHCP INFORM : 0 Errors: Packet decode error : 0 IP UDP header decode errors : 0 DHCP packet decode errors : 0 No binding drops : 0 No gateway IP drops : 0 Invalid packets from client : 0 Invalid packets from server : 0 Relay config missing : 0 Server config missing : 0 Server get failed : 15 Packet encode error : 0
The following command displays the existing DHCP relay statistics in the system on a particular interface.
supervisor@rtbrick: cfg> show dhcp relay statistics ifl-0/0/1/1 Interface: ifl-0/0/1/1 Client IP Address : 192.168.10.202 Hardware Address : 1a:b7:43:59:89:f2 Packets Received: DHCP DISCOVER : 15 DHCP OFFER : 2 DHCP REQUEST : 16 DHCP DECLINE : 0 DHCP ACK : 16 DHCP NAK : 0 DHCP RELEASE : 0 DHCP INFORM : 0 Errors: Invalid packets from client : 0 Invalid packets from server : 0 Relay config missing : 0 Server config missing : 0 Server get failed : 0 Packet encode errors : 0
3.2. Clear Commands
3.2.1. Clearing DHCP Relay Binding
The clear dhcp relay binding
command removes the binding state of a DHCP client.
supervisor@rtbrick: op> clear dhcp relay binding
3.2.2. Clearing DHCP Relay Statistics
The clear dhcp relay statistics
command resets all DHCP relay statistics.
supervisor@rtbrick: op> clear dhcp relay statistics
©Copyright 2021 RtBrick, Inc. All rights reserved. The information contained herein is subject to change without notice. The trademarks, logos and service marks ("Marks") displayed in this documentation are the property of RtBrick in the United States and other countries. Use of the Marks are subject to RtBrickās Term of Use Policy, available at https://www.rtbrick.com/privacy. Use of marks belonging to other parties is for informational purposes only.