Configuring MAC Address Consistency Check in an ARP Packet
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
- Run system-view
The system view is displayed.
- Configuring MAC address consistency check in an ARP packet
In the system view:
Run arp validate source-mac
MAC address consistency check in an ARP packet is globally enabled. This function compares the source MAC addresses in ARP packets with those in the Ethernet frame header.
By default, MAC address consistency check in an ARP packet is disabled.
In the interface view:
Run interface interface-type interface-number
The interface view is displayed.
You need to perform the next step only when you need to enter the Layer 3 interface view.
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.
The mode switching function takes effect when the interface only has attribute configurations (for example, shutdown and description configurations). Alternatively, if configuration information supported by both Layer 2 and Layer 3 interfaces exists (for example, mode lacp and lacp system-id configurations), no configuration that is not supported after the working mode of the interface is switched can exist. If unsupported configurations exist on the interface, delete the configurations first and then run the undo portswitch command.
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to switch these interfaces to Layer 3 mode in batches.
Run arp validate { source-mac | destination-mac }*
MAC address consistency check in an ARP packet is enabled. This function compares the source and destination MAC addresses in ARP packets with those in the Ethernet frame header.
By default, MAC address consistency check in an ARP packet is disabled.
VLANIF interfaces do not support the arp validate { source-mac | destination-mac } * command. When receiving ARP packets, a VLANIF interface checks MAC address consistency based on the rule configured on the member interface.
- Run commit
The configuration is committed.