74
Configuring smart relay to specify the DHCP relay agent
address for the giaddr field
About smart relay
By default, the relay agent only encapsulates the primary IP address to the giaddr field of all
requests before relaying them to the DHCP server. The DHCP server then selects an IP address on
the same subnet as the address in the giaddr filed. If no assignable addresses on the subnet are
available, the DHCP server does not assign any IP address. The DHCP smart relay feature is
introduced to allow the DHCP relay agent to encapsulate secondary IP addresses when the DHCP
server does not send back a DHCP-OFFER message.
The relay agent initially encapsulates its primary IP address to the giaddr field before forwarding a
request to the DHCP server. If no DHCP-OFFER is received, the relay agent allows the client to send
a maximum of two requests to the DHCP server by using the primary IP address. If no
DHCP-OFFER is returned after two retries, the relay agent switches to a secondary IP address. If the
DHCP server still does not respond, the next secondary IP address is used. After the secondary IP
addresses are all tried and the DHCP server does not respond, the relay agent repeats the process
by starting from the primary IP address.
Procedure
1. Enter system view.
system-view
2. Enable the DHCP smart relay feature.
dhcp smart-relay enable
By default, the DHCP smart relay feature is disabled.
Specifying the source IP address for relayed
DHCP requests
About specifying the source IP address for relayed DHCP requests
This task is required if multiple relay interfaces share the same IP address or if a relay interface does
not have routes to DHCP servers. You can specify an IP address or the IP address of another
interface, typically the loopback interface, on the DHCP relay agent as the source IP address for
DHCP requests. The relay interface inserts the source IP address in the source IP address field as
well as the giaddr field in DHCP requests.
If multiple relay interfaces share the same IP address, you must also configure the relay interface to
support Option 82. Upon receiving a DHCP request, the relay interface inserts the subnet
information in sub-option 5 in Option 82. The DHCP server assigns an IP address according to
sub-option 5. The DHCP relay agent looks up the output interface in the MAC address table to
forward the DHCP reply.
Procedure
1. Enter system view.
system-view
2. Enter interface view.
interface interface-type interface-number
3. Specify the source IP address for DHCP requests.
dhcp relay source-address { ip-address | interface interface-type
interface-number }