AR100, AR120, AR150, AR160, AR200, AR1200, AR2200, AR3200, and AR3600 V200R010 CLI-based Configuration Guide - IP Service
This document describes the concepts and configuration procedures of IP Service features on the device, and provides the configuration examples.
This document describes the concepts and configuration procedures of IP Service features on the device, and provides the configuration examples.
Configuring a DHCP Relay Agent
Enabling DHCP
Context
Before enabling the DHCP relay function, enable DHCP in the system view.
The dhcp enable command is the prerequisite for configuring DHCP-related functions, including DHCP relay, DHCP snooping, and DHCP server. These functions take effect only after the dhcp enable command is run. After the undo dhcp enable command is run, all DHCP-related configurations of the device are deleted. After DHCP is enabled again using the dhcp enable command, all DHCP-related configurations of the device are restored to the default configurations.
After DHCP is enabled, if STP is also enabled, address allocation may slow down. By default, STP is enabled. To disable STP, run the undo stp enable command.
Enabling the DHCP Relay Function
Context
Enable the DHCP relay function on an interface so that the interface functions as a DHCP relay agent.
Procedure
- Enter the system view.
system-view
- Enter the interface view or sub-interface view.
interface interface-type interface-number [.subinterface-number ]
- Configure an IP address for the interface.
ip address ip-address { mask | mask-length }
The DHCP relay function is configured on the user-side gateway interface typically. The IP address of the gateway interface must be on the same network segment as the address pool configured on the DHCP server; otherwise, DHCP clients cannot obtain IP addresses.
- Enable the DHCP relay function on the interface.
dhcp select relay
By default, the DHCP relay function is disabled on an interface.
When enabling the DHCP relay function on a sub-interface, run the arp broadcast enable command on the sub-interface to enable ARP broadcast on the VLAN tag termination sub-interface. By default, ARP broadcast is enabled on a VLAN tag termination sub-interface.
If DHCP relay is enabled in a super-VLAN, DHCP snooping cannot be enabled in this super-VLAN.
Specifying the DHCP Server IP Address
Context
You must specify the IP address of the DHCP server so that the DHCP relay agent can forward DHCP messages between the server and clients. Two methods are available for you to specify the DHCP server IP address: in the interface view and in the DHCP server group view. The former method is recommended if you configure the DHCP relay function on individual interfaces connected to DHCP servers that have different IP addresses. The latter method is recommended if you configure the DHCP relay function on multiple interfaces that connect to one DHCP server.
A maximum of 16 DHCP relay agents are allowed between a DHCP server and a DHCP client. If there are more than 16 DHCP relay agents, DHCP messages are discarded.
(Optional) Configuring Strategies for Processing Option 82 Information on a DHCP Relay Agent
Context
To enable a DHCP relay agent to accept, process, and forward DHCP messages that carry Option 82 information, you must configure the DHCP relay agent to trust and process this option.
You are advised to perform the configuration on a user-side device. If the DHCP relay agent connects to a DHCP snooping-enabled device, configure the strategies for processing Option 82 information on the DHCP snooping device. When a device functions as the DHCP snooping device, for details on how to perform the configuration, see Inserting the Option 82 Field in a DHCP Message in the Huawei AR Series V200R010 Configuration Guide - Security.
If the device functions as the first-hop DHCP relay agent, it can process Option 82 information. If the device functions as the second-hop or subsequent DHCP relay agent, it cannot process Option 82 information.
Procedure
- Enter the system view.
system-view
- Enable the DHCP relay agent to trust Option 82.
dhcp relay trust option82
By default, a DHCP relay agent does not trust Option 82.
When this function is enabled, the DHCP relay agent can receive and forward DHCP messages that carry Option 82. If the DHCP relay agent is disabled from trusting Option 82 using the undo dhcp relay trust option82 command, the device discards the DHCP messages carrying Option 82.
- Configure strategies
for processing Option 82 information on the DHCP relay agent.
Configure the DHCP relay agent to insert the Option 82 field to DHCP messages in a VLAN view. This configuration takes effect on all DHCP messages from this VLAN received on the interfaces of the DHCP relay agent.
Enter the VLAN view.
vlan vlan-id
Enable the DHCP relay agent to insert the Option 82 field to received DHCP messages.
dhcp option82 { insert | rebuild } enable
By default, a DHCP relay agent is disabled from inserting the Option 82 field to received DHCP messages.
Return to the system view.
quit
Configure the DHCP relay agent to insert the Option 82 field to DHCP messages in an interface view. This configuration takes effect on DHCP messages received on the specified interface.
Enter the interface view or sub-interface view.
interface interface-type interface-number [.subinterface-number ]
Enable the DHCP relay agent to insert the Option 82 field to received DHCP messages.
dhcp option82 { insert | rebuild } enable
By default, a DHCP relay agent is disabled from inserting the Option 82 field to received DHCP messages.
DHCP messages received on the DHCP relay agent may carry the Option 82 field. Select a strategy based on network requirements.
- When insert is configured: If a DHCP message does not carry the Option 82 field, the DHCP relay agent inserts the Option 82 field. If a DHCP message carries the Option 82 field, the DHCP relay agent checks whether the Option 82 field contains remote-id. If yes, the Option 82 field remains unchanged; if no, the DHCP relay agent inserts remote-id.
- When rebuild is configured: If a DHCP message does not carry the Option 82 field, the DHCP relay agent inserts the Option 82 field. If a DHCP message carries the Option 82 field, the DHCP relay agent deletes the original Option 82 field and inserts the locally configured Option 82 field.
Return to the system view.
quit
- (Optional) Set the format of the Option 82 field.
Configure the format of the Option 82 field in the system or interface view. If the configuration is performed in the system view, it takes effect on all interfaces of the device. If the configuration is performed in an interface view, it takes effect only on the specified interface.
All Option82 fields configured in the system view or in the same interface view share a length of 1-255 bytes. If their total length exceeds 255 bytes, some Option82 information will be lost.
There is no limit on the number of Option 82 fields configured on the device. However, a large number of Option 82 fields will occupy a lot of memory and prolong the device processing time. To ensure device performance, you are advised to configure Option 82 fields based on the service requirements and device memory size.
In the system view:
Configure the format of the Option 82 field.
dhcp option82 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] [ circuit-id | remote-id ] format { default | common | extend | user-defined text }
By default, the Option 82 field is in the default format.
In the interface view:
Enter the interface view.
interface interface-type interface-number
Configure the format of the Option 82 field.
dhcp option82 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] [ circuit-id | remote-id ] format { default | common | extend | user-defined text }
By default, the Option 82 field is in the default format.
Return to the system view.
quit
(Optional) Configuring Rate Limiting of DHCP Messages
Context
You can configure rate limiting of DHCP messages on the device to prevent DHCP message attacks. After rate limiting is configured, the device is allowed to process only a specified number of DHCP messages within a certain period and discards extra packets.
Rate limiting is configured for the DHCP messages sent by the clients, so you are advised to configure the rate limiting function on the device close to the user side. If the device functions as the DHCP relay and is connected to a DHCP snooping-enabled device, you are advised to configure the rate limiting function on the DHCP snooping-enabled device.
You can configure the rate limiting function in the system view, VLAN view, or interface view. The configuration in the interface view takes precedence over those in the VLAN view and global view; the configuration in the VLAN view takes precedence over that in the system view.
Verifying the DHCP Relay Agent Configuration
Procedure
- Run the display dhcp relay { all | interface interface-type interface-number } command to view information about the DHCP server or DHCP server group on the interface functioning as a DHCP relay agent.
- Run the display dhcp server group [ group-name ] command to view the configuration of the DHCP server group.