Switch>en
Switch#conf t
Switch(config)#interface range fastEthernet 0/1-2,
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport port-security
Switch(config-if-range)#exit
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport port-security mac-address 0001.4269.9ED2 (1)
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/2
Switch(config-if)#switchport port-security mac-address sticky (2)
Switch(config-if)#exit
Switch(config)#interface gigabitEthernet 1/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security maximum 3 (3)
Switch(config-if)#^Z
Switch#show port-security
توضیح شماره (1) : سوئیچ روی پورت fastEthernet 0/1 تنها به مک آدرس مذکور یعنی 0001.4269.9ED2 اجازه میدهد.
توضیح شماره (2) : سوئیچ روی پورت fastEthernet 0/2 تنها به همان مک آدرسی که اولین بار یاد میگیرد، اجازه میدهد.
توضیح شماره (3) : سوئیچ روی پورت gigabitEthernet 1/1 به حداکثر سه تا مک آدرس، اجازه میدهد.
Switch>en
Switch# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
OR
Switch>en
Switch#write memory
Building configuration...
[OK]
Switch>enable
Switch#conf terminal
Switch(config)#interface vlan 1
Switch(config-if)#no shutdown
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#enable secret cisco....(OR)....Switch(config)#enable password cisco
Switch(config)#username cisco password cisco
Switch(config)#line vty 0 15
Switch(config-line)#login local
Switch(config)#hostname SPISwitch
SPIswitch(config)#ip domain-name SPI
SPIswitch(config)#crypto key generate rsa
The name for the keys will be: SPIswitch.SPI
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys . Choosing a key modulus greater than 512 may take
. a few minutes
1024:[How many bits in the modulus [512
[ Generating 1024 bit RSA keys, keys will be non-exportable...[OK%
#(SPIswitch(config
Mar 1 0:35:54.772: %SSH-5-ENABLED: SSH 1.99 has been enabled*
SPIswitch#show crypto key mypubkey rsa
% Key pair was generated at: 0:35:51 UTC Mar 1 1993
Key name: SPIswitch.SPI
Storage Device: not specified
Usage: General Purpose Key
.Key is not exportable
:Key Data
00004fa2 000065a4 00003f5a 00000db5 00004420 0000609c 00001f5d 00006c2a
00005986 0000095a 0000789a 00003b57 00005b96 000033a4 00006a87 00000c67
0000081d 00001229 000058ef 0000008e 000055d2 000071cd 000009f2 7ef7
%Key pair was generated at: 0:35:51 UTC Mar 1 1993
Key name: SPIswitch.SPI.server
Temporary key
Usage: Encryption Key
.Key is not exportable
:Key Data
00002282 00003f42 0000654d 000006fd 00000c6a 00000ad8 000038db 0000729d
00007ae5 00007e96 0000265c 00003d2b 00001a47 00007a89 00001e76 00002245
00004f08 00004b5c 00000cf9 00002906 00006425 00002f29 00001a67 6f7b