The dhcp relay giaddr source-interface command configures the source interface of DHCP relayed packets and enters the primary IP address of the interface into the giaddr field.
The undo dhcp relay giaddr source-interface command restores the default settings.
By default, the source interface of DHCP relayed packets is not configured and the IP address of the DHCP relay agent is entered into the giaddr field.
Only the S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support this command.
dhcp relay giaddr source-interface interface-type interface-number
undo dhcp relay giaddr source-interface
Parameter |
Description |
Value |
---|---|---|
interface-type interface-number |
Specifies the source interface of DHCP relayed packets.
|
- |
Usage Scenario
In a distributed VXLAN gateway scenario, the DHCP relay function is configured on VBDIF interfaces of all distributed gateways. The IP address of the VBDIF interface is entered into the giaddr field in the request packet sent from the DHCP relay agent to the DHCP server. The DHCP server sets the destination IP address of the response packet to the IP address of the VBDIF interface based on information of the giaddr field. However, the response packet from the DHCP server may be forwarded to other distributed gateways (rather than the device that sends the request packet) because IP addresses of VBDIF interfaces on distributed gateways are the same. As a result, the user cannot obtain an IP address.
To resolve this issue, you can configure the source interface of DHCP relayed packets on VBDIF interfaces of all distributed gateways. The DHCP relay agent then enters the primary IP address of the source interface into the giaddr field for communication with the DHCP server. The IP address of the source interface and the DHCP server can communicate with each other, and the IP address is unique among all distributed gateways. Therefore, the response packet from the DHCP server can accurately return to the corresponding distributed gateway.
Prerequisites
The DHCP relay function has been enabled using the dhcp select relay command in the VBDIF interface view.
Follow-up Procedure
By default, the DHCP server selects an IP address pool based on the giaddr field. After this command is configured, the primary IP address of the source interface is entered into the giaddr field. Because the primary IP address of the source interface and the IP address of the DHCP relay-enabled interface are on different network segments, if the DHCP server still selects an IP address pool based on the giaddr field, DHCP clients cannot properly communicate even if they have obtained IP addresses. The DHCP relay-enabled interface functions as the gateway for connected DHCP clients. Therefore, you need to run the dhcp relay information link-selection insert enable command to configure the function of inserting the Link-selection suboption of the Option82 field into DHCP relayed DHCP request packets. The IP address of the DHCP relay-enabled interface is entered into the Link-selection suboption. The DHCP server then selects an IP address pool based on the Link-selection suboption after receiving a request packet.
Precautions
<HUAWEI> system-view [HUAWEI] interface loopback 1 [HUAWEI-LoopBack1] ip address 10.1.1.1 24 [HUAWEI-LoopBack1] quit [HUAWEI] dhcp enable [HUAWEI] bridge-domain 100 [HUAWEI-bd100] quit [HUAWEI] interface vbdif 100 [HUAWEI-Vbdif100] dhcp select relay [HUAWEI-Vbdif100] dhcp relay giaddr source-interface loopback 1