DHCP Snooping
DHCP Snooping
DHCP Snooping
< Home
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 1/35
16/02/2018 HedEx Startpage
Principles
Application
Configuration Notes
Default Configuration
DHCP snooping allows DHCP clients to obtain IP addresses from authorized DHCP servers, and records mappings between IP addresses and
MAC addresses of DHCP clients to a binding table.
Configuring DHCP Snooping Attack Defense
After basic DHCP snooping functions are configured, DHCP clients can obtain IP addresses from the authorized DHCP server, preventing
bogus DHCP server attacks on the network. However, many other DHCP attacks exist on the network. The administrator can configure
DHCP snooping attack defense on the device as required.
Inserting the Option 82 Field in a DHCP Message
You can configure a device to insert the Option 82 field in a DHCP message to notify the DHCP server of the DHCP client location.
Configuring the LDRA to Detect Client Locations
You can configure the LDRA to notify the DHCP server of the DHCPv6 client location.
Inserting the Option 18 or Option 37 Field in a DHCPv6 Message
You can configure a device to insert the Option 18 or Option 37 field in a DHCPv6 message to notify the DHCP server of the DHCPv6 client
location.
Maintaining DHCP Snooping
Configuration Examples
Common Misconfigurations
FAQ
References
1.1 Overview
Definition
The Dynamic Host Configuration Protocol (DHCP) snooping feature ensures that DHCP clients obtain IP addresses from authorized DHCP servers and
records mappings between IP addresses and MAC addresses of DHCP clients, preventing DHCP attacks on the network.
Purpose
Some attacks are launched on DHCP (RFC 2131). These attacks include the bogus DHCP server attack, DHCP server DoS attack, and bogus DHCP
message attack.
DHCP snooping is equivalent to a firewall between DHCP clients and the DHCP server to prevent DHCP attacks on the network, ensuring security for
communication services.
Benefits
The device can defend against DHCP attacks on the network. The DHCP attack defense capability enhances device reliability and ensures stable
network operating.
Users are provided with more stable services on a more secure network.
1.2 Principles
DHCP Snooping Basics
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 2/35
16/02/2018 HedEx Startpage
< Home
The device receives DHCP ACK messages, NAK messages, and Offer messages through the trusted interface. In addition, the device forwards
the DHCP Request messages from DHCP clients to the valid DHCP server through the trusted interface.
The device discards DHCP ACK messages, NAK messages, and Offer messages on untrusted interfaces.
When DHCP snooping is enabled on a Layer 2 access device, as shown in Figure 1, the interface directly or indirectly connected to the valid DHCP server
is generally configured as a trusted interface, such as if1, and other interfaces are configured as untrusted interfaces, such as if2. The DHCP Request
messages from DHCP clients are forwarded through the trusted interface, so DHCP clients can only obtain IP addresses from the valid DHCP server.
Bogus DHCP servers cannot assign IP addresses to DHCP clients.
Figure 1 DHCP Snooping trust
In Figure 2, a PC connecting to a Layer 2 access device obtains an IP address automatically. The process is as follows:
For example, when receiving a DHCP ACK message for PC1 in Figure 2, the Layer 2 access device obtains IP address 192.168.1.253, MAC address
MACA, and interface if3 connected to PC1, and then generates a DHCP snooping binding entry for PC1.
Figure 2 DHCP Snooping binding table
The DHCP snooping binding entries are aged out when the DHCP release expires, or the entries are deleted when users send DHCP Release packets to
release IP addresses.
The DHCP snooping binding table records the mapping between IP addresses and MAC addresses of DHCP clients. The device can check DHCP
messages against the DHCP snooping binding table to prevent attacks initiated by unauthorized users.
To ensure that the device obtains parameters such as MAC addresses for generating a DHCP snooping binding table, configure DHCP snooping on the
Layer 2 access devices or the first DHCP relay agent from the device to the DHCP server.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 3/35
16/02/2018 HedEx Startpage
When DHCP snooping is enabled on a DHCP relay agent, a trusted interface does not need to be configured on the DHCP relay agent. After receiving
DHCP Request messages from users, the DHCP relay agent converts the source/destination IP addresses and MAC addresses, and forwards the messages
to the valid DHCP server in unicast mode. Therefore, the DHCP ACK messages received by the DHCP relay agent are valid, and the DHCP snooping
binding entries generated by the DHCP relay agent are correct.
Implementation
As a DHCP relay agent or an access device on the Layer 2 network, the device supports the Option 82 field after DHCP snooping is enabled. The device
inserts the Option 82 field to a DHCP Request message in two modes:
Insert mode: Upon receiving a DHCP Request message without the Option 82 field, the device inserts the Option 82 field. If the DHCP Request
message contains the Option 82 field, the device checks whether the Option 82 field contains a remote ID. If so, the device retains the Option 82
field; if not, the device inserts a remote ID.
Rebuild mode: Upon receiving a DHCP Request message without the Option 82 field, the device inserts the Option 82 field. If the DHCP
Request message contains the Option 82 field, the device deletes the original Option 82 field and inserts the Option 82 field set by the
administrator.
The device handles the reply packets from the DHCP server in the same way regardless of whether the Insert or Rebuild method is used.
If the DHCP reply packets do not contain the Option 82 field, the device directly forwards the packets.
Implementation
The working mechanism of the LDRA is similar to the working mechanism of DHCPv6 relay. When receiving a DHCPv6 request from a client, the
LDRA-enabled device encapsulates the client location information (such as the network-side interface on the client) in a Relay-Forward message, and
forwards the message to the DHCPv6 server. The DHCPv6 server obtains the location information of the client, and accordingly assigns an IP address,
QoS policy, and access control policy for the client.
Figure 1 shows the LDRA interaction process.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 4/35
16/02/2018 HedEx Startpage
Figure 1 LDRA interaction process
For details about the Relay-Forward and Relay-Reply messages, see DHCPv6 Packets in "DHCPv6 Configuration" in the S1720&S2700&S5700&S6720
V200R010C00 Configuration Guide-IP Service.
NOTE:
The device supports the Option 18 and Option 37 fields only after DHCPv6 snooping is enabled. For details, see Inserting the Option 18 or Option 37 Field in a DHCPv6 Message.
1.3 Application
Defense Against Bogus DHCP Server Attacks
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 5/35
16/02/2018 HedEx Startpage
In Figure 1, authorized and unauthorized DHCP servers can receive DHCP Discover messages broadcast by DHCP clients.
Figure 1 DHCP client sending DHCP Discover messages
If a bogus DHCP server sends a bogus DHCP Reply message with the incorrect gateway address, Domain Name System (DNS) server address, and IP
address to a DHCP client, as shown in Figure 2, the DHCP client cannot obtain the correct IP address and required information. The authorized user then
fails to access the network and user information security is affected.
Figure 2 Bogus DHCP server attack
Solution
To prevent attacks from a bogus DHCP server, configure the trusted interface and untrusted interfaces on the device.
You can configure the interface directly or indirectly connected to the authorized DHCP server as the trusted interface and other interfaces as untrusted
interfaces. The device then discards DHCP Reply messages received through untrusted interfaces, preventing bogus DHCP server attacks, as shown in
Figure 3.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 6/35
16/02/2018 HedEx Startpage
Solution
To prevent the DHCP server DoS attacks, set the maximum number of access DHCP clients allowed on the device or an interface after enabling DHCP
snooping on the device. When the number of DHCP clients reaches the maximum value, DHCP clients cannot obtain the IP address through the device or
interface.
You can enable the device to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message. If the two
values match, the message is forwarded; if not, the message is discarded.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 7/35
16/02/2018 HedEx Startpage
The DHCP Relay Agent Information Option (Option 82) field records the location of a DHCP client. A DHCP snooping-enabled device or a DHCP relay
agent inserts the Option 82 field to a DHCP Request message to notify the DHCP server of the DHCP client location. Based on the Option 82 field, the
DHCP server can properly assign an IP address and other configurations to the DHCP client, ensuring DHCP client security.
In Figure 1, the clients use the DHCP to obtain IP addresses. To improve network security, the administrator configures the device to control network
access of clients connected to Interface1.
The DHCP server cannot detect the DHCP client location based only on the DHCP Request message. As a result, users in the same VLAN have the same
rights to access network resources.
To address this problem, the administrator can enable the Option 82 field after DHCP snooping is enabled on SwitchA. Upon receiving a DHCP Request
message to apply for an IP address, SwitchA inserts the Option 82 field in the message to notify the DHCP server of the DHCP client location, including
the MAC address, VLAN ID, and interface number of the client. The DHCP server can properly assign an IP address and other configurations to the client
based on the IP address assignment or security policies on the server.
The Option 82 field records the location of a DHCP client and is encapsulated in a DHCP Request message that is sent to the DHCP server. To deploy
different IP addresses or security policies for different clients, the DHCP server must support the Option 82 field and be configured with IP address
assignment or security policies.
In traditional IPv6 address allocation process, the DHCPv6 server cannot obtain the physical locations of clients, so the server cannot assign specified IP
addresses or policies to users on a certain interface.
To solve this problem, the administrator enables DHCP snooping and the LDRA functions on the Switch. The Switch then can obtain the location
information of clients and forward the information to the DHCPv6 server. The server assigns IP addresses and security policies to clients based on the
client location information.
The LDRA function only records the client location information and forwards the information to the DHCPv6 server through Relay-Forward messages.
The differentiated policies for IP address allocation, accounting, and access control are configured on the DHCPv6 server.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 8/35
16/02/2018 HedEx Startpage
License Support
DHCP snooping can be available only after the S1720GW and S1720GWR have the license loaded. DHCP snooping is available on other models without
loading the license.
For details about how to apply for a license, see S Series Switch License Use Guide.
Version Support
S2710SI V100R006(C03&C05)
S5710-C-LI V200R001C00
NOTE:
To know details about software mappings, see Version Mapping Search for Huawei Switches.
If the number of online users on the device reaches the maximum number of entries in the DHCP snooping binding table, the offline users cannot
go online.
On an S5720HI, the DHCP snooping function applies to wired users only.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%2… 9/35
16/02/2018 HedEx Startpage
Option 82 Disabled
Static MAC address entries generated based on dynamic DHCP snooping binding Disabled
entries
Maximum rate of sending DHCP messages to the processing unit 100 pps
Checking DHCP messages against the DHCP snooping binding table Disabled
Checking whether the CHADDR field matches the source MAC address in the Disabled
header of a DHCP Request message
Pre-configuration Tasks
Before configuring DHCP snooping, configure the DHCP function (For the DHCP configuration, see DHCP Configuration in the
S1720&S2700&S5700&S6720 V200R010C00 Configuration Guide - IP Service.)
Configuration Process
The basic function of DHCP snooping is configured on the Layer 2 access device or the first DHCP relay agent from the device.
Enabling DHCP Snooping
(Optional) Configuring the Device to Clear the MAC Address Entry Immediately When a User Is Disconnected
(Optional) Configuring the Device to Discard DHCP Request Messages with Non-0 GIADDR Field
DHCP snooping ensures security of the DHCP service. Before configuring DHCP snooping functions, you need to enable DHCP snooping.
You must enable DHCP snooping in the system view, and then on an interface or in a VLAN.
As shown in Figure 1, Switch_1 is a Layer 2 access device that forwards the DHCP Request packets from user PCs to the DHCP server. For example, when
you configure DHCP snooping on Switch_1, note the following:
Enable DHCP globally using the dhcp enable command before enabling DHCP snooping.
After DHCP snooping is globally enabled, enable DHCP snooping on the interfaces (such as if1, if2, and if3) connecting to users or the VLAN
(such as VLAN 10) to which these interfaces belong.
When multiple user PCs belong to the same VLAN, you can enable DHCP snooping in this VLAN to simplify configuration.
NOTE:
DHCP snooping does not support the BOOTP protocol. However, diskless workstations use the BOOTP protocol. Therefore, DHCP snooping binding entries cannot be generated for
diskless workstations. IPSG and DAI are implemented based on binding entries. To use them on a diskless workstation, configure static binding entries by running the user-bind static
command.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 10/35
16/02/2018 HedEx Startpage
Perform the following steps on the Layer 2 access device or the first DHCP relay agent from the device.
Procedure
1. Run:
system-view
NOTE:
This step is only supported by the S5720HI supports.
DHCPv6 snooping does not support this command.
The device management interfaces do not support DHCP snooping on a VPLS network.
a. Run:
dhcp snooping enable vlan { vlan-id1 [ to vlan-id2 ] } &<1-10>
a. Run:
vlan vlan-id
b. Run:
dhcp snooping enable
If you run this command in the VLAN view, the command takes effect on all the DHCP messages received by all interfaces from the specified
VLAN. If you run this command in the interface view, the command takes effect on all the DHCP messages received by the specified interface.
To enable DHCP clients to obtain IP addresses from authorized DHCP servers, as shown in Figure 1, configure the interfaces (such as if0) directly or
indirectly connected to the DHCP servers trusted by the administrator as the trusted interfaces, and other interfaces (such as if2) as untrusted interfaces.
This prevents bogus DHCP servers from assigning IP addresses to DHCP clients.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 11/35
16/02/2018 HedEx Startpage
After enabling DHCP snooping on the interface or in the VLAN connected to the user, configure the interface connected to the DHCP server as the trusted
interface, so that the dynamic DHCP snooping binding table is generated.
Figure 1 DHCP snooping networking diagram
Procedure
1. Run:
system-view
a. Run:
interface interface-type interface-number
b. Run:
dhcp snooping trusted
a. Run:
vlan vlan-id
b. Run:
dhcp snooping trusted interface interface-type interface-number
If you run this command in the VLAN view, the command takes effect only on DHCP messages in this VLAN received from interfaces that
belong to this VLAN. If you run the dhcp snooping trusted command in the interface view, the command takes effect for all the DHCP
messages received on the specified interface.
When a mobile user goes online through interface A, goes offline, and then goes online through interface B, the user sends a DHCP Discover message to
apply for an IP address. By default, if DHCP snooping is enabled on the device, the device allows the user to go online and updates the DHCP snooping
binding entries. However, this may bring security risks. For example, if an attacker pretends to be an authorized user and sends a DHCP Discover
message, the authorized user cannot access the network after the DHCP snooping binding table is updated. To prevent such attacks, disable the DHCP
snooping location transition function. After this function is disabled, the device discards the DHCP Discover messages sent by a user who has an entry in
the DHCP snooping binding table (user's MAC address exists in the DHCP snooping binding table) through another interface.
NOTE:
Interface A and interface B must belong to the same VLAN.
Procedure
1. Run:
system-view
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 12/35
16/02/2018 HedEx Startpage
undo dhcp snooping user-transfer enable
Location transition is disabled for DHCP snooping users.
By default, location transition is enabled for DHCP snooping users.
When a DHCP snooping-enabled device receives a DHCP Release message sent from a DHCP client, the device deletes the binding entry of the DHCP
client. However, if a client is disconnected and cannot send a DHCP Release message, the device cannot immediately delete the binding entry of the
DHCP client.
After association between ARP and DHCP snooping is enabled, the DHCP snooping-enabled device performs an ARP probe to detect the IP address
when the ARP entry mapping an IP address ages. If the DHCP client is not detected after a specified number of probes, the device deletes the ARP entry.
The device then performs an ARP probe again to detect the IP address. If the DHCP client still cannot be detected after a specified number of probes, the
device deletes the binding entry of the DHCP client.
NOTE:
The device supports association between ARP and DHCP snooping only when the device functions as a DHCP relay agent.
Procedure
1. Run:
system-view
If a DHCP client is disconnected but its MAC address entry is not aged, the device forwards the message whose destination address is the IP address of
the DHCP client based on the dynamic MAC address entry. This deteriorates device performance.
The DHCP client sends a DHCP Release message when it is disconnected. Upon receiving the message, the device immediately deletes the DHCP
snooping binding entry of the DHCP client. You can enable the device to delete the mapping MAC address entry when a dynamic DHCP snooping
binding entry is deleted.
Procedure
1. Run:
system-view
The device deleted the MAC address entry of a DHCP client when the dynamic binding entry was deleted.
By default, the device does not delete the MAC address entry of a DHCP client when the dynamic binding entry was deleted.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 13/35
16/02/2018 HedEx Startpage
The GIADDR field in a DHCP Request message records the IP address of the first DHCP relay agent through which the DHCP Request message passes.
If the DHCP server and client are on different network segments, the first DHCP relay agent fills its own IP address in the GIADDR field before
forwarding the DHCP Request message. The DHCP server then locates the DHCP client and selects an appropriate address pool to assign an IP address to
the client.
To ensure that the device obtains parameters such as MAC addresses for generating a binding table, as shown in Figure 1, enable DHCP snooping on Layer
2 access devices or the first DHCP relay agent (DHCP Relay1). Then, the GIADDR field in the DHCP Request messages received by the DHCP
snooping-enabled device is 0. If the GIADDR field is not 0, the message is considered to be invalid and discarded. This function is recommended if
DHCP snooping is enabled on the DHCP relay agent.
In normal situations, the GIADDR field in DHCP messages sent by user PCs is 0. If the GIADDR field is not 0, the DHCP server cannot correctly
allocate IP addresses. To prevent attackers from applying for IP addresses with the DHCP messages containing a non-0 GIADDR field, you are advised to
configure this function.
Figure 1 DHCP message processing when multiple DHCP relay agents exist (DHCP Request message is used as an example)
Procedure
1. Run:
system-view
a. Run:
dhcp snooping check dhcp-giaddr enable vlan { vlan-id1 [ to vlan-id2 ] } &<1-10>
The device is enabled to check whether the GIADDR field in a DHCP Request message is 0.
By default, the device does not check whether the GIADDR field in a DHCP Request message is 0.
a. Run:
vlan vlan-id
b. Run:
dhcp snooping check dhcp-giaddr enable
The device is enabled to check whether the GIADDR field in a DHCP Request message is 0.
By default, the device does not check whether the GIADDR field in a DHCP Request message is 0.
If you run this command in the VLAN view, the command takes effect on all the DHCP messages in the specified VLAN received by all the
interfaces on the device. If you run this command in the interface view, the command takes effect on all the DHCP messages received by the
specified interface.
Procedure
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 14/35
16/02/2018 HedEx Startpage
Run the display dhcp snooping configuration [ vlan vlan-id | interface interface-type interface-number ] command to view the DHCP
snooping configuration.
Run the display dhcp snooping [ interface interface-type interface-number | vlan vlan-id ] command to view DHCP snooping running
information.
Run the display dhcp snooping statistics command to check statistics on the received DHCP messages.
Prerequisites
Basic DHCP snooping functions have been completely configured.
Enabling DHCP Server Detection
After DHCP snooping is enabled and a trusted interface is configured, the device enables DHCP clients to obtain IP addresses from the authorized DHCP
server, to prevent bogus DHCP server attacks. However, the location of the bogus DHCP server cannot be detected, which brings security risks on the
network.
After DHCP server detection is enabled, the DHCP snooping-enabled device checks information about the DHCP server, such as the IP address and port
number, in the DHCP Reply messages and records the information to the log. The network administrator identifies whether bogus DHCP servers exist on
the network based on logs.
Procedure
1. Run:
system-view
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 15/35
16/02/2018 HedEx Startpage
On a DHCP network, if an attacker sends a large number of DHCP messages to the device within a short time, the device performance may deteriorate
and the device may not work normally. To prevent DHCP flood attacks, enable the device to check the rate of sending DHCP messages to the processing
unit.
Procedure
1. Run:
system-view
a. Run:
dhcp snooping check dhcp-rate enable
The device is enabled to check the rate of sending DHCP messages to the processing unit.
By default, the device does not check the rate of sending DHCP messages to the processing unit.
Running the dhcp snooping check dhcp-rate enable vlan { vlan-id1 [ to vlan-id2 ] }&<1-10> command in the system view is
equivalent to running the dhcp snooping check dhcp-rate enable command in the VLAN view.
b. Run:
dhcp snooping check dhcp-rate rate
The maximum rate of sending DHCP messages to the processing unit is set.
By default, the maximum rate of sending global DHCP messages to the processing unit is 100 pps, which is the same as the
maximum rate of sending DHCP messages on interfaces to the processing unit.
a. Run:
vlan vlan-id
The device is enabled to check the rate of sending DHCP messages to the processing unit.
By default, the device does not check the rate of sending DHCP messages to the processing unit.
Running the dhcp snooping check dhcp-rate enable vlan { vlan-id1 [ to vlan-id2 ] }&<1-10> command in the system view is
equivalent to running the dhcp snooping check dhcp-rate enable command in the VLAN view.
c. Run:
dhcp snooping check dhcp-rate rate
The maximum rate of sending DHCP messages to the processing unit is set.
By default, the maximum rate of sending global DHCP messages to the processing unit is 100 pps, which is the same as the
maximum rate of sending DHCP messages on interfaces to the processing unit.
a. Run:
interface interface-type interface-number
The device is enabled to check the rate of sending DHCP messages to the processing unit.
By default, the device does not check the rate of sending DHCP messages to the processing unit.
c. Run:
dhcp snooping check dhcp-rate rate
The maximum rate of sending DHCP messages to the processing unit is set.
By default, the maximum rate of sending global DHCP messages to the processing unit is 100 pps, which is the same as the
maximum rate of sending DHCP messages on interfaces to the processing unit.
3. (Optional) Configure the trap function in the system view or interface view.
In the system view:
a. Run:
dhcp snooping alarm dhcp-rate enable
The device is enabled to generate an alarm when the number of discarded DHCP messages reaches the threshold.
If you run this command in the system view, the command takes effect for all the interfaces of the device.
By default, the device does not generate an alarm when the number of discarded DHCP messages reaches the threshold.
b. Run:
dhcp snooping alarm dhcp-rate threshold threshold
The alarm threshold for the number of discarded DHCP messages is set on the interface.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 16/35
16/02/2018 HedEx Startpage
By default, the global alarm threshold for the number of discarded DHCP packets is 100, and the threshold on an interface
is the same as the configuration in system view.
If the alarm threshold is set in the system view and interface view, the smaller value takes effect.
a. Run:
interface interface-type interface-number
The device is enabled to generate an alarm when the number of discarded DHCP messages reaches the threshold.
If you run this command in the system view, the command takes effect for all the interfaces of the device.
By default, the device does not generate an alarm when the number of discarded DHCP messages reaches the threshold.
c. Run:
dhcp snooping alarm dhcp-rate threshold threshold
The alarm threshold for the number of discarded DHCP messages is set on the interface.
By default, the global alarm threshold for the number of discarded DHCP packets is 100, and the threshold on an interface
is the same as the configuration in system view.
If the alarm threshold is set in the system view and interface view, the smaller value takes effect.
If an attacker sends a bogus DHCP Request message to the DHCP server to extend the lease, the IP address cannot be released after the lease expires and
authorized users cannot use the IP address. If the attacker forges a DHCP Release message of an authorized user and sends it to the DHCP server, the
authorized user may be disconnected.
After a DHCP snooping binding table is generated, the device checks DHCP Request and Release messages against the binding table. Only DHCP
messages that match entries are forwarded. This prevents unauthorized users from sending bogus DHCP Request messages or Release messages to extend
the lease or to release IP addresses.
Procedure
1. Run:
system-view
a. Run:
dhcp snooping check dhcp-request enable vlan { vlan-id1 [ to vlan-id2 ] }&<1-10>
The device is enabled to check DHCP messages in specified VLANs against the DHCP snooping binding table.
By default, the device does not check DHCP messages against the DHCP snooping binding table.
a. Run:
vlan vlan-id
b. Run:
dhcp snooping check dhcp-request enable
The device is enabled to check DHCP messages against the DHCP snooping binding table.
By default, the device does not check DHCP messages against the DHCP snooping binding table.
If you run this command in the VLAN view, the command takes effect on all the DHCP messages in the specified VLAN received by
all the interfaces on the device.
c. Run:
quit
3. Enable the trap function for DHCP snooping in the interface view.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 17/35
16/02/2018 HedEx Startpage
a. Run:
interface interface-type interface-number
b. Run:
dhcp snooping alarm dhcp-request enable
An alarm is generated when the number of DHCP messages that are discarded because they do not match DHCP snooping binding
entries reaches the threshold.
By default, the trap function for discarded DHCP messages is disabled.
c. Run:
quit
4. (Optional) Set the alarm threshold for the number of messages discarded by DHCP snooping in the system view or interface view.
In the system view:
a. Run:
dhcp snooping alarm threshold threshold
The alarm threshold for the number of discarded messages by DHCP snooping is set.
If you run this command in the system view, the command takes effect for all the interfaces of the device.
By default, the alarm threshold for the number of messages discarded by DHCP snooping is 100.
a. Run:
interface interface-type interface-number
b. Run:
dhcp snooping alarm dhcp-request threshold threshold
The alarm threshold for the number of messages discarded because they do not match the DHCP snooping binding entries is set.
By default, an alarm is generated in the system when at least 100 DHCP snooping messages are discarded, and the alarm threshold
on an interface is set using the dhcp snooping alarm threshold command in the system view.
If the alarm threshold is set in the system view and interface view, the smaller value takes effect.
Malicious use of IP addresses exhausts IP addresses in the IP address pool, so authorized users cannot obtain IP addresses. The DHCP server generally
identifies the MAC address of a DHCP client based on the CHADDR (client hardware address) field in the DHCP Request message. If attackers
continuously apply for IP addresses by changing the CHADDR field, IP addresses in the address pool on the DHCP server may be exhausted. As a result,
authorized users cannot obtain IP addresses.
To prevent DHCP users on some interfaces from applying IP addresses maliciously, you can limit the number of DHCP snooping binding entries that can
be learned by an interface to control the number of online users. When the number of DHCP snooping binding entries reaches the maximum value, no
DHCP client can obtain an IP address through the interface. To prevent attackers from continuously changing the CHADDR field in the DHCP Request
message, enable the device to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP message. If the two
values match, the message is forwarded; if the two values do not match, the message is discarded.
Procedure
1. Run:
system-view
a. Run:
dhcp snooping max-user-number max-user-number vlan { vlan-id1 [ to vlan-id2 ] } &<1-10>
The maximum number of DHCP snooping binding entries is set on the device.
After running this command, the value specified in this command is the total number of DHCP snooping binding entries learned by
all interfaces on the device.
By default, the maximum number of DHCP snooping binding entries that can be learned on an interface is 256 for S1720GFR,
S2720, and S2750EI, 512 for S1720GW, S1720GWR, S1720GW-E, S1720GWR-E, S5720LI, S5720S-LI, S5700LI and S5710-X-LI,
and 1024 for other models.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 18/35
16/02/2018 HedEx Startpage
b. (Optional) Run:
dhcp snooping user-alarm percentage percent-lower-value percent-upper-value
The alarm thresholds for the percentage of DHCP snooping binding entries are configured.
By default, the lower alarm threshold for the percentage of DHCP snooping binding entries is 50, and the upper alarm threshold for
the percentage of DHCP snooping binding entries is 100.
a. Run:
vlan vlan-id
b. Run:
dhcp snooping max-user-number max-user-number
The maximum number of DHCP snooping binding entries is set on the interface.
If you run this command in the VLAN view, the command takes effect for all the interfaces in the VLAN.
By default, the maximum number of DHCP snooping binding entries that can be learned on an interface is 256 for S1720GFR,
S2720, and S2750EI, 512 for S1720GW, S1720GWR, S1720GW-E, S1720GWR-E, S5720LI, S5720S-LI, S5700LI and S5710-X-LI,
and 1024 for other models.
If you run this command in the VLAN view, the command takes effect on all the DHCP messages in the specified VLAN received by
all the interfaces on the device. If you run this command in the interface view, the command takes effect on all the DHCP messages
received by the specified interface.
If you run this command in the system view, VLAN view, and the interface view, the smallest value takes effect.
The S1720GFR , S2720, and S2750EI on an IPv4 network allow a maximum of 256 users to go online after DHCP snooping is
enabled. If more than 256 users need to be online at the same time, disable DHCP snooping.
3. Enable the device to check the CHADDR field in the message in the system view, VLAN view, or interface view.
In the system view:
a. Run:
dhcp snooping check dhcp-chaddr enable vlan { vlan-id1 [ to vlan-id2 ] } &<1-10>
The device is enabled to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP
message.
By default, the device does not check whether the MAC address in the Ethernet frame header matches the CHADDR field in the
DHCP message.
b. (Optional) Run:
dhcp snooping alarm threshold threshold
The global alarm threshold for the number of discarded messages by DHCP snooping is set.
If you run this command in the system view, the command takes effect for all the interfaces on the device.
By default, the global alarm threshold for the number of messages discarded by DHCP snooping is 100.
a. Run:
vlan vlan-id
b. Run:
dhcp snooping check dhcp-chaddr enable
The device is enabled to check whether the MAC address in the Ethernet frame header matches the CHADDR field in the DHCP
message.
By default, the device does not check whether the MAC address in the Ethernet frame header matches the CHADDR field in the
DHCP message.
If you run the dhcp snooping check dhcp-chaddr enable command in the VLAN view, the command takes effect on all the DHCP
messages in the specified VLAN received by all the interfaces on the device. If you run the dhcp snooping check dhcp-chaddr
enable command in the interface view, the command takes effect for all the DHCP messages received on the interface.
c. (Optional) Run:
dhcp snooping alarm dhcp-chaddr enable
The device is configured to generate a DHCP snooping alarm when the number of packets dropped in CHADDR field check reaches
the alarm threshold.
By default, the DHCP snooping alarm function is disabled.
NOTE:
This command can only be used in the interface view.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 19/35
16/02/2018 HedEx Startpage
d. (Optional) Run:
dhcp snooping alarm dhcp-chaddr threshold threshold
The alarm threshold for the number of DHCP messages discarded because the CHADDR field in the DHCP messages does not
match the source MAC address in the Ethernet frame header is set.
By default, an alarm is generated in the system when at least 100 DHCP snooping messages are discarded, and the alarm threshold
on an interface is set using the dhcp snooping alarm threshold command in the system view.
If the alarm threshold is set in the system view and interface view, the smaller value takes effect.
NOTE:
This command can only be used in the interface view.
After DHCP snooping attack defense is completely configured, check the configured parameters.
Procedure
Run the display dhcp snooping [ interface interface-type interface-number | vlan vlan-id ] command to view DHCP snooping running information.
Run the display dhcp snooping configuration [ vlan vlan-id | interface interface-type interface-number ] command to view the DHCP snooping
configuration.
Run the display mac-address snooping [ interface-type interface-number | vlan vlan-id ] * [ verbose ] command to view static MAC address entries
generated from the DHCP snooping binding table.
Run the display dhcp snooping statistics command to check statistics on the received DHCP messages.
Context
The Option 82 field records the location of a DHCP client. A device inserts the Option 82 field into a DHCP Request message to notify the DHCP server
of the DHCP client location. The DHCP server can assign an IP address and other configurations to the DHCP client, ensuring DHCP client security.
NOTE:
DHCP Option 82 must be configured on the user-side of a device; otherwise, the DHCP message sent to the DHCP server will not carry Option 82.
All Option82 fields configured 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.
Procedure
1. Run:
system-view
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 20/35
16/02/2018 HedEx Startpage
View Steps
Interface view 1. Run the interface interface-type interface-number command to enter the interface view.
2. Run the dhcp option82 { insert | rebuild } enable command to enable the device to insert the Option 82
field in a DHCP message.
By default, the device is disabled from inserting the Option 82 field in a DHCP message.
3. Run the quit command to return to the system view.
3. (Optional) You can configure the format of the Option 82 field in the system or interface view. If the configuration is performed in the system
view, the configuration takes effect for all interfaces on the device. If the configuration is performed in the interface view, the configuration
takes effect only for the specified interface.
View Steps
System view 1. Run the dhcp option82 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] [ circuit-id | remote-id ] format { default |
common | extend | user-defined text } command to configure the format of the Option 82 field in a DHCP
message.
By default, the format of the Option 82 field in a DHCP message is default.
Interface view 1. Run the interface interface-type interface-number command to enter the interface view.
2. Run the dhcp option82 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] [ circuit-id | remote-id ] format { default |
common | extend | user-defined text } command to configure the format of the Option 82 field in a DHCP
message.
By default, the format of the Option 82 field in a DHCP message is default.
3. Run the quit command to return to the system view.
4. (Optional) Run:
dhcp option82 subscriber-id format { ascii ascii-text | hex hex-text }
The Sub6 suboption is inserted into the Option 82 field of DHCP messages.
By default, Sub6 suboption is not inserted into the Option 82 field of DHCP messages.
5. (Optional) Run:
dhcp option82 vendor-specific format vendor-sub-option sub-option-num { ascii ascii-text | hex hex-text | ip-address ip-address &<1-8> |
The Sub9 suboption is inserted into the Option 82 field of DHCP messages.
By default, Sub9 suboption is not inserted into the Option 82 field of DHCP messages.
6. (Optional) Configure suboptions inserted into the DHCP Option 82 field in the system view, VLAN view, or interface view. If the configuration
is performed in the system view, the configuration takes effect for all interfaces on the device. If the configuration is performed in the VLAN
view, the configuration takes effect for all DHCP messages from this VLAN that are received by all interfaces. If the configuration is performed
in the interface view, the configuration takes effect only for the specified interface.
View Steps
System view
1. Run the dhcp option82 encapsulation { circuit-id | remote-id | subscriber-id | vendor-specific-id } *
command to configure suboptions inserted into the DHCP Option 82 field.
By default, the circuit-id (CID) and remote-id (RID) suboptions are inserted into the DHCP Option 82 field.
VLAN view 1. Run the vlan vlan-id command to enter the VLAN view.
2. Run the dhcp option82 encapsulation { circuit-id | remote-id | subscriber-id | vendor-specific-id } *
command to configure suboptions inserted into the DHCP Option 82 field.
By default, the circuit-id (CID) and remote-id (RID) suboptions are inserted into the DHCP Option 82 field.
3. Run the quit command to return to the system view.
Interface view 1. Run the interface interface-type interface-number command to enter the interface view.
2. Run the dhcp option82 encapsulation { circuit-id | remote-id | subscriber-id | vendor-specific-id } *
command to configure suboptions inserted into the DHCP Option 82 field.
By default, the circuit-id (CID) and remote-id (RID) suboptions are inserted into the DHCP Option 82 field.
3. Run the quit command to return to the system view.
Run the display dhcp option82 configuration [ vlan vlan-id | interface interface-type interface-number ] command to view the DHCP Option 82
configuration.
Context
To allow a DHCPv6 server to detect client locations on a DHCPv6 network, configure the LDRA on the client-side access device.
After the LDRA is configured on a trusted DHCPv6 network with a large number of clients, disable the device from generating DHCP snooping binding
entries because new users cannot go online if the number of DHCP snooping binding entries reaches the upper limit. In addition, the LDRA-enabled
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 21/35
16/02/2018 HedEx Startpage
device inserts the interface-id or remote-id option into the Relay-Forward message to record client location information. You can configure the formats of
interface-id and remote-id in accordance with your actual situation.
Procedure
1. Run:
system-view
Interface-based configuration 1. Run the interface interface-type interface-number command to enter the interface view.
2. Run the dhcp snooping enable no-user-binding command to disable the interfaces from generating DHCP
snooping binding entries after DHCP snooping is enabled.
3. Run the quit command to return to the system view.
Context
The function of the Option 18 and Option 37 field in a DHCPv6 message is similar to that of the Option 82 field in a DHCPv4 message. The Option 18
field contains the port number of a client and the Option 37 field contains the MAC address of the client. A device inserts the Option 18 or Option 37 field
to a DHCPv6 Request message to notify the DHCP server of the DHCPv6 client location. The DHCP server can assign an IP address and other
configurations to the DHCPv6 client, ensuring DHCP client security.
Procedure
1. Run:
system-view
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 22/35
16/02/2018 HedEx Startpage
2. Run:
interface interface-type interface-number
The device is enabled to insert the Option 18 or Option 37 field to a DHCPv6 Request message.
By default, the device is disabled from inserting the Option 18 or Option 37 field in a DHCPv6 message.
NOTE:
If you run the dhcpv6 { option18 | option37 } enable command in the VLAN view, the command takes effect for all the DHCPv6 messages received from the specified
VLAN. If you run the dhcpv6 { option18 | option37 } enable command in the interface view, the command takes effect for all the DHCPv6 messages received on the
specified interface.
4. Run:
quit
a. Run:
dhcpv6 option18 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] format user-defined text
a. Run:
vlan vlan-id
a. Run:
interface interface-type interface-number
NOTE:
If you run the dhcpv6 option18 format command in the system view, the command takes effect for the Option 18 field in all DHCPv6 messages. If you run the dhcpv6
option18 format command in the VLAN view, the command takes effect for the Option 18 field in all DHCPv6 messages received from the specified VLAN. If you run the
dhcpv6 option18 format command in the interface view, the command takes effect for the Option 18 field in all DHCPv6 messages received on the specified interface.
6. (Optional) You can configure the format of Option 37 field inserted in DHCPv6 packets in the system view, VLAN view, or interface view.
In the system view:
a. Run:
dhcpv6 option37 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] format user-defined text
a. Run:
vlan vlan-id
a. Run:
interface interface-type interface-number
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 23/35
16/02/2018 HedEx Startpage
dhcpv6 option37 [ vlan vlan-id ] [ ce-vlan ce-vlan-id ] format user-defined text
NOTE:
If you run the dhcpv6 option37 format command in the system view, the command takes effect for the Option 37 field in all DHCPv6 messages. If you run the dhcpv6
option37 format command in the VLAN view, the command takes effect for the Option 37 field in all DHCPv6 messages received from the specified VLAN. If you run the
dhcpv6 option37 format command in the interface view, the command takes effect for the Option 37 field in all DHCPv6 messages received on the specified interface.
NOTICE:
The cleared statistics cannot be restored. Exercise caution when you run the command.
Procedure
Run the reset dhcp snooping statistics global command in the user view to clear statistics on globally discarded DHCP messages.
Run the reset dhcp snooping statistics interface interface-type interface-number [ vlan vlan-id ] command in the user view to clear statistics on
discarded DHCP messages on an interface.
Run the reset dhcp snooping statistics vlan vlan-id [ interface interface-type interface-number ] command in the user view to clear statistics on
discarded DHCP messages in a VLAN.
After the networking environment changes, DHCP snooping binding entries do not age immediately. The following information in DHCP snooping
binding entries may change, causing packet forwarding failure:
Before changing the networking environment, clear all DHCP snooping binding entries manually so that the device generates a new DHCP snooping
binding table based on the new networking environment.
NOTICE:
After the DHCP snooping binding entries are cleared, network communication can be recovered only after all the DHCP users connected to the device re-
log in and new binding entries are generated. Exercise caution when you run the command.
Procedure
In the user view, run the following commands to clear DHCP snooping binding entries:
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 24/35
16/02/2018 HedEx Startpage
reset dhcp snooping user-bind [ vlan vlan-id | interface interface-type interface-number ] * [ ipv4 | ipv6 ]
reset dhcp snooping user-bind [ ip-address [ ip-address ] | ipv6-address [ ipv6-address ] | vpls vpls-name ]
reset dhcp snooping user-bind [ ipv6-prefix [ prefix/prefix-length ] ]
NOTE:
The parameter vpls vpls-name is only supported by the S5720HI.
If binding entries are not backed up, the binding entries will be lost after the device restarts. DHCP users must log in again so that the device can generate
DHCP snooping binding entries for DHCP users to communicate. After DHCP snooping binding entries are backed up, DHCP snooping binding entries
can be restored after the device restarts.
Procedure
1. Run:
system-view
The device is enabled to automatically back up DHCP snooping binding entries on the remote FTP server.
By default, the device is not enabled to automatically back up DHCP snooping binding entries on the remote FTP server.
Run:
dhcp snooping user-bind sftp remotefilename filename host-ip ip-address username username password password [ write-delay dela
The device is enabled to automatically back up DHCP snooping binding entries on the remote SFTP server.
By default, the device is not enabled to automatically back up DHCP snooping binding entries on the remote SFTP server.
Run:
dhcp snooping user-bind tftp remotefilename filename host-ip ip-address [ write-delay delay-time ]
The device is enabled to automatically back up DHCP snooping binding entries on the remote TFTP server.
By default, the device is not enabled to automatically back up DHCP snooping binding entries on the remote TFTP server.
NOTE:
You can only use one of the preceding backup modes on the device.
FTP and TFTP will bring risk to device security. The SFTP mode is recommended.
After DHCP snooping binding entries are backed up on the remote FTP, SFTP, or TFTP server, you can restore the backup DHCP snooping binding
entries.
Procedure
1. Run:
system-view
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 25/35
16/02/2018 HedEx Startpage
Run:
dhcp snooping user-bind ftp load remotefilename filename host-ip ip-address username username password password
The device is configured to obtain and restore DHCP snooping binding entries from the remote FTP server.
Run:
dhcp snooping user-bind sftp load remotefilename filename host-ip ip-address username username password password
The device is configured to obtain and restore DHCP snooping binding entries from the remote SFTP server.
Run:
dhcp snooping user-bind tftp load remotefilename filename host-ip ip-address
The device is configured to obtain and restore DHCP snooping binding entries from the remote TFTP server.
NOTE:
FTP and TFTP will bring risk to device security. The SFTP mode is recommended.
Bogus DHCP server attack: An attacker deploys a DHCP server on the network to allocate IP addresses and network parameters to clients. If the
allocated IP addresses and network parameters are incorrect, network services may be interrupted.
DHCP flood attack: An attacker sends a large number of DHCP messages to a device in a short period to generate a huge impact on the device
performance. As a result, the device may fail to work.
Bogus DHCP message attack: An attacker pretends to be an authorized user to continuously send DHCP Request messages to the DHCP server
to renew the IP address; therefore, the IP address cannot be reclaimed and other authorized users cannot obtain IP addresses. If the attacker
pretends to be an authorized user to send a DHCP Release message to the DHCP server, the authorized user will be disconnected.
DHCP server DoS attack: When many attackers apply IP addresses or an attacker applies many IP addresses by changing the CHADDR fields in
DHCP messages, the IP addresses on the DHCP server are exhausted and authorized users cannot obtain IP addresses.
To prevent DHCP-based attacks and provide high-quality service for DHCP users, configure the DHCP snooping function.
Figure 1 Networking diagram for configuring DHCP snooping attack defense
Configuration Roadmap
Perform the following operations on the DHCP relay agent. The configuration roadmap is as follows:
1. Configure the DHCP function so that SwitchC can forward the DHCP messages from different network segments to the DHCP server.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 26/35
16/02/2018 HedEx Startpage
2. Configure the basic functions of DHCP snooping to prevent bogus DHCP server attacks. Enable association between ARP and DHCP snooping
to implement real-time binding table update when DHCP users go offline unexpectedly. Configure the device to discard the DHCP messages
with non-0 GIADDR fields to prevent attacks initiated by unauthorized users.
3. Set the maximum rate of DHCP messages sent to the DHCP message processing unit to prevent DHCP flood attacks. Enable the packet
discarding alarm. When the number of discarded DHCP messages reaches the maximum value, an alarm is generated.
4. Enable the device to check DHCP messages against the binding table to prevent bogus DHCP message attacks. Configure the device to
generate an alarm when the number of DHCP messages discarded in binding table checking reaches the threshold.
5. Set the maximum number of access users and enable the device to check whether the MAC address in a DHCP Request frame header is the
same as the CHADDR value in the data field to prevent DHCP server DoS attacks. Configure the device to generate an alarm when the number
of packets discarded in CHADDR field check reaches the alarm threshold.
The configurations involved in this example are performed on SwitchC. This example does not provide detailed configurations for the DHCP server.
Procedure
4. Configure the device to check DHCP messages against the binding table and enable the device to generate an alarm when the number of
packets discarded in binding table checking reaches the alarm threshold.
# Configure the user-side interface. GE0/0/1 is used as an example. The configuration on GE0/0/2 is the same as the configuration on GE0/0/1
and is not mentioned here.
[SwitchC] interface gigabitethernet 0/0/1
[SwitchC-GigabitEthernet0/0/1] dhcp snooping check dhcp-request enable
[SwitchC-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-request enable
[SwitchC-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-request threshold 120
[SwitchC-GigabitEthernet0/0/1] quit
5. Set the maximum number of access users on an interface, enable the device to check whether the MAC address in a DHCP Request frame
header is the same as the CHADDR value in the data field, and enable the device to generate an alarm when the number of packets discarded in
CHADDR field check reaches the alarm threshold.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 27/35
16/02/2018 HedEx Startpage
# Configure the user-side interface. GE0/0/1 is used as an example. The configuration on GE0/0/2 is the same as the configuration on GE0/0/1
and is not mentioned here.
[SwitchC] interface gigabitethernet 0/0/1
[SwitchC-GigabitEthernet0/0/1] dhcp snooping max-user-number 20
[SwitchC-GigabitEthernet0/0/1] dhcp snooping check dhcp-chaddr enable
[SwitchC-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-chaddr enable
[SwitchC-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-chaddr threshold 120
[SwitchC-GigabitEthernet0/0/1] quit
6. Verify the configuration.
# Run the display dhcp snooping configuration command to view the DHCP snooping configuration.
[SwitchC] display dhcp snooping configuration
#
dhcp snooping enable ipv4
dhcp snooping check dhcp-rate enable
dhcp snooping check dhcp-rate 90
dhcp snooping alarm dhcp-rate enable
dhcp snooping alarm dhcp-rate threshold 500
arp dhcp-snooping-detect enable
#
interface GigabitEthernet0/0/1
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping max-user-number 20
#
interface GigabitEthernet0/0/2
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping max-user-number 20
#
# Run the display dhcp snooping interface command to view DHCP snooping information on an interface. The values of Check dhcp-
giaddr, Check dhcp-chaddr, and Check dhcp-request fields are Enable. Take the display on GE0/0/1 as an example:
[SwitchC] display dhcp snooping interface gigabitethernet 0/0/1
DHCP snooping running information for interface GigabitEthernet0/0/1 :
DHCP snooping : Enable
Trusted interface : No
Dhcp user max number : 20
Current dhcp and nd user number : 0
Check dhcp-giaddr : Enable
Check dhcp-chaddr : Enable
Alarm dhcp-chaddr : Enable
Alarm dhcp-chaddr threshold : 120
Discarded dhcp packets for check chaddr : 0
Check dhcp-request : Enable
Alarm dhcp-request : Enable
Alarm dhcp-request threshold : 120
Discarded dhcp packets for check request : 0
Check dhcp-rate : Disable (default)
Alarm dhcp-rate : Disable (default)
Alarm dhcp-rate threshold : 500
Discarded dhcp packets for rate limit : 0
Alarm dhcp-reply : Disable (default)
Configuration Files
SwitchC configuration file
#
sysname SwitchC
#
vlan batch 10 100
#
dhcp enable
#
dhcp snooping enable ipv4
dhcp snooping check dhcp-rate enable
dhcp snooping check dhcp-rate 90
dhcp snooping alarm dhcp-rate enable
dhcp snooping alarm dhcp-rate threshold 500
arp dhcp-snooping-detect enable
#
dhcp server group dhcpgroup1
dhcp-server 10.2.1.2 0
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
dhcp select relay
dhcp relay server-select dhcpgroup1
#
interface Vlanif100
ip address 10.1.1.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 28/35
16/02/2018 HedEx Startpage
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping max-user-number 20
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping max-user-number 20
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 100
#
ip route-static 0.0.0.0 0.0.0.0 10.1.1.1
#
return
NOTE:
Only the S5720HI supports support this example.
Configuration Roadmap
The configuration roadmap is as follows:
1. Enable DHCP snooping globally and configure the device to process only DHCPv4 messages.
2. Enable DHCP snooping on the device on a VPLS network, ensuring that DHCP snooping configurations take effect on the VPLS network.
3. Enable DHCP snooping on the interface.
4. Configure an interface as the trusted interface to ensure that DHCP clients obtain IP addresses from the authorized server.
5. Enable the device to check DHCP messages against the binding table to prevent bogus DHCP message attacks.
6. Set the maximum rate of sending DHCP messages to the processing unit to prevent DHCP flood attacks.
7. Enable the device to check whether the GIADDR field in the DHCP Request message is 0 and defend against DHCP Request messages with
non-0 GIADDR field.
8. Set the maximum number of access DHCP clients and enable the device to check whether the MAC address in the Ethernet frame header
matches the CHADDR field in the DHCP message to prevent DHCP server DoS attacks.
Procedure
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 29/35
16/02/2018 HedEx Startpage
2. Enable DHCP snooping on the device on a VPLS network.
[PE1] dhcp snooping over-vpls enable
3. Enable DHCP snooping on the interface.
# Enable DHCP snooping on the user-side interface. The GE0/0/1 is used as an example. The configuration on GE0/0/2 is the same as the
configuration on GE0/0/1 and is not mentioned here.
[PE1] interface gigabitethernet 0/0/1
[PE1-GigabitEthernet0/0/1] dhcp snooping enable
[PE1-GigabitEthernet0/0/1] quit
4. Configure the interface connected to the DHCP server as the trusted interface.
[PE1] interface gigabitethernet 0/0/3
[PE1-GigabitEthernet0/0/3] dhcp snooping trusted
[PE1-GigabitEthernet0/0/3] quit
5. Enable the device to check DHCP messages against the DHCP snooping binding table.
# Configure the user-side interface. The GE0/0/1 is used as an example. The configuration on GE0/0/2 is the same as the configuration on
GE0/0/1 and is not mentioned here.
[PE1] interface gigabitethernet 0/0/1
[PE1-GigabitEthernet0/0/1] dhcp snooping check dhcp-request enable
[PE1-GigabitEthernet0/0/1] quit
6. Set the maximum rate of sending DHCP messages to the processing unit to 90 pps.
[PE1] dhcp snooping check dhcp-rate enable
[PE1] dhcp snooping check dhcp-rate 90
7. Enable the device to check whether the GIADDR field in a DHCP Request message is 0.
# Configure the user-side interface. The GE0/0/1 is used as an example. The configuration on GE0/0/2 is the same as the configuration on
GE0/0/1 and is not mentioned here.
[PE1] interface gigabitethernet 0/0/1
[PE1-GigabitEthernet0/0/1] dhcp snooping check dhcp-giaddr enable
[PE1-GigabitEthernet0/0/1] quit
8. Set the maximum number of access users allowed on the interface and enable the device to check the CHADDR field.
# Configure the user-side interface. The GE0/0/1 is used as an example. The configuration on GE0/0/2 is the same as the configuration on
GE0/0/1 and is not mentioned here.
[PE1] interface gigabitethernet 0/0/1
[PE1-GigabitEthernet0/0/1] dhcp snooping max-user-number 20
[PE1-GigabitEthernet0/0/1] dhcp snooping check dhcp-chaddr enable
[PE1-GigabitEthernet0/0/1] quit
9. Configure the trap function for the number of discarded messages and the rate limit.
# Enable the trap function for discarding messages and set the alarm threshold. The GE0/0/1 is used as an example. The configuration on
GE0/0/2 is the same as the configuration on GE0/0/1 and is not mentioned here.
[PE1] interface gigabitethernet 0/0/1
[PE1-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-chaddr enable
[PE1-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-request enable
[PE1-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-reply enable
[PE1-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-chaddr threshold 120
[PE1-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-request threshold 120
[PE1-GigabitEthernet0/0/1] dhcp snooping alarm dhcp-reply threshold 120
[PE1-GigabitEthernet0/0/1] quit
# Enable the trap function for the rate limit and set the alarm threshold.
[PE1] dhcp snooping alarm dhcp-rate enable
[PE1] dhcp snooping alarm dhcp-rate threshold 80
10. Verify the configuration.
# Run the display dhcp snooping configuration command to view the DHCP snooping configuration.
[PE1] display dhcp snooping configuration
#
dhcp snooping enable ipv4
dhcp snooping check dhcp-rate enable
dhcp snooping check dhcp-rate 90
dhcp snooping alarm dhcp-rate enable
dhcp snooping alarm dhcp-rate threshold 80
dhcp snooping over-vpls enable
#
interface GigabitEthernet0/0/1
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping alarm dhcp-reply enable
dhcp snooping alarm dhcp-reply threshold 120
dhcp snooping max-user-number 20
#
interface GigabitEthernet0/0/2
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping alarm dhcp-reply enable
dhcp snooping alarm dhcp-reply threshold 120
dhcp snooping max-user-number 20
#
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 30/35
16/02/2018 HedEx Startpage
interface GigabitEthernet0/0/3
dhcp snooping trusted
#
# Run the display dhcp snooping interface command to view DHCP snooping information on an interface.
[PE1] display dhcp snooping interface gigabitethernet 0/0/1
DHCP snooping running information for interface GigabitEthernet0/0/1 :
DHCP snooping : Enable
Trusted interface : No
Dhcp user max number : 20
Current dhcp and nd user number : 0
Check dhcp-giaddr : Enable
Check dhcp-chaddr : Enable
Alarm dhcp-chaddr : Enable
Alarm dhcp-chaddr threshold : 120
Discarded dhcp packets for check chaddr : 0
Check dhcp-request : Enable
Alarm dhcp-request : Enable
Alarm dhcp-request threshold : 120
Discarded dhcp packets for check request : 0
Check dhcp-rate : Disable (default)
Alarm dhcp-rate : Disable (default)
Alarm dhcp-rate threshold : 80
Discarded dhcp packets for rate limit : 0
Alarm dhcp-reply : Enable
Alarm dhcp-reply threshold : 120
Discarded dhcp packets for check reply : 0
[PE1] display dhcp snooping interface gigabitethernet 0/0/3
DHCP snooping running information for interface GigabitEthernet0/0/3 :
DHCP snooping : Disable (default)
Trusted interface : Yes
Dhcp user max number : 1024 (default)
Current dhcp and nd user number : 0
Check dhcp-giaddr : Disable (default)
Check dhcp-chaddr : Disable (default)
Alarm dhcp-chaddr : Disable (default)
Check dhcp-request : Disable (default)
Alarm dhcp-request : Disable (default)
Check dhcp-rate : Disable (default)
Alarm dhcp-rate : Disable (default)
Alarm dhcp-rate threshold : 80
Discarded dhcp packets for rate limit : 0
Alarm dhcp-reply : Disable (default)
Configuration Files
# Configuration file of the PE1
#
sysname PE1
#
dhcp enable
#
dhcp snooping enable ipv4
dhcp snooping check dhcp-rate enable
dhcp snooping check dhcp-rate 90
dhcp snooping alarm dhcp-rate enable
dhcp snooping alarm dhcp-rate threshold 80
dhcp snooping over-vpls enable
#
interface GigabitEthernet0/0/1
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping alarm dhcp-reply enable
dhcp snooping alarm dhcp-reply threshold 120
dhcp snooping max-user-number 20
#
interface GigabitEthernet0/0/2
dhcp snooping enable
dhcp snooping check dhcp-giaddr enable
dhcp snooping check dhcp-request enable
dhcp snooping alarm dhcp-request enable
dhcp snooping alarm dhcp-request threshold 120
dhcp snooping check dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr enable
dhcp snooping alarm dhcp-chaddr threshold 120
dhcp snooping alarm dhcp-reply enable
dhcp snooping alarm dhcp-reply threshold 120
dhcp snooping max-user-number 20
#
interface GigabitEthernet0/0/3
dhcp snooping trusted
#
return
Configuration Roadmap
Procedure
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 32/35
16/02/2018 HedEx Startpage
interface GigabitEthernet0/0/2
dhcp snooping enable
#
interface GigabitEthernet0/0/3
dhcp snooping trusted
#
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 10
#
dhcp enable
#
dhcp snooping enable
#
vlan 10
dhcp snooping enable no-user-binding
dhcpv6 snooping relay-information enable
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
dhcp snooping enable
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
dhcp snooping enable
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10
dhcp snooping trusted
#
return
The number of DHCP clients connected to the user-side interface has reached the maximum value.
The transmission rate of DHCP messages has exceeded the upper rate limit, and the DHCP messages from new DHCP clients are being
discarded.
Procedure
1. Check whether the number of access DHCP users has reached the threshold.
a. Run the display dhcp snooping [ interface interface-type interface-number | vlan vlan-id ] command to check whether "Dhcp user max
number: XX" is displayed globally, in the VLAN or on the user-side interface.
By default, the maximum number of DHCP snooping binding entries that can be learned on an interface is 256 for S1720GFR,
S2720, and S2750EI, 512 for S1720GW, S1720GWR, S1720GW-E, S1720GWR-E, S5720LI, S5720S-LI, S5700LI and S5710-X-LI,
and 1024 for other models.
b. Run the display dhcp snooping user-bind all command to view the number of dynamic DHCP snooping entries on the DHCP snooping-
enabled interface. If the number of entries on the interface has reached the maximum value, new DHCP clients cannot access the
network.
To increase the maximum value of DHCP access users, run the dhcp snooping max-user-number max-number command.
2. If the number of access DHCP users has not reached the limit, check whether the transmission rate of DHCP messages has exceeded the limit.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 33/35
16/02/2018 HedEx Startpage
a. Run the display dhcp snooping [ interface interface-type interface-number | vlan vlan-id ] command to check whether "Dhcp-rate
limit(pps): xx" is displayed globally, in the VLAN or on the user-side interface.
If "Dhcp-rate limit(pps): xx" is not displayed, the default rate limit is 100 pps. The configured value takes preference.
b. If DHCP users cannot access the network because the DHCP snooping rate limit is low, run the dhcp snooping check dhcp-rate rate
command in the system view, interface view, and VLAN view to increase the rate limit values.
The interface connected to the DHCP server is not configured as the trusted interface.
After DHCP snooping is enabled globally, DHCP snooping is not enabled on the interface connecting to users or in the VLAN to which the
interface belongs.
Procedure
1. Check whether the interface connected to the DHCP server is in a correct state.
a. Run the display dhcp snooping configuration and display dhcp snooping [ interface interface-type interface-number | vlan vlan-id ]
commands to check in which VLANs and on which interfaces DHCP snooping is enabled and whether "Trusted interface: Yes" is
displayed for the interface connected to the DHCP server.
By default, an interface is in the untrusted state. When receiving messages from the network-side interfaces, the device processes
only the DHCP Reply messages received on the trusted interface and discards those on untrusted interfaces. When receiving
messages from user-side interfaces, the device forwards the messages only to the trusted interface.
b. Check whether the interface connected to the DHCP server is a trusted interface. If it is not a trusted interface, run the dhcp snooping
trusted command in the VLAN or interface view to configure the interface as a trusted interface.
When DHCP snooping is enabled on a DHCP relay agent, a trusted interface does not need to be configured on the DHCP relay
agent. After receiving DHCP Request messages from users, the DHCP relay agent converts the source/destination IP addresses and
MAC addresses, and forwards the messages to the valid DHCP server in unicast mode. Therefore, the DHCP ACK messages
received by the DHCP relay agent are valid, and the DHCP snooping binding entries generated by the DHCP relay agent are correct.
2. If the interface status is correct, check whether DHCP snooping is enabled on the interface connected to users or the VLAN to which the
interface belongs.
a. Run the display dhcp snooping configuration and display dhcp snooping [ interface interface-type interface-number | vlan vlan-id ]
commands to check whether DHCP snooping is enabled on the interface connected to users or the VLAN to which the interface
belongs.
b. DHCP snooping should be enabled on the interface connected to users or VLAN to which the interface belongs. If it is not enabled,
run the dhcp snooping enable command in the VLAN or interface view to enable it.
1.14 FAQ
Which Devices Support DHCP Snooping?
Why Can't a PC Access the Internet after Obtaining an IP Address Through DHCP
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 34/35
16/02/2018 HedEx Startpage
Huawei Proprietary and Confidential Copyright © Huawei Technologies Co., Ltd.
Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.
Next topic >
< Home
When you configure DHCP snooping on a Layer 2 access device, steps 1, 2, and 3 are mandatory and must be performed in sequence.
When you configure DHCP snooping on a DHCP relay agent, only steps 1 and 2 are required.
2. Configure the interfaces connected to DHCP clients. Perform the configuration on all interfaces connected to DHCP clients. GE0/0/1 is used as
an example.
[HUAWEI] interface gigabitethernet 0/0/1
[HUAWEI-GigabitEthernet0/0/1] dhcp snooping enable
[HUAWEI-GigabitEthernet0/0/1] quit
3. Perform the configuration on interfaces connected to the DHCP server. GE0/0/2 is used as an example.
[HUAWEI] interface gigabitethernet 0/0/2
[HUAWEI-GigabitEthernet0/0/2] dhcp snooping trusted
[HUAWEI-GigabitEthernet0/0/2] quit
1.15 References
For more information about DHCP snooping, see the following documents.
http://127.0.0.1:7890/printtopics.html?time=Fri%20Feb%2016%202018%2011:04:44%20GMT-0200%20(Hor%C3%A1rio%20brasileiro%20de%… 35/35