Port security & Configuration
Port security & Configuration
Port Security
o Port security is a security feature of Cisco switches.
o It allows you to control which source MAC address(es) are
allowed to enter the switchport.
o If an unauthorized source MAC address enters the port, an
action will be taken. The default action is to place the
interface in an ‘err-disabled’ state.
You can specify the maximum number of MAC addresses that can
be learned on a port. The maximum number of MAC addresses is
platform dependent and is given in the software Release Notes.
After the limit is reached, additional MAC addresses are not
learned. Only frames with an allowable source MAC addresses are
forwarded.
You can manually specify a list of static MAC addresses for a port.
Dynamically locked addresses can be converted to statically
locked addresses.
There are three different violation modes that determine what the
switch will do if an unauthorized frame enters an interface
configured with port security.
Switch(config)#interface f 0/1
Switch(config-if)#switchport mode
access Switch(config-if)#switchport
port-security
Switch(config-if)#switchport port-security maximum 2
Switch(config-if)#switchport port-security mac-address
0001.968B.BB67 Switch(config-if)#switchport port-security
mac-address 00D0.BA66.0EE7 Switch(config-if)#switchport
port-security mac-address 000C.CF9A.4CC5
Total secure mac-addresses on interface FastEthernet0/1 has reached
maximum limit.
Verification
3560_A#show port-security address
Secure Mac Address Table
3560_A#
3560_A(config)#int f 0/1
3560_A(config-if)#switchport mode access
3560_A(config-if)#switchport port-security
3560_A(config-if)#switchport port-security
maximum 2
3560_A(config-if)#switchport port-security violation shutdown
3560_A(config-if)#switchport port-security mac sticky
Note: This command converts all dynamic port-security learned MAC addresses to
sticky secure MAC address. This command cannot be used on ports where Voice
VLANs are configured.
Now, All the devices to be allowed (E.g. PC-2, PC-3), will be attached to the
interface 0/1 of Swtich. The MAC- address of these devices will be stored in the
NVRAM.
If any device, (E.g. PC-4 having MAC-address other than the devices which were
attached earlier to fa 0/1 (E.g PC-2 & PC-3) is attached to F 0/1 causes this
interface to go into err-disable mode.
LAB
SW-
B(config)#
SW-B(config-
if)# SW-
B(config-if)#
SW-B(config-
if)# SW-
B(config-if)#
Note: This command converts all dynamic port-security learned MAC addresses to
SW-B#
Secure Mac Address Table
SW-B#
Mac Address
Table
SW-B#
interface FastEthernet0/24
switchport trunk encapsulation
dot1q switchport mode trunk
switchport port-security
switchport port-security maximum 4
switchport port-security mac-
address sticky switchport port-
security violation protect
switchport port-security mac-address sticky
0001.6381.09E2 switchport port-security mac-
address sticky 0090.0C97.85A4 switchport
port-security mac-address sticky
00D0.972A.1727
After That All Tree Current PC can Ping with Router, Add one
new PC
10.0.0.4 PC will not able to ping with Router IP, but can ping
with other PCs. C:\>ping 10.0.0.10
Pinging 10.0.0.10 with 32 bytes
of data: Request timed out.
Request timed
out. Request
timed out.
Request timed
out.
Ping statistics for 10.0.0.10:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
C:\>ping 10.0.0.1
Pinging 10.0.0.1 with 32 bytes of data:
Reply from 10.0.0.1: bytes=32
Software / Network Engineer whatsapp | +923059299396
SAYED HAMZA JILLANI
time=1ms TTL=128 Reply from
10.0.0.1: bytes=32 time<1ms
TTL=128 Reply from 10.0.0.1:
bytes=32 time<1ms TTL=128 Reply
from 10.0.0.1: bytes=32 time<1ms
TTL=128
SW-B#
Port Security : Enabled
Port Status : Secure-up
Violation Mode : Protect
Aging Time : 0 mins
Aging Type :
Absolute SecureStatic
Address Aging : Disabled
Maximum MAC Addresses
4
Total MAC Addresses 4
Configured MAC Addresses 0
Sticky MAC Addresses 3
Last Source Address:Vlan : 0060 7004.8A18:1
Security Violation Count 0
SW-B(config)#
SW-B(config-if)#
SW-B#
After that Add new PC and Try to Ping from new PC.
SW-B#