Open In App

Port Security in Computer Network

Attackers’ task is comparatively very easy when they can enter the network they want to attack. Ethernet LANs are very much vulnerable to attack as the switch ports are open to use by default. Various attacks such as Dos attack at layer 2, address spoofing can take place. If the administrator has control over the network then obviously the network is safe. To take total control over the switch ports, the user can use a feature called port-security. If somehow prevent an unauthorized user to use these ports, then the security will increase up to a great extent at layer 2. 

Users can secure a port in two steps: 



  1. Limiting the number of MAC addresses to a single switch port, i.e if more than the limit, Mac addresses are learned from a single port then appropriate action will be taken.
  2. If unauthorized access is observed, the traffic should be discarded by using any of the options, or more appropriately, the user should generate a log message so that unauthorized access can be easily observed.

Port security – 
Switches learn MAC addresses when the frame is forwarded through a switch port. By using port security, users can limit the number of MAC addresses that can be learned to a port, set static MAC addresses, and set penalties for that port if it is used by an unauthorized user. Users can either use restrict, shut down or protect port-security commands. 

Let’s discuss these violation modes: 



Note – The port security will work on access port only i.e to enable port security, the user first has to make it an access port. 

Configuration – 
Applying port-security on fa0/1 interface of switch .first, convert the port to an access port and will enable port-security. 

S1(config)#int fa0/1
S1(config-if)#switchport mode access
S1(config-if)#switchport port-security

Use sticky command so that it will learn the Mac address dynamically and will provide the limit and the appropriate action that should be taken.  

S1(config-if)#switchport port-security mac-address sticky
S1(config-if)#switchport port-security
maximum 2
S1(config-if)#switchport port-security violation shutdown

If the user wants to provide a static entry, then configure that by starting its Mac address.  

S1(config-if)#switchport port-security 
S1(config-if)#switchport port-security violation shutdown
S1(config-if)#switchport port-security mac-address aa.bb.cc.dd.ee.ff

 

Article Tags :