To allow a DHCP client to communicate with other network devices, you need to configure a route in which the next hop address is the gateway address of the client. If the gateway address of the client is dynamically obtained from the DHCP server and the route is statically configured on the client, the static route must be manually modified when the gateway address changes. After the DHCP client is configured to dynamically obtain routing entries through DHCP, the next hop address in the static route is automatically updated when the gateway address changes, lowering maintenance costs.
A DHCP server can allocate routing entries to DHCP clients. On a device functioning as the DHCP client, you can set the priorities of routing entries allocated by the DHCP server so that the DHCP client can dynamically update its routing table.
system-view
ip route ip-address { mask | mask-length } interface-type interface-number dhcp [ preference-value ]
By default, a DHCP client does not obtain routing entries through DHCP.
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.
dhcp client default-route preference preference-value
The default priority of routing entries allocated by the DHCP server to DHCP clients is 60.