Configuration Guide Port-based Flow Control Configuration
Ruijie(config-if)# switchport
port-security maximum value
Set the maximum number of secure addresses on
the interface. The range is between 1 and 1000 and
the default value is 128.
Ruijie(config-if)# switchport
port-security violation{protect |
restrict | shutdown}
Set the violation handling mode:
protect: Protected port. When the number of secure
addresses if full, the security port will discard the
packets from unknown address (that is, not any
among the secure addresses of the port).
restrict: In the case of violation, a Trap notification is
sent
shutdown: In the case of violation, the port is shut
down and a Trap notification is sent. When a port is
closed because of violation, you can recover it from
the error status by using the errdisable recovery
command in the global configuration mode.
Ruijie(config-if)# switchport
port-security mac-address sticky
Enable the Sticky MAC address learning.
In the interface configuration mode, you can disable the port security function of an interface with the
command no switchport port-security. Use the command no switchport port-security maximum
to recover to the default maximum value. Use the command no switchport port-security violation
to set violation handling to the default mode. Use the command no switchport port-security
mac-address sticky to set the Sticky MAC address learning to the default mode.
The instance below describes how to enable the port security function on interface gigabitethernet 0/3.
The maximum number of addresses to be set is 8 and the violation handling mode is set as protect.
Ruijie# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Ruijie(config)# interface gigabitethernet 0/3
Ruijie(config-if)# switchport mode access
Ruijie(config-if)# switchport port-security
Ruijie(config-if)# switchport port-security maximum 8
Ruijie(config-if)# switchport port-security violation protect
Ruijie(config-if)# switchport port-security mac-address sticky
Ruijie(config-if)# end