If you want to configure at the same time on multiple ports, you can use the interface range fastethernet 0/1-2 command
SW1 (config) #interface range fastethernet 0/1-2
SW1 (Config-if-range) #sh
SW1 (Config-if-range) #shutdown
SW1 (Config-if-range) #
%link-5-changed:interface FASTETHERNET0/1, CHANGED state to administratively down
%lineproto-5-updown:line protocol on Interface FASTETHERNET0/1, changed
%link-5-changed:interface FASTETHERNET0/2, CHANGED state to administratively down
%lineproto-5-updown:line protocol on Interface FASTETHERNET0/2, changed
%lineproto-5-updown:line protocol on Interface Vlan1, changed
SW1 (Config-if-range) #sw
SW1 (config-if-range) #switchport mo ac
SW1 (Config-if-range) #sw
SW1 (config-if-range) #switchport PO
SW1 (config-if-range) #switchport port-security
SW1 (Config-if-range) #sw
SW1 (config-if-range) #switchport PO
SW1 (config-if-range) #switchport port-security Max
SW1 (config-if-range) #switchport port-security maximum 1
SW1 (Config-if-range) #sw
SW1 (config-if-range) #switchport PO
SW1 (config-if-range) #switchport port-security V
SW1 (config-if-range) #switchport port-security violation sh
SW1 (config-if-range) #switchport port-security violation shutdown
SW1 (Config-if-range) #sw
SW1 (config-if-range) #switchport PO
SW1 (Config-if-range) #switchport port-security, AC
SW1 (config-if-range) #switchport Port-security mac
SW1 (config-if-range) #switchport port-security?
Mac-address Secure MAC Address
Maximum Max secure addresses
Violation Security violation mode
<cr>
SW1 (Config-if-range) #switchport port-security s
SW1 (config-if-range) #switchport Port-security mac
SW1 (config-if-range) #switchport port-security mac-address?
H.H.H-bit MAC address
Sticky Configure Dynamic secure addresses as sticky
SW1 (config-if-range) #switchport port-security mac-address s
SW1 (config-if-range) #switchport port-security mac-address Sticky
SW1 (config-if-range) #no sh
SW1 (Config-if-range) #no shutdown
Sw1#show port-security
Secure Port maxsecureaddr currentaddr securityviolation Security Action
(Count) (Count) (Count)
--------------------------------------------------------------------
FA0/1 1 1 0 Shutdown
FA0/2 1 0 0 Shutdown
----------------------------------------------------------------------
Sw1#show mac-a
Sw1#show mac-address-table
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0001.4383.a201 STATIC FA0/2
1 0030.a303.1701 STATIC FA0/1
This article is from "A growing small tree" blog, please be sure to keep this source http://growing2015.blog.51cto.com/12006344/1917171
Switch port security Sticky MAC address cont.