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.
Written by Ali Hassani, CISSP and C|CISO · 25+ years designing, securing and supporting business networks · Updated November 2026



Secure Network Best Practices Library › Switch configuration and port security › Switch port security
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.
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
| Profile | What connects | Protections |
|---|---|---|
| Desk port | One computer, or a phone with a computer behind it | Staff VLAN and voice VLAN; limit of 1 or 2 addresses; PortFast and BPDU guard |
| Device port | A printer, camera, door controller or similar | Device VLAN; limit of 1 address; PortFast and BPDU guard |
| Access point port | A Wi-Fi access point carrying many devices | Trunk with only the Wi-Fi VLANs; no address limit, because many devices appear behind it |
| Link to another switch | An uplink or downlink | Trunk hardening; no port security. The NSA guide notes port security is not recommended on trunks |
| Unused port | Nothing | Shut 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
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.
Define the profiles
Write down the profiles above with their VLANs and limits. Keep the list short.
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.
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.
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
restrictas the alternative: extra devices are blocked and counted, and the port stays up.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
- For an unused port, set Port status to Disabled and give it a name or tag such as UNUSED.
- For a desk or device port, set Type to Access and open Access policy.
- Choose MAC allow list to list the permitted hardware addresses yourself, or Sticky MAC allow list to let the port learn them up to the limit you set.
- Use port tags to apply the same profile to many ports at once.
! Outline; confirm against the security guide for your switch series interface 1/1/5 description Desk 5 port-access port-security enable port-access port-security client-limit 2 ! ! An unused port interface 1/1/30 description UNUSED vlan access 999 shutdown
- Select the unused ports and disable them in the Port Manager.
- For desk and device ports, assign the right network to the port and block the networks it does not need.
- UniFi offers restriction by hardware address on a port; the menu name has changed between versions, so check the current UniFi help article before relying on it.
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
| Setting | Recommended value | Why |
|---|---|---|
| Port security | On, on every active access port | The device on the port is the one you expect. |
| Address limit | 1, or 2 with a phone | Matches the NSA guidance. |
| Learning | Sticky, then saved | No typing of hardware addresses, and the result survives a restart. |
| Reaction | Shut down; restrict where a shutdown is not acceptable | A clear signal, or a quieter one, but never silence. |
| Unused ports | Shut down, in an unused VLAN, labelled | An empty jack leads nowhere. |
| Trunks and uplinks | No port security | Many addresses are normal there; use trunk hardening instead. |
| Access point ports | No address limit; only the Wi-Fi VLANs allowed | Devices behind the access point appear on the port. |
| Port descriptions | On every port | The 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 security | 802.1X | |
|---|---|---|
| What is checked | The hardware address | An identity: a certificate or an account |
| Can it be copied | Yes, an address can be copied | Much harder |
| What it needs | Only the switch | A RADIUS server and device preparation |
| Best for | Every office, today | Staff 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
! Illustration: unused ports are disabled and in VLAN 999 Port Name Status Vlan Gi1/0/5 Desk 5 connected 10 Gi1/0/22 Printer 2nd floor connected 40 Gi1/0/23 Printer 3rd floor err-disabled 40 Gi1/0/30 UNUSED disabled 999
- Every active access port is listed as secure. On Cisco,
show port-securitylists 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 see | Likely cause | Fix |
|---|---|---|
| A desk port locks when a phone is added | The limit is 1 | Raise the limit to 2 on desks with phones. |
| A port locks after a computer is replaced | The old address is still the learned one | Clear the learned address, then let the port learn the new one. |
| A docking station locks the port | The dock and the laptop show different addresses | Allow 2 addresses, or use the pass-through address setting of the laptop. |
| Protection disappears after a restart | Sticky addresses were not saved | Save the configuration after learning. |
| Spare ports are live again | Someone re-enabled them for a move and did not update the map | Keep them in the unused VLAN; review ports each quarter. |
| Port security on an uplink blocks traffic | It was applied to a trunk | Remove 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.
Next in the library
Related guides
This guide is for education and planning. Test in a maintenance window. IT Perfection is not affiliated with the vendors or agencies named on this page.

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.








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 serviceNetwork troubleshooting
Slow network, drops, Wi-Fi, VPN, DNS and DHCP problems traced and fixed.
View service