How to Determine Unused Ports on Switch

Reading Time: 3 minutes

Share:

Capacity planning for a network switch infrastructure involves understanding how many switch ports will be required for all of the connected devices on the network. Obtaining this critical piece of information can be difficult because a switch port that is physically connected with a cable may not actually be in use. Conversely, a port that is physically connected with a cable that does not display any indication of activity may not mean that the port is not in use with a device. The connected device may have been powered off at the time the port was checked. A means to check the connection history of a port will reveal the actual number of ports that are in use.

How to Check a Port’s Connection History

A simple Cisco switch command can help inform the capacity planning process. The process is to determine active switch ports starts with determining how far back in time you want to check for port activity. A common value to ensure that intermittently used ports are accounted for is four weeks. Additionally, you may want to include certain ports, such as those that are administratively disabled or those that are currently not connected. It is important to note that the history of activity on the switch is directly affected by how long it has been running as the activity counter statistics will be reset when the switch is rebooted.

The basic command line syntax starts with the “show interface” command and uses regular expressions to look for specific matches in the output. The regular expressions are case-sensitive and must match the “show interface” command output. A general summary can be obtained with the following command:

switch#show interface | include proto|Last in

The output will look similar to the following:

Vlan1 is up, line protocol is up
Last input 00:00:00, output 00:00:00, output hang never
10 unknown protocol drops
FastEthernet0 is administratively down, line protocol is down
Last input never, output never, output hang never
0 unknown protocol drops
GigabitEthernet1/0/1 is up, line protocol is up (connected)
Last input never, output 00:00:07, output hang never
0 unknown protocol drops
TenGigabitEthernet2/0/1 is down, line protocol is down (notconnect)
Last input never, output never, output hang never
0 unknown protocol drops
TenGigabitEthernet2/0/2 is down, line protocol is down (notconnect)
Last input never, output never, output hang never
0 unknown protocol drops
Port-channel2 is up, line protocol is up (connected)
Last input never, output 00:00:00, output hang never
0 unknown protocol drops

The results can be refined by modifying the regular expressions terms used in the command to only display information deemed relevant to the required discovery activity. For example, If we only wanted to show information for the disconnected ports that have not been active for the last four weeks or more, the syntax would look similar to this:

sh int | i proto.*notconnect|proto.*administratively down|Last in.* [4-9]w|Last in.*[0-9][0-9]w|[0-9]y|Last input never, output never, output hang never

GigabitEthernet1/0/2 is down, line protocol is down (notconnect)
Last input 26w3d, output 26w3d, output hang never
GigabitEthernet1/0/3 is down, line protocol is down (notconnect)
Last input 22w1d, output 22w1d, output hang never
GigabitEthernet1/0/4 is down, line protocol is down (notconnect)
Last input never, output never, output hang never
GigabitEthernet1/0/5 is down, line protocol is down (notconnect)
Last input never, output never, output hang never

This publication contains general information only and Sikich is not, by means of this publication, rendering accounting, business, financial, investment, legal, tax, or any other professional advice or services. This publication is not a substitute for such professional advice or services, nor should you use it as a basis for any decision, action or omission that may affect you or your business. Before making any decision, taking any action or omitting an action that may affect you or your business, you should consult a qualified professional advisor. In addition, this publication may contain certain content generated by an artificial intelligence (AI) language model. You acknowledge that Sikich shall not be responsible for any loss sustained by you or any person who relies on this publication.

SIGN-UP FOR INSIGHTS

Join 14,000+ business executives and decision makers

Upcoming Events

Upcoming Events

Latest Insights

About The Author