ip relay giaddr

Function

The ip relay giaddr command configures a relay agent address in the interface view.

The undo ip relay giaddr command deletes the configured relay agent address.

By default, the primary IP address of the interface functions as the relay agent address.

Format

ip relay giaddr ip-address [ dhcp-option { code_60 [ option-text ] | code_1to59 | code_61to254 } ]

undo ip relay giaddr { all | ip-address [ dhcp-option { code_60 [ option-text ] | code_1to59 | code_61to254 } | all ] }

Parameters

Parameter Description Value
ip-address

Specifies the IP address of a relay agent. A maximum of 256 relay agent addresses can be configured for each relay interface.

The value is in dotted decimal notation.

dhcp-option code_60

Indicates DHCP Option 60. The Option 60 field carries the vendor identifier. A maximum of 100 Option 60 fields carrying different vendor identifiers can be configured to identify clients. The vendor identifier is configured based on that used on clients.

The value is an integer 60.

option-text

Specifies the Option 60 content.

The value is a string of 1 to 128 characters.

code_1to59

Specifies a DHCP option ID.

The value is an integer ranging from 1 to 59.

code_61to254

Specifies a DHCP option ID.

The value is an integer ranging from 61 to 254.

all

Indicates either of the following:

  • If ip-address is not specified, all relay agent addresses on the interface are deleted.
  • If ip-address is specified, all configurations of the specified relay agent address are deleted.

-

Views

100ge sub-interface view, 100GE interface view, 10GE sub-interface view, 10GE interface view, 200GE sub-interface view, 25GE sub-interface view, 25GE interface view, 400GE sub-interface view, 400GE interface view, 40GE sub-interface view, 40GE interface view, 50GE sub-interface view, 50GE interface view, Eth-Trunk sub-interface view, Eth-Trunk interface view, FlexE interface view, GE optical interface view, GE sub-interface view, GE interface view, GE electrical interface view, Global VE sub-interface view, PW-VE sub-interface view, VBDIF interface view, VE sub-interface view, VLANIF interface view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
dhcp write

Usage Guidelines

Usage Scenario

After a DHCP relay agent receives a DHCP Request message, it fills in the giaddr field with a relay agent address based on the association between DHCP options and relay agent addresses. The DHCP server then assigns IP addresses of different network segments to clients based on the relay agent address in the field.

The relay agent address can be either the primary or secondary IP address of the relay interface. If you configure an IP address other than the primary or secondary IP address, DHCP clients may not obtain IP addresses properly. A maximum of 255 secondary IP addresses can be configured for an interface, and therefore, a maximum of 256 relay agent addresses can be configured. If no relay agent address is associated with a DHCP option, the primary IP address is used as the relay agent address by default.

One relay agent address can be associated with many DHCP options, but one DHCP option can be associated with only one relay agent address.

Configuration Impact

A DHCP relay interface searches for a relay agent address based on DHCP options in the following ways:

  • If a DHCP message carries multiple DHCP options and these DHCP options have matching relay agent addresses, the relay agent address mapped to the DHCP option with the largest number is used.
  • If DHCP Option 60 is specified and a character string is configured for Option 60, the relay agent address mapped to Option 60 with the character string is preferred. If no matching relay agent address is found, the relay agent address mapped to Option 60 without a character string is used.
  • If no relay agent addresses map DHCP options, a relay agent address that is not mapped to any DHCP options is used.
  • If no relay agent address is configured, the primary IP address of the relay interface is used as the relay agent address by default.

Example

# Associate option 60 carrying the string abc with the relay agent address 1.1.1.1.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/0
[~HUAWEI-GigabitEthernet0/1/0] ip relay giaddr 1.1.1.1 dhcp-option 60 abc
# Associate option 12 with the relay agent address 1.1.1.1.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/0
[~HUAWEI-GigabitEthernet0/1/0] ip relay giaddr 1.1.1.1 dhcp-option 12
# Configure the IP address 1.1.1.1 of GE 0/1/0 as a relay agent address.
<HUAWEI> system-view
[~HUAWEI] interface GigabitEthernet 0/1/0
[~HUAWEI-GigabitEthernet0/1/0] ip relay giaddr 1.1.1.1
Copyright ? Huawei Technologies Co., Ltd.
Copyright ? Huawei Technologies Co., Ltd.
< Previous topic Next topic >