Skip to main content

What is Port Security?

Port Security is a network security mechanism on switches that controls which devices can connect to a specific physical port.

In simple terms: Port Security decides which devices are "allowed" on each switch port.


Why Port Security is needed

Without Port Security:

  • any device can be connected to a free port;
  • an attacker can gain access to the internal network;
  • attacks from the local network become possible.

Port Security allows you to:

  • limit the number of devices on a port;
  • allow connections only from known MAC addresses;
  • prevent unauthorized access.

How Port Security works

The switch checks the MAC addresses of devices connecting to a port and applies rules:

  • if the MAC address is allowed, access is granted;
  • if it is not allowed, the port is blocked or the traffic is dropped.

It is usually used at the access layer.


Main features of Port Security

1. Limiting the number of MAC addresses

For example:

  • only 1 device can be connected to a port;
  • if a second one appears, protection is triggered.

2. Recording allowed MAC addresses

MAC addresses can be:

  • static (set manually);
  • dynamic (learned automatically);
  • sticky (learned and saved).

Sticky MAC is the most popular option.


3. Reaction to a violation (violation mode)

If the rules are violated, the port can:

  • Protect, which simply blocks the traffic;
  • Restrict, which blocks it and logs the event;
  • Shutdown, which fully disables the port (the strictest option).

Which attacks Port Security prevents

  • connecting someone else's laptop to the network;
  • MAC flooding;
  • unauthorized access to the local network.

This is protection at the data link layer (L2).


Limitations of Port Security

It is important to understand:

  • a MAC address can be spoofed;
  • it does not protect against attacks above L2;
  • it requires administration.

That is why Port Security is part of a multi-layered defense, not the only security measure.


A simple example

Port Security is like:

an outlet with an access list: power is supplied only to the devices that are on the list.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.