How to Determine Unused Ports on Switch

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

By |2018-10-01T08:55:47+00:00October 1st, 2018|Technology, Tips & Tricks|0 Comments

About the Author:

John Branch
John has over 30 years of experience working with technology. His career began in the US Navy where he contributed to several communities including Naval Aviation, Naval Special Warfare, and Naval Cryptography. Upon transitioning to the private sector, he delivered technical training on foundational networking technologies including switching and routing as a Certified Cisco Systems Instructor (CSSI). For over 15 years, John has been working as a network consultant assisting clients in achieving their business objectives through technology and trusted advice. John’s operational expertise includes complex network design and implementation (routing, switching, wireless, and security) with Cisco, Meraki, Juniper, and HPE Aruba networking equipment. John has considerable experience with server virtualization using Microsoft Hyper-V and Azure. He also has actively worked in cybersecurity developing assessment and testing methodologies for his clients. He holds several certifications from industry leaders including Cisco, Microsoft, Citrix, and SonicWall.
This material has been prepared for general informational purposes only and is not intended to be relied upon as accounting, tax, or other professional advice. Please refer to your advisors for specific advice.

Privacy Information

We use cookies to personalize the website for you and to analyze the use of our website. Click 'Privacy Options' to configure how we can interact with you and your device or computer.

Privacy policy | Close
Settings
private equity services construction accountants Agriculture Services Construction Services Non-Profit Services Government Services