In a distributed VXLAN gateway scenario, the DHCP relay function is configured on VBDIF interfaces of distributed gateways. The value of the GIADDR field carried in a request packet sent from a DHCP relay agent to the DHCP server is the IP address of the VBDIF interface. When returning a response packet, the DHCP server figures out the network segment on which the DHCP client resides based on information of this 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.
Method 1: Configure the re-routing function on the distributed gateway.
After this function is enabled, the IP address of the VBDIF interface is still used for communication between the DHCP relay agent and DHCP server. When the DHCP relay agent sends a Request message, the VTEP IP address of the local device is carried in the Option 82 field to function as the return IP address; when the DHCP server sends a response message, this information is also carried in the message. When processing a response message from the DHCP server, the DHCP relay agent figures out whether the response message corresponds to the Request message sent from the distributed gateway based on the return IP address carried in the message. If so, the DHCP relay agent forwards the message to the client. If not, the DHCP relay agent performs re-routing based on the return IP address to forward the response message to the corresponding distributed gateway through a VXLAN tunnel.
Method 2: Configure the source interface of DHCP relayed messages and configure the function of inserting the Link-selection suboption of the Option 82 field into messages.
After the preceding configurations, the DHCP relay agent 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 message from the DHCP server can accurately return to the corresponding distributed gateway.
When the DHCP relay agent forwards a DHCP Request message, the Link-selection suboption of the Option 82 field is inserted in the message. The value of this suboption is the interface IP address of the DHCP relay agent. The DHCP server selects an address pool for the client based on the suboption to ensure that an IP address on the correct network segment can be allocated to the client.
Classification |
IP Address for Communication Between the DHCP Relay Agent and DHCP Server |
Advantage and Disadvantage |
---|---|---|
Method 1 |
IP address of the VBDIF interface |
|
Method 2 |
Primary IP address of the source interface |
|
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 function.
system-view
interface vbdif bd-id
The number of a VBDIF interface must match an existing BD ID.
Method 1: When the DHCP server is not capable of parsing the Link-selection suboption:
Configure the re-routing function for the DHCP relay agent on a distributed gateway.
dhcp relay anycast gateway re-route enable
By default, the re-routing function for the DHCP relay agent on a distributed gateway is disabled.
Method 2: When the DHCP server is capable of parsing the Link-selection suboption:
Configure the source interface of DHCP relayed messages and enters the primary IP address of the interface into the giaddr field.
dhcp relay giaddr source-interface interface-type interface-number
By default, the source interface of DHCP relayed messages is not configured and the IP address of the DHCP relay agent is entered into the giaddr field.
Ensure that the IP address of the source interface and the DHCP server can communicate with each other.
Configure the function of inserting the Link-selection suboption of the Option 82 field into DHCP messages.
dhcp relay information link-selection insert enable
By default, the Link-selection suboption of the Option 82 field is not inserted into DHCP messages.