150
To do…
Use the command…
Remarks
Display information about secure
MAC addresses
display port-security mac-address
security
[
interface
interface-type
interface-number
] [
vlan
vlan-id
]
[
count
] [
|
{
begin
|
exclude
|
include
}
regular-expression
]
Available in any view
Display information about
blocked MAC addresses
display port-security mac-address
block
[
interface
interface-type
interface-number
] [
vlan
vlan-id
]
[
count
] [
|
{
begin
|
exclude
|
include
}
regular-expression
]
Available in any view
Port security configuration examples
Configuring the autoLearn mode
Network requirements
Configure port GigabitEthernet 1/0/1 on the switch:
Allow up to 64 users on the port without authentication.
Permit the port to learn and add the MAC addresses as sticky MAC address, and set the sticky MAC
aging timer to 30 minutes.
After the number of secure MAC addresses reaches 64, the port stops learning MAC addresses. If
any frame with an unknown MAC address arrives, intrusion protection is triggered and the port is
disabled and stays silent for 30 seconds.
Figure 47
Network diagram for configuring the autoLearn mode
Internet
Switch
Host
GE1/0/1
192.168.1.1/24
Configuration procedure
1.
Configure port security.
# Enable port security.
<Switch> system-view
[Switch] port-security enable
# Set the sticky MAC aging timer to 30 minutes.
[Switch] port-security timer autolearn aging 30
# Enable port security traps for intrusion protection.
[Switch] port-security trap intrusion
[Switch] interface gigabitethernet 1/0/1
# Set the maximum number of secure MAC addresses allowed on the port to 64.
[Switch-GigabitEthernet1/0/1] port-security max-mac-count 64
# Set the port security mode to autoLearn.