Hà Nội: NTT03, Line 1, Thống Nhất Complex, 82 Nguyễn Tuân, Thanh Xuân, Hà Nội. ● HCM: Số 31B, Đường 1, Phường An Phú, Quận 2 (Thủ Đức), TP HCM. ===> Đơn Vị Hàng Đầu Trong Lĩnh Vực Cung Cấp Thiết Bị Security - Network - Wifi - CCTV - Conference - Máy chủ Server - Lưu trữ Storge.
Danh mục sản phẩm

Configure the Function of a DHCP Relay

Configuration Condition

None

Configure a DHCP Relay

If multiple subnets exist in a network and the hosts of the subnets need to obtain configuration information such as IP address through the DHCP server, the hosts of the subnets communicate with the DHCP server through a DHCP relay to obtain IP addresses and other configuration information. If an interface is configured to work in DHCP relay mode, after the interface receives DHCP packets from a DHCP client, it relays the packet to the specified DHCP server. The DHCP server then allocates an IP address.

Table 3-18 Configuring a DHCP Relay

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the interface configuration mode.

interface interface-name

-

Configure the DHCP relay function.

ip dhcp relay

Mandatory.

By default, the DHCP relay function is not configured.

Configure the Option82 Function

Option82 is a trunk information option, which records the location of the DHCP client. If enabling the DHCP relay to support the Option 82 function, after the DHCP relay receives the request packet sent by the DHCP client to the DHCP server and the request packet does not have the Option 82 option, add Option 82 in the request packet, and forward to the DHCP server. If enabling the DHCP relay to support Option 82, and the request packet has the Option 82 option, perform the next processing according to the action configured by the command ip dhcp relay information strategy, and then, forward the packet to the server. If the DHCP response packet received by the DHCP relay contains the Option 82 option, delete the Option 82 option, and then, forward the packet to the DHCP client.

Table 3-19 Configuring the Option82 Function

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enable the DHCP relay to support the Option 82 option

ip dhcp relay information option

Mandatory

By default, do not enable DHCP relay to support Option 82.

Configure the processing policy when the DHCP relay receives the request packet with Option 82 sent by the client

ip dhcp relay information strategy{drop | keep | replace}

Optional

Use the replace action for the packet with Option 82.

Configure the Option82 function.

ip dhcp relay information option | remote-id { ascii ascii-string | hex hex-string }| circuit-id { ascii ascii-string | hex hex-string } }

Mandatory.

By default, the Option82 function is not configured.

Configure Source Address of DHCP Relay

DHCP relays the DHCP client to the source address of the server packet. By default, use the address of the egress interface of the route to the DHCP server. In some special environment, the DHCP server cannot communicate with the address.

Therefore, users can configure the source address of the DHCP relay packet to the DHCP server and the giaddr field in the packet through the ip dhcp relay source-address command. Users also can configure the source address of the DHCP relay to be the interface address of the received DHCP client packet through the ip dhcp relay source-address relay-address command.

Table 3-20 Configure the source address of the DHCP relay packet

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Configure the source address of the DHCP relay packet

ip dhcp relay source-address relay-address

Mandatory

By default, the source address of the DHCP relay packet is the egress interface address of the route to the DHCP server.

Enter the interface configuration mode

interface interface-name

-

Configure the source address of the DHCP relay packet

ip dhcp relay source-address ip-address

Mandatory

By default, the source address of the DHCP relay packet is the egress interface address of the route to the DHCP server.

note


  • The source address configured by the ip dhcp relay source-address ip-address command should be the interface address of the device. Meanwhile, the interface address should belong to the same vrf as the relay interface. Otherwise, the relay packet cannot be sent successfully.
  • If the ip dhcp relay source-address ip-address command is configured in the interface mode, and the ip dhcp relay source-address relay-address command is configured in the global mode, the priority of the former is higher than the latter. The DHCP relay will use the configured ip-address to fill in the source address of the packet sent by the DHCP relay to the DHCP server.

     

Configure the Address of the DHCP Server

When the interface receives the DHCP packet sent by the DHCP client, relay the packet to the configured DHCP server, which distributes the IP address.

Table 3-21 Configure the address of the DHCP server

Step

Command

Description

Enter the global configuration mode.

configure terminal

-

Enter the interface configuration mode interface interface-name -
Configure the address of the DHCP server

ip dhcp relay server-address ip-address

Mandatory

By default, do not configure the address of the DHCP server.