< Home

dhcp relay gateway-switch enable

Function

Using the dhcp relay gateway-switch enable command, you can enable DHCP relay gateway switching.

Using the undo dhcp relay gateway-switch enable command, you can disable DHCP relay gateway switching.

By default, DHCP relay gateway switching is disabled.

Format

dhcp relay gateway-switch enable

undo dhcp relay gateway-switch enable

Parameters

None

Views

Interface view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

The dhcp relay gateway-switch enable command is used on DHCP relay agents. This command allows a DHCP relay agent to use a secondary IP address as the gateway address to apply for IP addresses for users when it fails to use the primary IP address to apply for IP addresses.

Prerequisites

  • Global DHCP has been enabled by using the dhcp enable command in the system view.
  • DHCP relay has been enabled on an interface by using the dhcp select relay command.

Precautions

  • After VRRP is configured, the gateway address for the DHCP relay agent switches among IP addresses of the VRRP groups.
  • The gateway address switches from the primary IP address to a secondary IP address only when a user fails to obtain an IP address by using the primary IP address for at least three times and the interval between the last failure and first failure exceeds 24 seconds.
  • Before running this command on an interface, ensure that the interface has a primary IP address and at least one secondary IP address.
  • If a primary IP address and multiple secondary IP addresses are configured on an interface, the system tries the secondary IP addresses one by one until users successfully obtain IP addresses.

Example

# Enable DHCP relay gateway switching on VLANIF10.
<HUAWEI> system-view
[HUAWEI] dhcp enable
[HUAWEI] interface vlanif 10
[HUAWEI-Vlanif10] ip address 192.168.30.1 255.255.255.0
[HUAWEI-Vlanif10] ip address 192.168.31.1 255.255.255.0 sub
[HUAWEI-Vlanif10] dhcp select relay
[HUAWEI-Vlanif10] dhcp relay server-ip 192.168.20.1
[HUAWEI-Vlanif10] dhcp relay gateway-switch enable
# Enable DHCP relay gateway switching on GE0/0/1.
<HUAWEI> system-view
[HUAWEI] dhcp enable
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] undo portswitch
[HUAWEI-GigabitEthernet0/0/1] ip address 192.168.30.1 255.255.255.0
[HUAWEI-GigabitEthernet0/0/1] ip address 192.168.31.1 255.255.255.0 sub
[HUAWEI-GigabitEthernet0/0/1] dhcp select relay
[HUAWEI-GigabitEthernet0/0/1] dhcp relay server-ip 192.168.20.1
[HUAWEI-GigabitEthernet0/0/1] dhcp relay gateway-switch enable
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >