Enable the DHCP relay function on an interface so that the interface functions as a DHCP relay agent.
system-view
interface interface-type interface-number [.subinterface-number ]
Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731S-H, S5731-S, S5731S-S, S6720-HI, S5732-H, S6730-H, S6730S-H, S6730-S, S6730S-S, S6720-EI, and S6720S-EI support sub-interfaces.
The interface is switched to Layer 3 mode.
By default, an Ethernet interface works in Layer 2 mode.
Only the S5720-EI, 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 switching between Layer 2 and Layer 3 modes.
ip address ip-address { mask | mask-length }ip address unnumbered interface interface-type interface-number
The DHCP relay function is configured on the user-side gateway interface typically. The IP address of the gateway interface must be on the same network segment as the address pool configured on the DHCP server; otherwise, DHCP clients cannot obtain IP addresses.
You can configure an interface to borrow an IP address from another interface in the scenario where clients and the DHCP relay agent are on different network segments, for example, CPEs function as DHCP clients and need to obtain public IP addresses, but no public IP address is configured on the DHCP relay agent to save IP address resources. To configure an interface to borrow an IP address from another interface, you must enable DHCP snooping on the interface or VLAN connecting to users. After DHCP snooping is enabled, the DHCP relay agent adds user network routes (UNRs) to clients when adding DHCP snooping binding entries and deletes UNRs to clients when deleting DHCP snooping binding entries. The number of clients cannot exceed the maximum number of DHCP snooping binding entries that can be learned. You can run the dhcp snooping max-user-number command to configure the maximum number of DHCP snooping binding entries that can be learned.
dhcp select relay
By default, the DHCP relay function is disabled on an interface.
When enabling the DHCP relay function on a sub-interface, run the arp broadcast enable command on the sub-interface to enable ARP broadcast. By default, ARP broadcast is not enabled on a VLAN tag termination sub-interface.