Provides instructions for configuring the IP DHCP smart-relay agent with a CLI template, including step-by-step procedures to enable and verify the feature on supported devices.
To forward UDP broadcasts to the DHCP server, configure helper addresses on the interface. If you have configured the secondary addresses on that interface and you want the router to step through each IP network when forwarding DHCP requests, use the ip dhcp smart-relay command.
If the smart relay agent forwarding is not configured, all requests are forwarded using only the primary IP address on the interface.
If the ip dhcp smart-relay command is configured, the relay agent counts the number of times that the client retries sending a request to the DHCP server when there is no DHCPOFFER message from the DHCP server. After three retries, the relay agent sets the gateway address to the secondary address. If the DHCP server still does not respond after three more retries, then the next secondary address is used as the gateway address.
For more information about using CLI templates, see CLI Add-On Feature Templates and CLI Templates.
Before you begin
-
To configure the IP DHCP smart-relay feature, configure the IP helper address on desired interfaces using
ip helper-addresscommand. You can use theservice dhcpcommand to enable the DHCP service or theno service dhcpcommand to disable it, depending on the requirement. -
The Cisco DHCP relay agent is enabled on an interface only when the
ip helper-addresscommand is configured. This command enables the DHCP broadcast to be forwarded to the configured DHCP server.
Procedure
| 1. | Enter SD-WAN configuration mode. Example:
|
|
| 2. | Enable DHCP server. Example:
|
|
| 3. | In the SD-WAN configuration mode, configure an interface type such as Gigabit Ethernet. Example:
|
|
| 4. | Enable the DHCP broadcast to be forwarded to the configured DHCP server. Example:
|
|
| 5. | Configure the DHCP relay agent to switch the gateway address to a secondary address when there is no DHCPOFFER message from a DHCP server. Example:
|
This is a DHCP smart-relay CLI configuration. In the example, the device forwards the DHCP broadcast received on Gigabitethernet interface 0/0 to the DHCP server (10.0.0.1), by inserting 192.168.255.254 in the gateway address field of the DHCP packet.
service dhcp
ip address 172.16.0.1 255.255.0.0
secondary ip address 192.168.255.254 255.255.0.0
interface GigabitEthernet0/0
ip helper-address 10.0.0.1
ip dhcp smart-relay
end