01-07 ARP Security Configuration
01-07 ARP Security Configuration
Switches
Configuration Guide - Security 7 ARP Security Configuration
Definition
Address Resolution Protocol (ARP) security prevents ARP attacks and ARP-based
network scanning attacks using a series of methods such as strict ARP learning,
dynamic ARP inspection (DAI), ARP anti-spoofing, and rate limit on ARP packets.
Purpose
ARP is easy to use but lacks security protection mechanisms. Attackers may use
ARP to attack network devices. The following ARP attacks exist on networks:
● ARP flood attack: ARP flood attacks, also called denial of service (DoS)
attacks, occur in the following scenarios:
– Processing ARP packets and maintaining ARP entries consume system
resources. Network devices limit the number of stored ARP entries to
improve ARP entry query efficiency. Attackers send a large number of
bogus ARP packets with variable source IP addresses to consume ARP
entries on a target device. Therefore, the target device cannot generate
ARP entries when receiving ARP packets from authorized users.
Consequently, communication is interrupted.
– Attackers send a large number of IP packets with unresolvable
destination IP addresses to scan the hosts on the local or remote network
segments. The target devices generate many ARP Miss messages and
deliver many temporary ARP entries. In addition, the target devices
broadcast a large number of ARP Request packets to resolve the
destination IP addresses of the IP packets received from attackers. These
operations cause CPU overloading.
● ARP spoofing attack: Attackers send bogus ARP packets to target devices,
causing these devices to modify the ARP entries of other network devices or
user hosts. As a result, these network devices or user hosts cannot
communicate with one another other.
ARP attacks cause the following problems:
● Network connections are unstable and communication is interrupted.
● Attackers initiate ARP spoofing attacks to intercept user packets and thus
obtain the accounts and passwords of the users, for example, game, online
banking, and file server accounts and passwords, leading to losses for
customers.
To address the preceding problems, ARP security can be deployed.
Benefits
● Reduces maintenance costs for network operating and security.
● Provides users with stable services on a secure network.
When a device is busy with a large number of ARP packets, the CPU may be
incapable of processing other services. To protect CPU resources of the device,
limit the rate of ARP packets.
The device provides the following measures for limiting the rate of ARP packets:
● Limiting the rate of ARP packets based on source MAC addresses or source IP
addresses
When detecting that a user host has sent a large number of ARP packets in a
short period, the device limits the rate of ARP packets sent from the source
MAC address or source IP address of this user host. If the number of ARP
packets received per second exceeds the threshold, the device discards the
excess ARP packets.
– Limiting the rate of ARP packets based on source MAC addresses: If a
MAC address is specified, the device limits the rate of ARP packets from
the specified source MAC address; otherwise, the device limits the rate of
ARP packets from any source MAC address.
– Limiting the rate of ARP packets based on source IP addresses: If an IP
address is specified, the device limits the rate of ARP packets from the
specified source IP address; otherwise, the device limits the rate of ARP
packets from any source IP address.
● Limiting the rate on ARP packets globally, in a VLAN, or on an interface
The maximum rate and rate limiting duration of ARP packets can be set
globally, in a VLAN, or on an interface. The configurations set in the interface
view take precedence over those set in the VLAN view, and those set in the
VLAN view take precedence over those set in the system view.
In addition, the duration for blocking ARP packets can be set on an interface.
The device then discards ARP packets that exceed the permitted maximum
number of ARP packets within the rate limiting duration, and discards all ARP
packets received within the duration specified for blocking ARP packets.
– Limiting the rate of ARP packets globally: limits all received ARP packets.
– Limiting the rate of ARP packets in a VLAN: limits the number of ARP
packets to be processed on all interfaces in a VLAN. The configuration in
a VLAN does not affect ARP entry learning on interfaces in other VLANs.
– Limiting the rate of ARP packets on an interface: limits the number of
ARP packets processed on an interface. The configuration on an interface
does not affect ARP entry learning on other interfaces.
ste
qu
1. The attacker
re
sends IP packets
P
AR with unresolvable
destination IP
address 10.2.1.5/
24.
To avoid the preceding problems, the device takes measures to limit the rate of
ARP Miss messages.
● Limiting the rate of ARP Miss messages based on source IP addresses
If the rate at which ARP Miss messages are sent from a source IP address
exceeds the limit, the device considers that this address has initiated an
attack.
If the ARP Miss message processing mode is set to block, the device discards
excess ARP Miss packets and delivers an ACL to discard all subsequent packets
sent from this source IP address. If the ARP Miss message processing mode is
set to none-block, the device only discards excess ARP Miss packets.
If a source IP address is specified, the rate of ARP Miss messages triggered by
IP packets from this source IP address is limited. If no source IP address is
specified, the rate of ARP Miss messages triggered by IP packets from any
source IP address is limited.
● Limiting the rate of ARP Miss messages globally, in a VLAN, or on an interface
The maximum number of ARP Miss massages can be set globally, in a VLAN,
or on an interface. The configurations on an interface, in a VLAN, and global
configurations take effect in descending order of priority.
– Limiting the rate of ARP Miss messages globally: limits the number of
ARP Miss messages processed on the entire device.
– Limiting the rate of ARP Miss messages in a VLAN: limits the number of
ARP Miss messages processed on all interfaces in a VLAN. The
Internet
Gateway
Switch Switch
…… ……
To address the preceding problem, enable optimized ARP reply, which improves
the switch's capability of defending against ARP flood attack. After this function is
enabled, the stack performs the following operations:
● When receiving an ARP Request packet of which the destination IP address is
the local interface address, the switch where the interface is located directly
returns an ARP Reply packet.
● When a stack system receives an ARP Request packet of which the destination
IP address is not the local interface address and intra-VLAN proxy ARP is
enabled on the master switch, the switch where the interface is located
checks whether the ARP Request packet meets the proxy condition. If so, the
switch returns an ARP Reply packet. If not, the switch discards the packet.
NOTE
The optimized ARP reply function can be configured on a stand-alone fixed switch, but does
not take effect.
By default, the optimized ARP reply function is enabled. After a device receives an
ARP Request packet, the device checks whether an ARP entry corresponding to the
source IP address of the ARP Request packet exists.
● If the corresponding ARP entry exists, the stack performs optimized ARP reply
to this ARP Request packet.
● If the corresponding ARP entry does not exist, the stack does not perform
optimized ARP reply to this ARP Request packet.
● Processing ARP packets consumes many CPU resources. The device learns
many invalid ARP entries, which exhaust ARP entry resources and prevent the
device from learning ARP entries for ARP packets from authorized users.
Consequently, communication of authorized users is interrupted.
● After receiving bogus ARP packets, the device incorrectly modifies the ARP
entries. As a result, authorized users cannot communicate with one another
other.
To avoid the preceding problems, configure the strict ARP learning function on the
gateway.
After the strict ARP learning function is enabled, the device learns only ARP entries
for ARP reply packets in response to ARP Request packets that it has sent. In this
way, the device can defend against most ARP attacks.
UserA
Gateway
Internet
UserB
As shown in Figure 7-3, after receiving an ARP Request packet from UserA, the
gateway sends an ARP Reply packet to UserA and adds or updates an ARP entry
matching UserA. After the strict ARP learning function is enabled on the gateway:
● The gateway does not add or update an ARP entry for userA when it receives
an ARP Request packet from UserA. If the ARP Request packet requests the
MAC address of the gateway, the gateway sends an ARP Reply packet to
UserA.
● The gateway adds or updates an ARP entry matching UserB if it sends an ARP
Request packet to UserB, after it receives the ARP Reply packet.
IP: 10.1.1.2
MAC: 2-2-2
Com IP: 10.1.1.1
mun MAC: 1-1-1
icatio
n is b
locke Gateway
d
UserA
Switch Internet
rA is
f Use
dd ress o
a
MAC 5-5-5
The
Bogus ARP packets send by an attacker who forges
Attacker the gateway address
IP: 10.1.1.3 Data sent to UserA through the gateway from the
MAC: 3-3-3 Internet
To defend against ARP gateway spoofing attacks, configure the ARP entry fixing
function on a gateway. Upon learning an ARP entry for the first time, the gateway
enabled with this function does not update the entry, updates only part of the
entry, or sends a unicast ARP Request packet to check the validity of the ARP
packet for updating the entry.
The device supports three ARP entry fixing modes, as described in Table 7-3.
Mode Description
7.3.8 DAI
A man-in-the-middle (MITM) attack is a common ARP spoofing attack.
An MITM attacker establishes connections with two ends and exchanges data
between them. The two ends consider that they are directly communicating, but
actually the attacker has controlled the entire session. In an MITM attack, the
attacker intercepts all packets going between the two ends and inserts new ones.
Figure 7-5 shows an MITM attack scenario. An attacker poses as UserB to send a
bogus ARP packet to UserA. UserA then records an incorrect ARP entry for UserB.
The attacker easily obtains information exchanged between UserA and UserB.
Information between UserA and UserB is not protected or secure.
MAC MAC
IP address Type IP address Type
address address
IP: 10.1.1.1
MAC: 1-1-1
UserA
Switch
IP: 10.1.1.2
Internet
MAC: 2-2-2
Attacker
To defend against MITM attacks, configure dynamic ARP inspection (DAI) on the
Switch.
DAI prevents MITM attacks from using a DHCP snooping binding table. When the
switch receives an ARP packet, it compares the source IP address, source MAC
address, interface number, and VLAN ID of the ARP packet with binding entries. If
the ARP packet matches a binding entry, the switch considers the ARP packet valid
and allows the packet to pass through. If the ARP packet does not match a
binding entry, the switch considers the ARP packet invalid and discards the packet.
NOTE
This function is available only when DHCP snooping is configured. The device enabled with
DHCP snooping generates DHCP snooping binding entries when DHCP users go online. If a user
uses a static IP address, you need to manually configure a static binding entry for the user. For
details about DHCP snooping, see Understanding DHCP Snooping.
When an attacker connected to the Switch enabled with DAI sends bogus ARP
packets, the Switch detects the attacks based on the binding entries and discards
the bogus ARP packets. When both the DAI and packet discarding alarm functions
are enabled on the Switch, the Switch generates alarms when the number of
discarded ARP packets matching no binding entry exceeds the alarm threshold.
As shown in Figure 7-6, attacker B forges the gateway address to send a bogus
ARP packet to user A. User A considers the attacker to be the gateway. User A
then records an incorrect ARP entry for the gateway. As a result, the gateway
cannot receive packets from user A and their communication is interrupted.
Internet
Destination Source
IP address MAC address Gateway MAC MAC
...
10.1.1.1 1-1-1 5-5-5 2-2-2 ...
Data communication is
interrupted.
IP Address MAC
10.1.1.1 1-1-1
Gateway MAC
address is Updated
ARP entry is
updated. updated.
Gateway MAC
address is 5-5-5 IP Address MAC
10.1.1.1 5-5-5
Attacker B User A
● The source IP address in the ARP packet is the same as the IP address of the
VLANIF interface matching the physical inbound interface of the packet.
● The source IP address in the ARP packet is the virtual IP address of the
inbound interface but the source MAC address in the ARP packet is not the
virtual MAC address of the Virtual Router Redundancy Protocol (VRRP) group.
NOTE
A VRRP group, also called a virtual router, serves as the default gateway for hosts on a
LAN. A virtual router has a virtual MAC address that is generated based on the virtual
router ID. The virtual MAC address is in the format of 00-00-5E-00-01-{VRID}(VRRP).
The virtual router sends ARP Reply packets using the virtual MAC address instead of
the interface MAC address.
The device generates an ARP anti-collision entry and discards the received packets
with the same source MAC address and VLAN ID in a specified period. This
function prevents ARP packets with the bogus gateway address from being
broadcast in a VLAN.
In addition, you can enable gratuitous ARP packet sending on the device to
broadcast gratuitous ARP packets to all user hosts so that the bogus ARP entries
are modified. The gratuitous ARP packet is broadcast to all users so that incorrect
ARP entries are corrected.
IP: 10.1.1.2
MAC: 2-2-2
Com
mun IP: 10.1.1.1
icatio
n is b MAC: 1-1-1
locke
d
UserA Gateway
The MAC Internet
address of the
gateway is 3-3-3
Switch
To avoid the preceding problem, configure gratuitous ARP packet sending on the
gateway. Then the gateway sends gratuitous ARP packets at intervals to update
the ARP entries of authorized users so that the ARP entries contain the correct
MAC address of the gateway.
IP:10.1.1.1
UserA Gateway
Switch Internet
● Destination MAC address: The device compares the destination MAC address
in an ARP packet with that in the Ethernet frame header. If they are the same,
the packet is valid. If they are different, the device discards the packet.
● IP address: The device checks the source and destination IP addresses in an
ARP packet. If the source or destination IP address is all 0s, all 1s, or a
multicast IP address, the device discards the packet as an invalid packet. The
device checks both the source and destination IP addresses in an ARP Reply
packet but checks only the source IP address in an ARP Request packet.
Internet
Gateway
SwitchA SwitchB
To avoid the preceding problems, deploy ARP flood defense functions on the
gateway, including rate limit on ARP packets, rate limit on ARP Miss messages,
strict ARP learning, and ARP entry limit.
● After rate limit on ARP packets is deployed, the gateway collects statistics on
received ARP packets. If the number of ARP packets received within a
specified period exceeds the threshold (the maximum number of ARP
packets), the gateway discards the excess ARP packets to prevent CPU
overload.
● After rate limit on ARP Miss messages is deployed, the gateway collects
statistics on ARP Miss messages. If the number of ARP Miss messages
generated within a specified period exceeds the threshold (the maximum
number of ARP Miss messages), the gateway discards the IP packets
triggering the excess ARP Miss messages. This prevents CPU overload when
the gateway processes a large number of IP packets with unresolvable IP
addresses.
● After strict ARP learning is deployed, the gateway learns only the ARP Reply
packets in response to the ARP Request packets that it has sent. This action
prevents ARP entries on the gateway from being exhausted when the gateway
processes many ARP packets.
● After ARP entry limit is deployed, the gateway limits the number of ARP
entries dynamically learned by each interface. When the number of the ARP
entries dynamically learned by an interface reaches the maximum number, no
more dynamic entries can be added. This prevents ARP entries from being
exhausted when a host connected to the interface attacks the gateway.
UserA
Internet
UserC
Attacker
To avoid the preceding problems, deploy ARP spoofing defense functions on the
gateway, including rate ARP entry fixing, strict ARP learning, and gratuitous ARP
packet sending. You can deploy DAI on the access device for DHCP users.
● After ARP entry fixing is deployed and the gateway learns an ARP entry for
the first time, the gateway does not update the entry, updates only part of
the entry, or sends a unicast ARP Request packet to check the validity of the
ARP packet for updating the entry. This function prevents ARP entries from
being modified by bogus ARP packets.
● After strict ARP learning is deployed, the gateway learns only the ARP Reply
packets in response to the ARP Request packets that it has sent. This prevents
ARP entries from being modified by bogus ARP packets.
● After gratuitous ARP packet sending is deployed, the gateway periodically
sends ARP Request packets with its IP address as the destination IP address to
update the gateway MAC address in ARP entries. This function ensures that
packets of authorized users are forwarded to the gateway and prevents
hackers from intercepting these packets.
● The DAI function allows the switch to compare the source IP address, source
MAC address, interface number, and VLAN ID of an ARP packet with binding
entries. If the ARP packet matches a binding entry, the device considers the
ARP packet valid and allows the packet to pass through. If the ARP packet
does not match a binding entry, the device considers the ARP packet invalid
and discards the packet. This function prevents MITM attacks.
Licensing Requirements
ARP security configuration commands are available only after the S1720GW,
S1720GWR, and S1720X have the license (WEB management to full management
Electronic RTU License) loaded and activated and the switches are restarted. ARP
security configuration commands on other models are not under license control.
For details about how to apply for a license, see S Series Switch License Use
Guide.
Version Requirements
S2710SI V100R006(C03&C05)
S5710-C-LI V200R001C00
S5730SI V200R011C10
S5730S-EI V200R011C10
NOTE
To know details about software mappings, see Hardware Query Tool.
Feature Limitations
● For ARP packets, when rate limiting is configured globally, in a VLAN, or on
an interface and rate limiting based on the source MAC address or source IP
address is also configured, the smallest rate is used.
● For ARP Miss messages, when rate limiting is configured globally, in a VLAN,
or on an interface and rate limiting based on the source IP address is also
configured, the smallest rate is used.
● When resources are sufficient, DAI can be enabled in a maximum of 10
VLANs.
Rate limit on ARP packets based on The maximum rate of ARP packets
source MAC addresses from each source MAC address is set
to 0, that is, the rate of ARP packets is
not limited based on the source MAC
address.
Maximum rate and rate limiting The device allows a maximum of 100
duration of ARP packets globally, in a ARP packets to pass through per
VLAN, or on an interface second.
Rate limit on ARP Miss messages The device can process a maximum of
based on source IP addresses 30 ARP Miss messages triggered by IP
packets from the same source IP
address. If the number of ARP Miss
messages per second exceeds the limit,
the device discards the excess ARP
Miss messages. The device then uses
the block mode to discard all ARP Miss
packets from the source IP address
within 5 minutes by default.
Maximum rate and rate limiting The device can process a maximum of
duration of ARP Miss messages 100 ARP Miss messages per second.
globally, in a VLAN, or on an interface
DAI Disabled
Pre-configuration Tasks
Before configuring defense against ARP flood attacks, connect interfaces and set
physical parameters for the interfaces to ensure that the physical status of the
interfaces is Up.
Configuration Procedure
Operations in the configuration procedure can be performed in any sequence.
Context
A large number of ARP packets with a fixed source MAC address and variable IP
addresses will cause the CPU of a device to be overloaded and exhaust ARP
entries.
To prevent this problem, configure the gateway to limit the rate of ARP packets
based on MAC addresses. The gateway then collects statistics on ARP packets sent
from certain MAC addresses to the CPU. If the number of ARP packets received in
one second from the specified MAC address exceeds the threshold, the device
discards the excess ARP packets.
NOTE
Procedure
Step 1 Run system-view
Step 2 Configure rate limiting on ARP packets based on source MAC addresses.
● Run arp speed-limit source-mac maximum maximum
The maximum rate of ARP packets from any source MAC address is set
● Run arp speed-limit source-mac mac-address maximum maximum
The maximum rate of ARP packets from the specified source MAC address is
set.
When both the preceding commands are executed, the arp speed-limit source-
mac mac-address maximum maximum command takes effect on ARP packets
from the specified source MAC address, and the arp speed-limit source-mac
maximum maximum command takes effect on ARP packets from other source
MAC addresses.
By default, the maximum rate of ARP packets from each source MAC address is
set to 0, that is, the rate of ARP packets is not limited based on source MAC
addresses.
After the optimized ARP reply function (disabled by default) is enabled using the
undo arp optimized-reply disable command, rate limiting on ARP packets based
on the source MAC address does not take effect.
----End
Context
When processing a large number of ARP packets with fixed IP addresses (for
example, MAC addresses or outbound interfaces that match a source IP address
frequently change), the CPU is overloaded and cannot process other services.
To prevent this problem, configure the gateway to limit the rate of ARP packets
based on source IP addresses. The gateway collects statistics on ARP packets from
a specified source IP address. If the number of ARP packets received in one second
from the specified IP address exceeds the threshold, the device discards the excess
ARP packets.
Procedure
Step 1 Run system-view
When both the preceding commands are executed, the maximum rate set using
the arp speed-limit source-ip ip-address maximum maximum command takes
effect on ARP packets from the specified source IP address, and the maximum rate
set using the arp speed-limit source-ip maximum maximum command takes
effect on ARP packets from other source IP addresses.
By default, the device allows a maximum of 30 ARP packets from the same source
IP address to pass through per second.
After the optimized ARP reply function (disabled by default) is enabled using the
undo arp optimized-reply disable command, rate limiting on ARP packets based
on the source IP address does not take effect.
----End
Context
When processing a large number of ARP packets, a device consumes many CPU
resources and cannot process other services. To protect CPU resources of the
device, limit the rate of ARP packets.
After rate limiting on ARP packets is enabled, set the maximum rate and rate
limiting duration of ARP packets globally, in a VLAN, or on an interface. In the rate
limiting duration, if the number of received ARP packets exceeds the limit, the
device discards the excess ARP packets.
● Limiting the rate of ARP packets globally: limits the number of ARP packets
processed on the entire device.
● Limiting the rate of ARP packets in a VLAN: limits the number of ARP packets
to be processed on all interfaces in a VLAN. The configuration in a VLAN does
not affect ARP entry learning on interfaces in other VLANs.
● Limiting the rate of ARP packets on an interface: limits the number of ARP
packets processed on an interface. The configuration on an interface does not
affect ARP entry learning on other interfaces.
If the maximum rate and rate limiting duration are configured in the system view,
VLAN view, and interface view at the same time, the device uses the
configurations in the interface view, VLAN view, and system view in order.
If you want the device to generate alarms to notify the network administrator of a
large number of discarded excess ARP packets, enable the alarm function. When
the number of discarded ARP packets exceeds the alarm threshold, the device
generates an alarm.
Perform the following steps on the gateway.
NOTE
MAC-Forced Forwarding (MFF) may increase the load on an access device's CPU. This is
because the MFF module may forward too many ARP packets whose destination IP
addresses are different from the IP address of the interface receiving these packets. To
resolve this problem, limit the rate of ARP packets globally, in a VLAN, or on an interface.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 (Optional) Run interface interface-type interface-number or vlan vlan-id
The interface or VLAN view is displayed.
If you configure rate limiting on ARP packets in the system view, skip the
preceding step.
Step 3 (Optional) On an Ethernet interface, run undo portswitch
The interface is switched to Layer 3 mode.
By default, an Ethernet interface works in Layer 2 mode.
NOTE
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between Layer 2 and
Layer 3 modes.
NOTE
----End
Context
If a network device is flooded with IP packets that contain unresolvable
destination IP addresses, the device generates a large number of ARP Miss
messages. This is because the device has no ARP entry that matches the next hop
of the route. IP packets triggering ARP Miss messages are sent to the device for
processing. The device generates a large number of temporary ARP entries and
sends many ARP Request packets to the network, consuming a large number of
CPU and bandwidth resources.
If the ARP Miss packet processing mode is set to block, the CPU of the device
discards excess ARP Miss messages and delivers an ACL to discard all subsequent
packets that are sent from this source IP address. If the ARP Miss packet
processing mode is set to none-block, the CPU discards excess ARP Miss
messages. When ARP Miss messages are discarded, corresponding ARP Miss
packets are discarded.
The maximum number of ARP Miss messages and ARP Miss packet processing
mode can be set based on the actual network environment.
NOTE
Only the S5720EI, S5720HI, S5720SI, S5720S-SI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this function.
Procedure
Step 1 Run system-view
Step 2 Configure rate limiting on ARP Miss messages based on source IP addresses.
● Run arp-miss speed-limit source-ip maximum maximum
The maximum rate of ARP Miss messages triggered by IP packets from any
source IP address is set.
● Run arp-miss speed-limit source-ip ip-address [ mask mask ] maximum
maximum [ none-block | block timer timer ](The S5720SI, S5720S-SI,
S5730SI, S5730S-EI, S6720LI, S6720S-LI, S6720SI, and S6720S-SI do not
support [ none-block | block timer timer ].)
The maximum rate of ARP Miss messages triggered by IP packets from the
specified IP address is set, and ARP Miss packet processing mode is specified.
When the preceding configurations are both performed, the maximum rate set
using the arp-miss speed-limit source-ip ip-address [ mask mask ] maximum
maximum [ none-block | block timer timer ] command takes effect on ARP Miss
messages triggered IP packets from the specified source IP address, and the
maximum rate set using the arp-miss speed-limit source-ip maximum maximum
command takes effect on ARP Miss messages triggered by IP packets from other
source IP addresses.
If the maximum rate of ARP Miss messages is set to 0, the rate of ARP Miss
messages is not limited based on source IP addresses. By default, the device
accepts a maximum of 500 ARP Miss messages triggered by IP packets from the
same source IP address per second.
If the number of ARP Miss messages triggered by IP packets from the same source
IP address per second exceeds the limit, the device discards the excess ARP Miss
packets. By default, a device uses the block mode to discard all ARP Miss packets
from the source IP address within five minutes.
----End
Context
If a network device is flooded with IP packets that contain unresolvable
destination IP addresses, the device generates a large number of ARP Miss
messages. This is because the device has no ARP entry that matches the next hop
of the route. IP packets triggering ARP Miss messages are sent to the device for
processing. The device generates a large number of temporary ARP entries and
sends many ARP Request packets to the network, consuming a large number of
CPU and bandwidth resources.
To avoid the preceding problems, it is recommended that you configure rate limit
on ARP Miss messages on the gateway.
● Limiting the rate of ARP Miss messages globally: limits the number of ARP
Miss messages processed on the entire device.
● Limiting the rate of ARP Miss messages in a VLAN: limits the number of ARP
Miss messages processed on all interfaces in a VLAN. The configuration in a
VLAN does not affect IP packet forwarding on interfaces in other VLANs.
● Limiting the rate of ARP Miss messages on an interface: limits the number of
ARP Miss messages processed on an interface. The configuration on an
interface does not affect IP packet forwarding on other interfaces.
If rate limit on ARP Miss messages is configured in the system view, VLAN view,
and interface view, the device uses the configurations in the interface view, VLAN
view, and system view in order.
If you want that the device can generate alarms to notify the network
administrator of a large number of discarded ARP Miss packets, enable the alarm
function. When the number of discarded ARP Miss packets exceeds the alarm
threshold, the device generates an alarm.
NOTE
Only the S5720EI, S5720HI, S5720SI, S5720S-SI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this function.
Procedure
Step 1 Run system-view
NOTE
If you configure rate limiting on ARP Miss messages in the system view, skip the preceding step.
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between Layer 2 and
Layer 3 modes.
By default, the device can process a maximum of 100 ARP Miss messages per
second.
The alarm function for ARP Miss packets discarded when the rate of ARP Miss
packets exceeds the limit is enabled.
The alarm threshold for ARP Miss packets discarded when the rate of ARP Miss
packets exceeds the limit is set.
----End
Context
In addition to generating ARP Miss messages, the device generates temporary ARP
entries and sends ARP Request packets to the destination network.
● In the aging time of temporary ARP entries:
– Before receiving an ARP reply packet, the device discards the IP packets
matching the temporary ARP entry and does not generate ARP Miss
messages.
– After receiving an ARP Reply packet, the device generates a correct ARP
entry to replace the temporary entry.
● When temporary ARP entries age out, the device clears them. If no ARP entry
matches the IP packets forwarded by the device, ARP Miss messages and
temporary ARP entries are repeatedly generated.
You can limit the rate of ARP Miss messages by setting the aging time of
temporary ARP entries. When a device undergoes an ARP Miss attack, you can
extend the aging time of temporary ARP entries to reduce the frequency of
triggering ARP Miss messages so that the impact on the device is minimized.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run interface interface-type interface-number
The interface view is displayed.
Step 3 (Optional) On an Ethernet interface, run undo portswitch
The interface is switched to Layer 3 mode.
By default, an Ethernet interface works in Layer 2 mode.
NOTE
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between Layer 2 and
Layer 3 modes.
----End
NOTE
The optimized ARP reply function can be configured on a stand-alone fixed switch, but does
not take effect.
By default, the optimized ARP reply function is enabled. After a device receives an
ARP Request packet, the device checks whether an ARP entry corresponding to the
source IP address of the ARP Request packet exists.
● If the corresponding ARP entry exists, the stack performs optimized ARP reply
to this ARP Request packet.
● If the corresponding ARP entry does not exist, the stack does not perform
optimized ARP reply to this ARP Request packet.
Procedure
1. Run system-view
The system view is displayed.
2. Run undo arp optimized-reply disable
The optimized ARP reply function is enabled.
By default, the optimized ARP reply function is enabled.
– The optimized ARP reply function does not take effect for ARP Request
packets with double VLAN tags.
– The optimized ARP reply function takes effect for ARP Request packets
sent by wireless users.
– The optimized ARP reply function takes effect only for the ARP Request
packets received by VLANIF interfaces. The optimized ARP reply function
does not take effect for the ARP Request packets sent from the VLANIF
interfaces of super VLANs and sub VLANs.
– The optimized ARP reply function does not take effect globally or on
VLANIF interfaces after you run any of the following commands:
▪ Global ARP rate limiting, ARP rate limiting in VLANs, as well as ARP
rate limiting on interfaces (configured using the arp anti-attack
rate-limit enable command)
Context
If many user hosts simultaneously send a large number of ARP packets to a
device, or attackers send bogus ARP packets to the device, the following problems
occur:
● Processing ARP packets consumes many CPU resources. The device learns
many invalid ARP entries, which exhaust ARP entry resources and prevent the
device from learning ARP entries for ARP packets from authorized users.
Consequently, communication of authorized users is interrupted.
● After receiving bogus ARP packets, the device incorrectly modifies the ARP
entries. As a result, authorized users cannot communicate with one another
other.
To avoid the preceding problems, configure the strict ARP learning function on the
gateway. This function allows the gateway to learn only ARP entries for ARP Reply
packets in response to ARP Request packets that it has sent. In this way, the
gateway can prevent most ARP attacks.
● If strict ARP learning is enabled globally, all interfaces on the device learn ARP
entries strictly.
● If strict ARP learning is enabled in the interface view, only this interface learns
ARP entries strictly.
When strict ARP learning is enabled globally and in the interface view
simultaneously, the configuration on the interface takes precedence over the
global configuration.
NOTE
Procedure
● Configuring strict ARP learning globally
a. Run system-view
The system view is displayed.
b. Run arp learning strict
Strict ARP learning is enabled globally.
By default, strict ARP learning is disabled.
● Configuring strict ARP learning on an interface
a. Run system-view
The system view is displayed.
b. Run interface interface-type interface-number
The interface view is displayed.
c. (Optional) On an Ethernet interface, run undo portswitch
The interface is switched to Layer 3 mode.
By default, an Ethernet interface works in Layer 2 mode.
NOTE
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between
Layer 2 and Layer 3 modes.
d. Run arp learning strict { force-enable | force-disable | trust }
Strict ARP learning on the interface is enabled.
By default, strict ARP learning is disabled on the interface.
----End
Context
To prevent ARP entries from being exhausted by ARP attacks from a host
connecting to an interface on the device, set the maximum number of ARP entries
that the interface can dynamically learn. When the number of ARP entries learned
by a specified interface reaches the maximum number, the interface cannot
dynamically learn new ARP entries.
Perform the following steps on the gateway.
Procedure
● Configuring ARP entry limiting on a Layer 2 interface
a. Run system-view
The system view is displayed.
b. Run interface interface-type interface-number
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between
Layer 2 and Layer 3 modes.
d. Run arp-limit maximum maximum
NOTE
----End
Context
If a user host connected to an interface initiates an ARP attack, ARP resources of
the device may be exhausted. When a large number of dynamic ARP entries have
been learned by an interface, disable the interface from learning more ARP entries
on the gateway to ensure device security.
After dynamic ARP entry learning is disabled on an interface, the system will not
automatically delete the ARP entries that were learned previously on this
interface. Delete or retain these dynamic ARP entries as required.
NOTICE
Procedure
Step 1 Run system-view
----End
Procedure
● Run the display arp anti-attack configuration { arp-rate-limit | arp-speed-
limit | entry-check | arpmiss-rate-limit | arpmiss-speed-limit | gateway-
duplicate | log-trap-timer | packet-check | all } command to check the ARP
anti-attack configuration.(Only the S5720EI, S5720HI, S5720SI, S5720S-SI,
S5730SI, S5730S-EI, S6720LI, S6720S-LI, S6720SI, S6720S-SI, S6720EI, and
S6720S-EI support arpmiss-rate-limit, arpmiss-speed-limit and gateway-
duplicate.)
● Run the display arp-limit [ interface interface-type interface-number ]
[ vlan vlan-id ] command to check the maximum number of ARP entries that
an interface can learn.
● Run the display arp learning strict command to check strict ARP learning
globally and on all VLANIF interfaces.
----End
Pre-configuration Tasks
Before configuring defense against ARP spoofing attacks, connect interfaces and
set physical parameters for the interfaces to ensure that the physical status of the
interfaces is Up.
Configuration Procedure
Operations in the configuration procedure can be performed in any sequence.
Context
To defend against ARP address spoofing attacks, configure ARP entry fixing on the
gateway. The fixed-mac, fixed-all, and send-ack modes are applicable to
different scenarios and are mutually exclusive:
● fixed-mac: When receiving an ARP packet, the device discards the packet if
the MAC address does not match that in the corresponding ARP entry. If the
MAC addresses match but the interface number or VLAN ID does not match
that in the ARP entry, the device updates the interface number or VLAN ID in
the ARP entry. This mode applies to networks where user MAC addresses are
unchanged but user access locations often change. When a user connects to a
different interface on the device, the device updates interface information in
the ARP entry of the user timely.
● fixed-all: When the MAC address, interface number, and VLAN ID of an ARP
packet match those in the corresponding ARP entry, the device updates other
information about the ARP entry. This mode applies to networks where user
MAC addresses and user access locations are fixed.
● send-ack: When the device receives an ARP packet with a changed MAC
address, interface number, or VLAN ID, it does not immediately update the
corresponding ARP entry. Instead, the device sends a unicast ARP Request
packet to the user with the IP address mapped to the original MAC address in
the ARP entry. The device then determines whether to change the MAC
address, VLAN ID, or interface number in the ARP entry depending on the
response from the user. This mode applies to networks where user MAC
addresses and user access locations often change.
You can configure ARP entry fixing globally or on the VLANIF interface.
● If ARP entry fixing is enabled globally, all interfaces have this function
enabled by default.
● If ARP entry fixing is enabled globally and on a VLANIF interface
simultaneously, the configuration on the VLANIF interface takes precedence
over the global configuration.
Procedure
Step 1 Configure ARP entry fixing globally
1. Run system-view
The system view is displayed.
----End
Context
Configuring DAI on an access device can prevent MITM attacks and theft on
authorized users' information. After DAI is configured, the device compares the
source IP address, source MAC address, VLAN ID, and interface number in the
received ARP packet with binding entries. If the ARP packet matches a binding
entry, the device considers the ARP packet valid and allows the packet to pass
through. If the ARP packet does not match a binding entry, the device considers
the ARP packet invalid and discards the packet.
You can enable DAI in the interface view or the VLAN view. When DAI is enabled
in an interface view, the device checks all ARP packets received on the interface
against binding entries. When DAI is enabled in the VLAN view, the device checks
the ARP packets received on all interfaces belonging to the VLAN against binding
entries.
If you want to receive an alarm when a large number of ARP packets are
generated, enable the alarm function for the ARP packets discarded by DAI. After
the alarm function is enabled, the device will generate an alarm when the number
of discarded ARP packets exceeds a specified threshold.
NOTE
When ARP learning triggered by DHCP is enabled on the gateway, DAI can be enabled on
the gateway.
This function is available only for DHCP snooping scenarios. The device enabled with DHCP
snooping generates DHCP snooping binding entries when DHCP users go online. If a user
uses a static IP address, you need to manually configure a static binding entry for the user.
For details about the DHCP snooping configuration, see 9 DHCP Snooping Configuration.
For details on how to configure a static binding entry, see 12.7.1 Configuring IPSG Based
on a Static Binding Table.
Procedure
Step 1 Run system-view
DAI is enabled.
Step 4 (Optional) In the interface view, run arp anti-attack check user-bind check-item
{ ip-address | mac-address | vlan } *
or in the VLAN view, run arp anti-attack check user-bind check-item { ip-
address | mac-address | interface } *
Items for checking ARP packets based on binding entries are configured.
By default, the check items consist of IP address, MAC address, VLAN ID, and
interface number.
To allow some special ARP packets that match only one or two items in binding
entries to pass through, configure the device to check ARP packets according to
one or two specified items in binding entries.
NOTE
The IP addresses in binding entries can be IPv4 or IPv6 addresses. When the device
compares IP addresses in ARP packets with binding entries, both IPv4 and IPv6 addresses
are checked.
Items for checking ARP packets based on binding entries do not take effect on user hosts
that are configured with static binding entries. These hosts check ARP packets based on all
items in static binding entries.
When DAI is enabled in a VLAN and on an interface that belongs to the VLAN
simultaneously, the device checks the ARP packet based on the check items configured on
the interface. If the ARP packet passes the check, the device checks the packet again based
on the check items configured in the VLAN.
Step 5 (Optional) In the interface view, run arp anti-attack check user-bind alarm
enable
By default, the alarm function for ARP packets discarded by DAI is disabled.
NOTE
This type of alarm is generated for the ARP packets discarded by DAI on interfaces. Do not
run the arp anti-attack check user-bind enable command in a VLAN and the arp anti-
attack check user-bind alarm enable command on an interface in this VLAN at the same
time. Otherwise, the actual number of discarded ARP packets in the VLAN is different from
the number of discarded packets on the interface.
Step 6 (Optional) In the interface view, run arp anti-attack check user-bind alarm
threshold threshold
The alarm threshold of ARP packets discarded by DAI is set.
By default, the threshold on an interface is consistent with the threshold set by the
arp anti-attack check user-bind alarm threshold threshold command in the
system view. If the alarm threshold is not set in the system view, the default
threshold on the interface is 100.
Step 7 Configure a trusted interface.
Configure the interface directly or indirectly connected to the authorized DHCP
server as a trusted interface, otherwise, the return packets are discarded because
they do not match the binding entries and service interruptions will occur. After
the upstream interface is configured as a trusted interface, the switch forwards the
packets received by the interface without checking them against the binding
entries.
1. Run the dhcp enable command to enable DHCP globally.
By default, DHCP is disabled globally.
2. Run the dhcp snooping enable command to enable DHCP snooping globally.
By default, DHCP snooping is disabled globally.
3. Run interface interface-type interface-number or,vlan vlan-id
The interface view or VLAN view is displayed.
4. Run the dhcp snooping enable command to enable DHCP snooping in the
VLAN or on the interface.
By default, DHCP snooping is disabled in VLANs or on interfaces.
5. Run the dhcp snooping trusted command in the interface view or the dhcp
snooping trusted interface interface-type interface-number command in the
VLAN view to configure the interface as a trusted interface.
By default, an interface is untrusted.
----End
Context
If an attacker forges the gateway address to send ARP packets with the source IP
address being the IP address of the gateway on the LAN, ARP entries on hosts in
the LAN record the incorrect gateway address. As a result, all traffic from user
hosts to the gateway is sent to the attacker and the attacker intercepts user
information. Communication of users is interrupted.
To prevent bogus gateway attacks, enable ARP gateway anti-collision on the
gateway. The gateway considers that a gateway collision occurs when a received
ARP packet meets either of the following conditions:
● The source IP address in the ARP packet is the same as the IP address of the
VLANIF interface matching the physical inbound interface of the packet.
● The source IP address in the ARP packet is the virtual IP address of the
inbound interface but the source MAC address in the ARP packet is not the
virtual MAC address of the VRRP group.
The device generates an ARP anti-collision entry and discards the received packets
with the same source MAC address and VLAN ID in a specified period. This
function prevents ARP packets with the bogus gateway address from being
broadcast in a VLAN.
NOTE
Only the S5720HI, S5720EI, S5720SI, S5720S-SI, S5730SI, S5730S-EI, S6720LI, S6720S-LI,
S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this function.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run arp anti-attack gateway-duplicate enable
ARP gateway anti-collision is enabled.
By default, ARP gateway anti-collision is disabled.
----End
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 (Optional) Run interface vlanif interface-number
The VLANIF interface view is displayed.
NOTE
If you intend to configure gratuitous ARP packet sending in the system view, skip this step.
----End
Context
If an attacker poses as a gateway to send ARP packets, other users on the network
consider the attacker to be a gateway, causing a communication interruption
between authorized users and gateway. This situation will also happen if a user
incorrectly sets the host IP address as the gateway address. To prevent such bogus
gateway attacks, configure ARP gateway protection on the device's interfaces
connected to the gateway. When the ARP packets from a gateway address reach a
device:
● The interfaces with gateway protection enabled can receive and forward the
ARP packets.
● The interfaces without gateway protection enabled discard the ARP packets.
Procedure
Step 1 Run system-view
ARP gateway protection is enabled and the protected gateway IP address is set.
----End
Context
The MAC address consistency check function for ARP packets prevents attacks
from bogus ARP packets in which the source and destination MAC addresses are
different from those in the Ethernet frame header. This function is usually
configured on gateways.
This function enables the gateway to check the MAC address consistency in an
ARP packet before ARP learning. If the source and destination MAC addresses in
an ARP packet are different from those in the Ethernet frame header, the device
discards the packet as an attack. If the source and destination MAC addresses in
an ARP packet are the same as those in the Ethernet frame header, the device
performs ARP learning.
Procedure
Step 1 Run system-view
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between Layer 2 and
Layer 3 modes.
NOTE
----End
NOTE
Generally, packets with different source and destination MAC addresses in the ARP packet and
Ethernet frame header are allowed by the ARP protocol. When an attack occurs, capture and
analyze packets. If the attack is initiated by using inconsistent source MAC addresses in the ARP
packet and Ethernet frame header, enable ARP packet validity check based on the source MAC
address.
Procedure
Step 1 Run system-view
The system view is displayed.
----End
Context
If many user hosts simultaneously send a large number of ARP packets to a
device, or attackers send bogus ARP packets to the device, the following problems
occur:
● Processing ARP packets consumes many CPU resources. The device learns
many invalid ARP entries, which exhaust ARP entry resources and prevent the
device from learning ARP entries for ARP packets from authorized users.
Consequently, communication of authorized users is interrupted.
● After receiving bogus ARP packets, the device incorrectly modifies the ARP
entries. As a result, authorized users cannot communicate with one another
other.
To avoid the preceding problems, configure the strict ARP learning function on the
gateway. This function allows the gateway to learn only ARP entries for ARP Reply
packets in response to ARP Request packets that it has sent. In this way, the
gateway can prevent most ARP attacks.
● If strict ARP learning is enabled globally, all interfaces on the device learn ARP
entries strictly.
● If strict ARP learning is enabled in the interface view, only this interface learns
ARP entries strictly.
When strict ARP learning is enabled globally and in the interface view
simultaneously, the configuration on the interface takes precedence over the
global configuration.
NOTE
Procedure
● Configuring strict ARP learning globally
a. Run system-view
Only the S5720HI, S5720EI, S6720EI, and S6720S-EI support switching between
Layer 2 and Layer 3 modes.
d. Run arp learning strict { force-enable | force-disable | trust }
----End
Context
When many DHCP users connect to a network device, the device needs to learn
and maintain many ARP entries. This affects device performance.
To address this issue, configure ARP learning triggered by DHCP on the gateway.
When the DHCP server allocates an IP address for a user, the gateway generates
an ARP entry for the user based on the DHCP ACK packet received on the VLANIF
interface.
NOTE
Before configuring ARP learning triggered by DHCP, ensure that DHCP is enabled using the
dhcp enable command.
When both VRRP and DHCP relay are configured on the network, neither the dhcp
snooping enable command nor the arp learning dhcp-trigger command can be
configured on the VRRP master and backup devices.
You can also deploy DAI to prevent ARP entries of DHCP users from being
modified maliciously.
Procedure
Step 1 Run system-view
----End
Context
To prevent bogus ARP packets at the PW side from being broadcast to the AC side
on a VPLS network, enable ARP proxy over VPLS on a PE.
ARP packets at the PW side are sent to the CPU for processing.
● If the ARP packets are ARP Request packets and the destination IP addresses
in the packets match DHCP snooping binding entries, the device constructs
ARP Reply packets based on the DHCP snooping binding entries. The device
then sends the ARP Reply packets to the requester at the PW side.
● If the ARP packets are not ARP Request packets or the destination IP
addresses in the packets do not match a DHCP snooping binding entry, the
device forwards these ARP packets to the destination.
This function works with DHCP snooping over VPLS. For the configuration of
DHCP snooping over VPLS, see 9.6.1 Enabling DHCP Snooping.
NOTE
Procedure
Step 1 Run system-view
----End
Procedure
● Run the display arp anti-attack configuration { arp-rate-limit | arp-speed-
limit | entry-check | arpmiss-rate-limit | arpmiss-speed-limit | gateway-
duplicate | log-trap-timer | packet-check | all } command to check the ARP
anti-attack configuration.(Only the S5720EI, S5720HI, S5720SI, S5720S-SI,
S5730SI, S5730S-EI, S6720LI, S6720S-LI, S6720SI, S6720S-SI, S6720EI, and
S6720S-EI support arpmiss-rate-limit, arpmiss-speed-limit and gateway-
duplicate.)
Only the S5720HI, S5720EI, S5720SI, S5720S-SI, S5730SI, S5730S-EI, S6720LI, S6720S-
LI, S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this command.
----End
Only the S5720EI, S5720HI, S5720SI, S5720S-SI, S5730SI, S5730S-EI, S6720LI, S6720S-
LI, S6720SI, S6720S-SI, S6720EI, and S6720S-EI support this command.
● Run the display arp optimized-reply status command to display the status
of the optimized ARP reply function.
● Run the display arp optimized-reply statistics [ slot slot-id ] command to
display statistics on optimized ARP Reply packets.
----End
Context
NOTICE
ARP security statistics cannot be restored after being cleared. Confirm the action
before you use the command.
To clear ARP security statistics, run the following commands in the user view:
Procedure
● Run the reset arp packet statistics command to clear ARP packet statistics.
● Run the reset arp anti-attack statistics check user-bind interface interface-
type interface-number command to clear statistics on ARP packets discarded
for not matching binding entries.
● Run the reset arp anti-attack statistics rate-limit command to clear
statistics on ARP packets discarded when the number of ARP packets exceeds
the limit.
● Run the reset arp optimized-reply statistics [ slot slot-id ] command to
clear statistics on optimized ARP Reply packets.
----End
Context
After rate limiting on ARP packets based on the source IP address is enabled, if the
number of ARP packets the device receives per second exceeds the limit, the
device discards the excess ARP packets. The device considers the excess ARP
packets as potential attacks. The device sends ARP alarms indicating potential
attacks to the NMS. To avoid excessive alarms when ARP attacks occur, reduce the
alarm quantity by setting a proper interval for sending alarms.
NOTE
The configuration takes effect only on the alarm for ARP rate limit based on source IP addresses
(corresponding to arp speed-limit source-ip). The other ARP alarms are generated at a fixed
interval of 5 seconds.
Procedure
Step 1 Run the system-view command to enter the system view.
Step 2 Run the arp anti-attack log-trap-timer time command to set the interval for
sending ARP alarms.
The default interval for sending alarms is 0, indicating that the device does not
send ARP alarms.
----End
Networking Requirements
As shown in Figure 7-11, the switch functioning as the gateway connects to a
server through GE0/0/3 and connects to four users in VLAN 10 and VLAN 20
through GE0/0/1 and GE0/0/2. The following ARP threats exist on the network:
● Attackers send bogus ARP packets or bogus gratuitous ARP packets to the
switch. ARP entries on the switch are modified, leading to packet sending and
receiving failures.
● Attackers send a large number of IP packets with unresolvable destination IP
addresses to the switch, leading to CPU overload.
● User1 sends a large number of ARP packets with fixed MAC addresses but
variable source IP addresses to the switch. As a result, ARP entries on the
switch are exhausted and the CPU cannot process other services.
● User3 sends a large number of ARP packets with fixed source IP addresses to
the switch. As a result, the CPU of the switch is insufficient to process other
services.
The administrator wants to prevent the preceding ARP attacks and provide users
with stable services on a secure network.
GE0/0/1 GE0/0/2
Server
VLANIF 10 VLANIF 20
10.8.8.4/24 10.9.9.4/24
VLAN10 VLAN20
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure strict ARP learning and ARP entry fixing to prevent ARP entries
from being modified by bogus ARP packets.
2. Configure rate limiting on ARP Miss messages based on source IP addresses.
This function defends against attacks from ARP Miss messages triggered by a
large number of IP packets (ARP Miss packets) with unresolvable IP addresses.
At the same time, the switch must have the capability to process a large
number of ARP Miss packets from the server to ensure network
communication.
3. Configure ARP entry limiting and rate limiting on ARP packets based on
source MAC addresses. These functions defend against ARP flood attacks
caused by a large number of ARP packets with fixed MAC addresses but
variable IP addresses and prevent ARP entries from being exhausted and CPU
overload.
4. Configure rate limiting on ARP packets based on source IP addresses. This
function defends against ARP flood attacks from User3 with a fixed IP address
and prevents CPU overload.
Procedure
Step 1 Create VLANs, add interfaces to the VLANs, and configure VLANIF interfaces.
# Create VLAN 10, VLAN 20, VLAN 30, and add GE0/0/1 to VLAN 10, GE0/0/2 to
VLAN 20, and GE0/0/3 to VLAN 30.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 10 20 30
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[Switch-GigabitEthernet0/0/1] quit
[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] port link-type trunk
[Switch-GigabitEthernet0/0/2] port trunk allow-pass vlan 20
[Switch-GigabitEthernet0/0/2] quit
[Switch] interface gigabitethernet 0/0/3
[Switch-GigabitEthernet0/0/3] port link-type trunk
[Switch-GigabitEthernet0/0/3] port trunk allow-pass vlan 30
[Switch-GigabitEthernet0/0/3] quit
# Create VLANIF 10, VLANIF 20, and VLANIF 30, and assign IP addresses to them.
[Switch] interface vlanif 10
[Switch-Vlanif10] ip address 10.8.8.4 24
[Switch-Vlanif10] quit
[Switch] interface vlanif 20
[Switch-Vlanif20] ip address 10.9.9.4 24
[Switch-Vlanif20] quit
[Switch] interface vlanif 30
[Switch-Vlanif30] ip address 10.10.10.3 24
[Switch-Vlanif30] quit
Step 4 Configure rate limiting on ARP Miss messages based on source IP addresses.
# Set the maximum rate of ARP Miss messages triggered by the server (IP address
10.10.10.2) to 40 pps, and set the maximum rate of ARP Miss messages triggered
by other user hosts to 20 pps.
[Switch] arp-miss speed-limit source-ip maximum 20
[Switch] arp-miss speed-limit source-ip 10.10.10.2 maximum 40
Step 6 Configure rate limiting on ARP packets based on source MAC addresses.
# Set the maximum rate of ARP packets from User1 with the source MAC address
1-1-1 to 10 pps.
[Switch] arp speed-limit source-mac 1-1-1 maximum 10
# Run the display arp-limit command to check the maximum number of ARP
entries that the interface can dynamically learn.
[Switch] display arp-limit interface gigabitethernet 0/0/1
Interface LimitNum VlanID LearnedNum(Mainboard)
---------------------------------------------------------------------------
GigabitEthernet0/0/1 20 10 0
---------------------------------------------------------------------------
Total:1
# Run the display arp anti-attack configuration all command to check the
configuration of ARP anti-attack.
[Switch] display arp anti-attack configuration all
......
ARP anti-attack entry-check mode:
Vlanif Mode
-------------------------------------------------------------------------------
All fixed-mac
-------------------------------------------------------------------------------
......
ARP speed-limit for source-MAC configuration:
MAC-address suppress-rate(pps)(rate=0 means function disabled)
-------------------------------------------------------------------------------
0001-0001-0001 10
Others 0
-------------------------------------------------------------------------------
The number of configured specified MAC address(es) is 1, spec is 512.
# Run the display arp packet statistics command to check statistics on ARP-
based packets.
[Switch] display arp packet statistics
ARP Pkt Received: sum 8678904
ARP-Miss Msg Received: sum 183
ARP Learnt Count: sum 37
ARP Pkt Discard For Limit: sum 146
ARP Pkt Discard For SpeedLimit: sum 40529
In the preceding command output, the numbers of ARP packets and ARP Miss
messages discarded by the switch are displayed, indicating that the ARP security
functions have taken effect.
----End
Configuration File
Switch configuration file
#
sysname Switch
#
vlan batch 10 20 30
#
arp learning strict
#
arp-miss speed-limit source-ip 10.10.10.2 maximum 40
arp speed-limit source-ip 10.9.9.2 maximum 10
arp speed-limit source-mac 0001-0001-0001 maximum 10
arp anti-attack entry-check fixed-mac enable
#
arp-miss speed-limit source-ip maximum 20
#
interface Vlanif10
ip address 10.8.8.4 255.255.255.0
#
interface Vlanif20
ip address 10.9.9.4 255.255.255.0
#
interface Vlanif30
ip address 10.10.10.3 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
arp-limit vlan 10 maximum 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 30
#
return
Networking Requirements
As shown in Figure 7-12, SwitchA connects to the DHCP server through GE0/0/4,
connects to DHCP clients UserA and UserB through GE0/0/1 and GE0/0/2, and
connects to UserC configured with a static IP address through GE0/0/3. GE0/0/1,
GE0/0/2, GE0/0/3, and GE0/0/4 on SwitchA all belong to VLAN 10. The
administrator wants to prevent ARP MITM attacks and theft on authorized user
information, and learn the frequency and range of ARP MITM attacks.
Figure 7-12 Networking diagram for defending against ARP MITM attacks
SwitchB
DHCP Server
GE0/0/4
SwitchA
GE0/0/1
GE0/0/2 GE0/0/3
IP:10.0.0.2/24
DHCP Client DHCP Client
MAC:1-1-1
VLAN ID:10
Configuration Roadmap
The configuration roadmap is as follows:
1. Enable DAI so that SwitchA compares the source IP address, source MAC
address, interface number, and VLAN ID of the ARP packet with DHCP
snooping binding entries. This prevents ARP MITM attacks.
2. Enable the alarm function for the ARP packets discarded by DAI so that
SwitchA collects statistics on ARP packets that do not match a DHCP
snooping binding entry and generates alarms when the number of discarded
ARP packets exceeds the alarm threshold. The administrator learns the
frequency and range of the current ARP MITM attacks based on the alarms
and the number of discarded ARP packets.
3. Enable DHCP snooping and configure a static binding table to make DAI take
effect.
Procedure
Step 1 Create a VLAN and add interfaces to the VLAN.
# Create VLAN 10, and add GE0/0/1, GE0/0/2, GE0/0/3, and GE0/0/4 to VLAN 10.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10
# Enable DAI and the packet discarding alarm function on GE0/0/1, GE0/0/2, and
GE0/0/3. GE0/0/1 is used as an example. Configurations of GE0/0/2 and GE0/0/3
are similar to the configuration of GE0/0/1, and are not mentioned here.
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] arp anti-attack check user-bind enable
[SwitchA-GigabitEthernet0/0/1] arp anti-attack check user-bind alarm enable
[SwitchA-GigabitEthernet0/0/1] quit
# Run the display arp anti-attack statistics check user-bind interface command
to check the number of ARP packets discarded based on DAI. GE0/0/1 is used as
an example.
[SwitchA] display arp anti-attack statistics check user-bind interface gigabitethernet 0/0/1
Dropped ARP packet number is 966
Dropped ARP packet number since the latest warning is 605
----End
Configuration File
SwitchA configuration file
#
sysname SwitchA
#
vlan batch 10
#
dhcp enable
#
dhcp snooping enable
user-bind static ip-address 10.0.0.2 mac-address 0001-0001-0001 interface GigabitEthernet0/0/3 vlan 10
#
vlan 10
dhcp snooping enable
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
arp anti-attack check user-bind enable
arp anti-attack check user-bind alarm enable
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
arp anti-attack check user-bind enable
arp anti-attack check user-bind alarm enable
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
arp anti-attack check user-bind enable
arp anti-attack check user-bind alarm enable
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10
dhcp snooping trusted
#
return
7.11.4 DAI and EAI Are Enabled on a Switch. Why Can the
Switch Forward ARP Packets Sent by Unauthorized Users to
Request MAC Addresses of Authorized Users?
In earlier versions of V200R001, a DAI-enabled switch checks an incoming ARP
packet against the binding table based on ACL rules delivered to the chip. An EAI-
enabled switch sends the packet to the CPU, searches the outbound interface of
the packet in the binding table, and then forwards the packet using software. Both
DAI and EAI are Layer 2 functions, but the ACL rule for sending ARP packets to the
CPU delivered by EAI takes preference over that delivered by DAI. Therefore, DAI
does not check ARP packets and the ARP packets sent by unauthorized users to
request MAC addresses of authorized users can be normally forwarded.
In V200R001 and later versions, a DAI-enabled switch checks ARP packets using
software. This problem does not happen.
In V200R001 and later versions, a DAI-enabled switch checks ARP packets using
software. The ARP packet with its source MAC address different from that in the
Ethernet frame header is discarded.
Run the arp-fake expire-time 30 command in the view of each VLANIF interface
to configure ARP entries and reduce the CPU usage. Besides, you are advised to
load the latest patch.
When you locate an ARP attack, first check the links, loops, and routes. After
confirming that they are not the cause, perform the following steps. Saving the
results of each troubleshooting step is recommended. If your troubleshooting fails
to correct the fault, record your actions and provide the record to technical
support personnel.
1. Run the display cpu-defend statistics all command on the gateway to check
the count of dropped ARP Request, ARP Reply, or ARP Miss messages.
– If the count of dropped ARP packets is 0, go to step 2.
– If the count of dropped ARP packets is not 0, the rate of ARP packets has
exceeded the CPCAR rate limit and excess ARP packets are being
discarded.
▪ If a lot of ARP Miss messages are discarded, ARP Miss attacks may
occur on the device. For the detailed troubleshooting procedure, see
7.11.11 How Can I Handle an ARP Learning Failure Caused by
ARP Miss Messages?.
▪ If the user's ARP entry on the gateway has been modified, ARP
spoofing gateway attacks are occurring on the device.
1) Obtain packet headers on the interface connecting the device to
the user, and locate the attack source according to the source
addresses of ARP Request packets.
2) Remove viruses or uninstall the attack tool after finding the
attacker. Configure the anti-attack function on the gateway
based on the site requirements.
○ Run the arp static command in the system view to
configure static ARP entries.
If a few users are connected to the device, you can
configure static ARP entries and bind the static ARP entry to
the MAC address and IP address to prevent the IP addresses
from being used by unauthorized users.
○ Run the arp anti-attack entry-check { fixed-mac | fixed-
all | send-ack } enable command in the system view or
interface view to configure fixed ARP.
○ fixed-mac: applies to the scenario where a user has a
fixed MAC address but the user's access location
frequently changes. When the user connects to the
device from different interfaces, the interface
information in the user's ARP entry on the device can
be updated in real time.
▪ If the gateway ARP entry of the user is modified, ARP bogus gateway
attacks occur on the device.
1) Obtain packet headers on the interface connecting the device to
the user, and locate the attack source according to the source
addresses of ARP Request packets.
2) Remove viruses or uninstall the attack tool after finding the
attacker. Configure the anti-attack function on the gateway
based on the site requirements.
○ Configure interface isolation on the downlink interfaces of
the gateway to prevent users in the same VLAN from
receiving ARP attack packets.
○ Run the arp anti-attack gateway-duplicate enable
command in the system view to enable the ARP gateway
anti-collision function, and run the arp gratuitous-arp send
enable command to enable the device to send gratuitous
ARP packets so that the correct gateway address can be
sent to users.
○ Configure the blacklist or a blackhole MAC address entry so
that packets from the attack source will be discarded.
▪ If other users' ARP entries of the user are modified, go to the next
step.
○ Obtain packet headers on the interface connecting the device to
the user, and locate the attack source according to the source
addresses of ARP Request packets.
○ Remove viruses or uninstall the attack tool after finding the
attacker. Configure the anti-attack function on the access device
based on site requirements.
○ Run the arp anti-attack check user-bind enable command
in the interface or VLAN view to enable dynamic ARP
inspection. (The device matches ARP packets against the
binding table.)
Dynamic ARP inspection is used to prevent man-in-the-
middle attacks and theft on authorized user information.
NOTE
NOTICE
Fixed ARP After the device with this You are advised to
function enabled learns enable this function on
an ARP entry for the first the gateway.
time, it does not modify
the ARP entry, but only
updates part of the
entry, or sends an ARP
Request packet to check
validity of the ARP
packet for updating the
entry.
The device supports
three ARP entry fixing
modes: fixed-all, fixed-
mac, and send-ack.
Gratuitous ARP packet Allows the device used You are advised to
sending as the gateway to enable this function on
periodically send ARP the gateway.
Request packets whose
destination IP address is
the device IP address to
update the gateway
MAC address in ARP
entries. This function
ensures that packets of
authorized users are
forwarded to the
gateway and prevents
hackers from
intercepting these
packets.
no ARP entry matching the next hop of the route) to a device, the device sends a
large number of ARP Miss messages and many ARP Request packets to the
destination network, consuming considerable CPU and bandwidth resources.
Perform the following steps to rectify the fault. Saving the results of each
troubleshooting step is recommended. If your troubleshooting fails to correct the
fault, record your actions and provide the record to technical support personnel.
1. Run the display arp all command in the user view to check ARP entries.
If the MAC address field in an ARP entry displays Incomplete, the device has
failed to learn this ARP entry. You can obtain IP address and interface
information from the entry.
2. Obtain packet headers on the interface connecting the device to the user, and
analyze the source IP addresses of packets.
3. Run the display cpu-defend statistics packet-type arp-miss all command in
the user view to check whether the Drop value of ARP Miss packets increases.
– If the count of dropped ARP Miss packets is 0, the device has failed to
learn ARP entries because of a small rate limit for ARP Miss messages.
Go to step 5 to increase the rate limit for ARP Miss messages based on
site requirements.
– If the count of dropped ARP Miss packets is not 0, the rate of ARP Miss
packets exceeds the CPCAR rate limit and excess ARP Miss packets are
discarded. Check whether the CPCAR value for ARP Miss packets is set
properly.
NOTICE
Improper CPCAR settings will affect services on your network. If you need to
adjust CPCAR settings, you are advised to contact technical support personnel
for help.
The attack defense policy can take effect only after it is applied.
If the fault persists or the fault is rectified but CPU usage is still high, go to
step 5 to decrease the rate limit of ARP Miss messages.
5. Run the display arp anti-attack configuration [ arpmiss-speed-limit |
arpmiss-rate-limit ] command in the user view to check configuration of ARP
Miss rate suppression.
– Run the arp-miss speed-limit source-ip [ ip-address ] maximum
maximum command in the system view to configure the maximum rate
of ARP Miss messages sent from a specified source IP address.
– Run the arp-miss anti-attack rate-limit packet packet-number
[ interval interval-value ] command in the system view, VLAN view, or
interface view to configure the rate limiting duration and rate limit value
for ARP Miss messages.
In versions earlier than V200R003C00, the packet and interval
parameters are not supported on the device and do not need to be
configured.
6. If the fault persists, collect the following information and contact technical
support personnel:
– Result of the preceding procedure
– Configuration file, logs, and alarms of the device
● The device has a high CPU usage or is disconnected from the NMS, or the
attached devices are disconnected from the network.
● Ping responses are delayed, packets are lost, or the ping operation fails.
To resolve the problem, perform the following steps. Saving the results of each
troubleshooting step is recommended. If your troubleshooting fails to correct the
fault, record your actions and provide the record to technical support personnel.
1. Run the display cpu-defend statistics packet-type { arp-request | arp-
reply } all command in the user view to check whether the Drop value of ARP
Request or Reply packets increases.
– If the count of dropped packets is 0, go to step 6.
– If the count of dropped packets is not 0, the rate of ARP Request or Reply
packets has exceeded the CPCAR rate limit and excess packets have been
discarded. Go to step 2.
2. Run the display cpu-usage command in the user view to check the CPU
usage of the device.
– If CPU usage is in the normal range, Go to step 3.
– If CPU usage exceeds 70%, Go to step 5.
3. Run the car command in the attack defense policy view to increase the
CPCAR values for ARP Request or Reply packets.
NOTICE
Improper CPCAR settings will affect services on your network. If you need to
adjust CPCAR settings, you are advised to contact technical support personnel
for help.
Apply the attack defense policy after running the car command. The attack
defense policy can take effect only after it is applied.
After the preceding steps, if the fault persists or the fault is rectified but CPU
usage is high, go to step 4.
4. Obtain packet headers on user-side interfaces of the device, and find the
attacker based on the source addresses of ARP Request or Reply requests
received on these interfaces.
If many ARP Request or Reply packets have the same source MAC or IP
address, the device considers that the host with this source MAC or IP address
is the attack source.
Based on the actual network environment, run the arp speed-limit source-ip
[ ip-address ] maximum maximum command in the system view to decrease
the rate limit of ARP packets based on the source IP address, or run the arp
speed-limit source-mac [ mac-address ] maximum maximum command to
limit the rate of ARP packets based on the source MAC address.
When ARP packet rate limit based on the source IP or MAC address has been
set to a small value (for example, 5 bit/s), determine whether the fault has
been rectified:
– If the fault persists, go to step 5.
– If the fault is rectified but CPU usage is high, configure the blacklist or a
blackhole MAC address entry so that packets from the attack source will
7.11.15 Can the Device Prevent ARP Attacks After the ARP
Anti-Attack Function Is Configured?
After the ARP anti-attack function is configured, the device can only reduce the
impact of the ARP attacks. For example:
● ARP Miss message limiting can only reduce the impact of ARP Miss attacks,
but cannot prevent ARP Miss attacks or defend against ARP packet attacks or
ARP spoofing attacks.
● ARP gateway anti-collision can only prevent bogus gateway attacks, but
cannot prevent ARP flood attacks or ARP spoofing gateway attacks.