Secure Network Best Practices Library · Switch configuration and port security

Switch port security and unused ports guide

Every live switch port is a way into the network. Port security limits which devices a port accepts, and shutting down unused ports removes the doors nobody is watching. This guide covers both: the port profiles to define, the limits to set, the steps on four vendors, and how to recover a port that has locked.

Prefer to have it done for you? IT Perfection provides router, switch and VLAN management for companies in Irvine, Orange County and Los Angeles County.

Ali Hassani, CISSP and Certified CISO, IT PerfectionWritten by Ali Hassani, CISSP and C|CISO · 25+ years designing, securing and supporting business networks · Updated November 2026

Two engineers with laptops in a data center
1 · ReviewWe list every switch port, what is plugged in and which ports are live but unused.

Secure Network Best Practices Library › Switch configuration and port security › Switch port security

What it isPort security is a switch setting that limits how many devices, and which hardware addresses, may use a port. Together with shutting down unused ports it decides whether a stranger with a laptop or a forgotten wall jack can reach the staff network.
Where it livesOn every access switch port: desks, devices and spares
Works onAny managed switch. Steps shown for Cisco, Meraki, Aruba and UniFi
Cost and timeNo licence needed. The work is the port inventory
Risk if missingUncontrolled accessA live, unused wall jack usually hands out an address on the staff network

Why it matters

Close the doors on the switch, not only on the firewall

Most businesses spend their security budget on the firewall at the internet edge, yet the switch ports inside the office are often wide open. A wall jack in a conference room, a port in an empty office or a spare port in the network closet will usually hand out an address on the main staff network to anything that is plugged in.

Three things go wrong with open ports. A visitor or contractor connects a personal laptop and lands beside the file server. A member of staff adds a small switch or a home Wi-Fi router to get more sockets or better signal, and the network now has devices nobody knows about. And when something does go wrong, nobody can say what is connected where, because there is no port map.

Port security does not replace the firewall or the separation between VLANs. It is the layer underneath them: it makes sure the device on a port is the one you expect before any of the other rules apply.

What the reference guidance says

The NSA guide recommends enabling port security on all active switch ports and limiting each port to one hardware address, or two when a phone is in use. It adds that port security is not a replacement for network access control such as 802.1X, but should be used when that cannot be implemented. For unused ports it recommends shutting them down and assigning them to an unused VLAN, after confirming nothing is connected.

Source: NSA, Network Infrastructure Security Guide, sections 9.2 and 9.4. Read Nov 22, 2026.

Port profiles

A few profiles cover almost every port

ProfileWhat connectsProtections
Desk portOne computer, or a phone with a computer behind itStaff VLAN and voice VLAN; limit of 1 or 2 addresses; PortFast and BPDU guard
Device portA printer, camera, door controller or similarDevice VLAN; limit of 1 address; PortFast and BPDU guard
Access point portA Wi-Fi access point carrying many devicesTrunk with only the Wi-Fi VLANs; no address limit, because many devices appear behind it
Link to another switchAn uplink or downlinkTrunk hardening; no port security. The NSA guide notes port security is not recommended on trunks
Unused portNothingShut down; parked in an unused VLAN; description UNUSED

Profiles are what make this manageable. With five of them, a change at a desk is a matter of applying the right profile, and a review is a matter of checking each port has one. Meraki port tags and UniFi port profiles do this in the dashboard; on Cisco and Aruba a short template per profile does the same job.

The other protections a desk port needs have their own guides: spanning tree protection for loops, and DHCP snooping and ARP inspection for home routers and address spoofing.

Before you start

What to have ready

  • A port map. For every switch: port number, wall jack or room, what is connected, and the VLAN. If none exists, building it is the first half of this job.
  • A list of ports that look unused. Check the link history over at least a week, not only today. A powered-off printer or an office used on Fridays looks unused on a Tuesday.
  • Desks with phones. A phone with a computer behind it needs a limit of two addresses, not one.
  • Known exceptions. Docking stations, small switches in meeting tables, virtual machines on a desktop and access points all show more than one address on a port.
  • An agreed reaction. Decide whether a violation shuts the port or only blocks the extra device and logs it, and who gets told.

Step by step

Secure the ports in six steps

  1. Map the ports

    Record what is on every port. Label the ports in the switch itself with a description, so the configuration and the map agree.

  2. Define the profiles

    Write down the profiles above with their VLANs and limits. Keep the list short.

  3. Shut down the unused ports

    Disable each unused port and move it to the unused VLAN, so that even if someone re-enables it the port leads nowhere. This is the step with the most benefit for the least effort.

  4. Apply address limits to desk and device ports

    Turn on port security with a limit of one address, or two with a phone. Let the port learn the address of the device that is connected now, then save the configuration.

  5. Choose the reaction

    Shutting the port is the clearest signal and the NSA guide shows it as the example. Where an interrupted desk is not acceptable, the guide names restrict as the alternative: extra devices are blocked and counted, and the port stays up.

  6. Test and document

    Plug a second device into a protected port and confirm the reaction and the log entry. Update the port map and tell staff how to request a new port.

! A desk port with a phone and a computer
interface GigabitEthernet1/0/5
 description Desk 5
 switchport mode access
 switchport access vlan 10
 switchport voice vlan 20
 switchport port-security
 switchport port-security maximum 2
 switchport port-security violation shutdown
 switchport port-security mac-address sticky
!
! A port for one known device (use maximum 1)
interface GigabitEthernet1/0/22
 description Printer 2nd floor
 switchport mode access
 switchport access vlan 40
 switchport port-security
 switchport port-security maximum 1
 switchport port-security violation shutdown
 switchport port-security mac-address sticky
!
! An unused port: parked and shut down
vlan 999
 name NATIVE-UNUSED
interface range GigabitEthernet1/0/30 - 44
 description UNUSED
 switchport mode access
 switchport access vlan 999
 no switchport voice vlan
 shutdown
!
! Save, or sticky addresses are lost at the next restart
copy running-config startup-config

Example values. Replace names, ports, addresses and VLAN numbers with your own. Commands and menu names change between software versions; confirm them against the current documentation of the vendor before you apply them.

Sticky addresses must be saved. On Cisco, addresses learned with the sticky option live in the running configuration. If the switch restarts before the configuration is saved, they are learned again from whatever is connected at that moment.

Recommended values

The settings at a glance

SettingRecommended valueWhy
Port securityOn, on every active access portThe device on the port is the one you expect.
Address limit1, or 2 with a phoneMatches the NSA guidance.
LearningSticky, then savedNo typing of hardware addresses, and the result survives a restart.
ReactionShut down; restrict where a shutdown is not acceptableA clear signal, or a quieter one, but never silence.
Unused portsShut down, in an unused VLAN, labelledAn empty jack leads nowhere.
Trunks and uplinksNo port securityMany addresses are normal there; use trunk hardening instead.
Access point portsNo address limit; only the Wi-Fi VLANs allowedDevices behind the access point appear on the port.
Port descriptionsOn every portThe configuration is its own port map.

Know the limits

What port security does not do

Port security checks a hardware address, and a hardware address can be copied. Someone who unplugs a printer and sets a laptop to the address of the printer will be accepted. That is why the NSA guide describes port security as the fallback and network access control as the stronger answer.

With 802.1X the switch asks the device, or its user, to prove an identity to a central server before the port opens, and the server can place the device in the right VLAN. It needs more preparation: a RADIUS server, certificates or accounts, and a plan for printers and other devices that cannot sign in. For many small offices the sensible path is port security and unused-port shutdown now, and 802.1X on the staff ports as a later project.

Port security802.1X
What is checkedThe hardware addressAn identity: a certificate or an account
Can it be copiedYes, an address can be copiedMuch harder
What it needsOnly the switchA RADIUS server and device preparation
Best forEvery office, todayStaff ports, once the basics are in place

Check that it works

Confirm the ports are protected

! Illustration
Secure Port  MaxSecureAddr  CurrentAddr  SecurityViolation  Security Action
Gi1/0/5            2             2              0              Shutdown
Gi1/0/22           1             1              0              Shutdown
Gi1/0/23           1             1              1              Shutdown
  • Every active access port is listed as secure. On Cisco, show port-security lists each protected port with its limit and current count.
  • Unused ports are disabled. They show as disabled, in the unused VLAN, with the UNUSED description.
  • The test device was refused. The second device you plugged in triggered the reaction you chose, and there is a log entry.
  • The port map matches. Pick five ports at random and compare the map with the switch.

Mistakes and rollback

Common gaps, and how to undo the change

What you seeLikely causeFix
A desk port locks when a phone is addedThe limit is 1Raise the limit to 2 on desks with phones.
A port locks after a computer is replacedThe old address is still the learned oneClear the learned address, then let the port learn the new one.
A docking station locks the portThe dock and the laptop show different addressesAllow 2 addresses, or use the pass-through address setting of the laptop.
Protection disappears after a restartSticky addresses were not savedSave the configuration after learning.
Spare ports are live againSomeone re-enabled them for a move and did not update the mapKeep them in the unused VLAN; review ports each quarter.
Port security on an uplink blocks trafficIt was applied to a trunkRemove it from links between switches.

Bringing a locked port back on Cisco

Remove the extra device first. Then clear the learned address if the device was replaced, and reset the port.

clear port-security sticky interface GigabitEthernet1/0/23
interface GigabitEthernet1/0/23
 shutdown
 no shutdown

To roll back the whole change on a port, remove the port security lines from that port. The port then accepts any device again, so use this only while you investigate.

Vendor sources read Nov 22, 2026: Cisco Catalyst command references; Meraki MS switch documentation; UniFi Switch Settings.

Have us do it

Prefer to hand this off?

Switch port security is part of our router, switch and VLAN management work. We build the port map, define the profiles, shut down what is unused, apply the limits in a planned window and hand you the map and the saved configurations. You receive a written scope and a written quote before any work starts.

Ali Hassani, CISSP and Certified CISO, IT Perfection

Who does the work

Written by Ali Hassani, CISSP, C|CISO

Ali Hassani has 25+ years of hands-on experience in IT operations, cybersecurity, Microsoft infrastructure, network security and Azure, and works with businesses in Irvine, Orange County and Los Angeles County. Design, implementation and troubleshooting work is planned and reviewed by Ali personally.

This guide is for education and planning. It does not replace a professional audit, compliance assessment or vendor engineering review. Updated November 2026.

ISC2 CISSP badgeEC-Council Certified CISO (C|CISO) badgeCisco CCNP Routing and Switching badgeMCSE: Server Infrastructure badgeMicrosoft MCSE badgeMCSA: Security badgeCisco CCNA Cybersecurity badgeMCITP badge

FAQ

Switch port security: common questions

What is switch port security?

It is a setting on a managed switch that limits how many devices, and which hardware addresses, may use a port. When another device appears, the port shuts down or blocks it, depending on the reaction you chose.

Should unused switch ports be disabled?

Yes. The NSA guide recommends shutting down unused ports and assigning them to an unused VLAN, after confirming that nothing is connected to them.

How many addresses should a port allow?

One for a single device. Two when a phone has a computer connected behind it. Ports for access points and links between switches are not limited this way.

Is port security enough without 802.1X?

It is a real improvement and the right first step, but a hardware address can be copied. 802.1X checks an identity instead and is the stronger control once the basics are in place.

What happens when a port locks?

On Cisco the port goes into an error state and stays down until it is reset or a recovery timer brings it back. Remove the extra device first, or it will lock again.

Can IT Perfection set this up for us?

Yes. It is part of our router, switch and VLAN management service for companies in Irvine, Orange County and Los Angeles County. Call 949-777-5567 or use the contact page to request a quote.

Need this done for your business?

IT Perfection plans, installs and supports this for companies in Irvine and Orange County

The guides explain the steps. If you would rather have it done, planned and documented by an experienced engineer, these are the services that cover it. Design, implementation and troubleshooting work is planned and reviewed by Ali Hassani personally.

Network design and installation

Firewall, switches, VLANs and Wi-Fi planned, installed and documented.

View service

Firewall installation

New or replacement firewalls with clean rules and VPN with MFA.

View service

Network troubleshooting

Slow network, drops, Wi-Fi, VPN, DNS and DHCP problems traced and fixed.

View service