< Home

dhcp relay server-ip

Function

The dhcp relay server-ip command configures a DHCP server address on an interface enabled with DHCP relay.

The undo dhcp relay server-ip command deletes the configured DHCP server addresses on an interface enabled with DHCP relay.

By default, no DHCP server address on an interface enabled with DHCP relay is configured.

Format

dhcp relay server-ip ip-address

undo dhcp relay server-ip { ip-address | all }

Parameters

Parameter

Description

Value

ip-address

Specifies the IP address of a DHCP server.

The value is in dotted decimal notation.

all

Deletes all the DHCP server addresses configured on an interface.

-

Views

Interface view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

This command applies to DHCP relay agents. When a DHCP client needs to send a DHCP Discover message to a DHCP server on a different network segment through a DHCP relay agent, you must configure the DHCP server address on the DHCP relay agent.

When a DHCP relay agent forwards a DHCP Discover message, it does not check whether the DHCP server status is Down. If multiple DHCP server addresses are configured on an interface, multiple DHCP servers respond with DHCP Offer messages to the DHCP client. However, the DHCP client uses the first received DHCP Offer message. As a result, IP addresses in the IP address pool on the first DHCP server are insufficient, but available IP addresses in the IP address pools on the other DHCP servers are not allocated. To make each DHCP server allocate the same number of IP addresses, a DHCP relay agent changes the forwarding order each time it forwards a DHCP Discover message, so that load balancing is implemented among DHCP servers. A DHCP relay agent forwards a DHCP Discover message as follows:
  • The DHCP relay agent forwards the message to all DHCP servers by default, and changes the forwarding order each time it forwards a DHCP Discover message.
  • You can configure the ip relay address cycle command to reduce the number of packets received by a DHCP server and lessen the load of a DHCP server. After this command is configured, the DHCP relay agent forwards a received DHCP Discover message to one DHCP server at a time, and forwards the DHCP Discover message to a different DHCP server each time it receives the message.

Prerequisites

DHCP relay has been enabled on the interface using the dhcp select relay command.

Precautions

If you run the dhcp relay server-ip command for multiple times, multiple DHCP server addresses are configured.

Each interface that is enabled with DHCP relay can be configured with a maximum of 20 DHCP server addresses.

Example

# Configure DHCP relay and two DHCP server addresses on VLANIF 10.
<HUAWEI> system-view
[HUAWEI] dhcp enable
[HUAWEI] vlan 10
[HUAWEI-vlan10] quit
[HUAWEI] interface vlanif 10
[HUAWEI-Vlanif10] dhcp select relay
[HUAWEI-Vlanif10] dhcp relay server-ip 10.1.1.2
[HUAWEI-Vlanif10] dhcp relay server-ip 10.1.1.3
# Configure DHCP relay and two DHCP server addresses 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] dhcp select relay
[HUAWEI-GigabitEthernet0/0/1] dhcp relay server-ip 10.1.1.2
[HUAWEI-GigabitEthernet0/0/1] dhcp relay server-ip 10.1.1.3
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >