Layer 2 Network Security Features
Layer 2 of the OSI model (Data Link Layer) is often overlooked in security, but it is susceptible to various attacks. Cisco switches offer several features to mitigate these Layer 2 threats.
We will talk about Port Security, DHCP Snooping and Dynamic Arp Inspection
Port Security
Port security limits the number of valid MAC addresses allowed on a port. It can be configured to allow only specific MAC addresses or to dynamically learn them. If the number of MAC addresses exceeds the configured limit, the port can be shut down, restricted, or protected.Switch(config-if)# switchport mode access
Switch(config-if)# switchport port-security
Switch(config-if)# switchport port-security maximum 1
Switch(config-if)# switchport port-security mac-address sticky
Switch(config-if)# switchport port-security violation shutdown
- switchport port-security: Enables port security on the interface.
- switchport port-security maximum 1: Allows only one MAC address.
- switchport port-security mac-address sticky: Dynamically learns and saves the MAC address.
- switchport port-security violation shutdown: Shuts down the port on violation.
DHCP Snooping
- ip dhcp snooping: Enables DHCP snooping globally.
- ip dhcp snooping vlan 10: Enables DHCP snooping for a specific VLAN.
- ip dhcp snooping trust: Configures the interface connected to the DHCP server as trusted.
- ip dhcp snooping limit rate 5: Limits the rate of DHCP messages on an untrusted port.
Dynamic ARP Inspection (DAI)
- ip arp inspection vlan 10: Enables DAI for a specific VLAN.
- ip arp inspection trust: Configures the interface connected to trusted devices (e.g., router, legitimate DHCP server) as trusted.