Friday, June 6, 2014

Find unused ports on a Cisco Switch

Have you ever had a switch that had every port connected to a cable and you needed to add one more? Are any of those ports unused even though they are connected? I bet so! But how do you know which ones??

Some of you may have nice utilities to help monitor your network and that may help you with this sort of situation. I’ve seen and used a few myself that help tell you just that. However, for those that don’t have such a tool at their disposal or if you’re just looking for an alternative method this is a neat combination of commands I came across that can come in very handy.

What I’m doing is creating an alias (free_ports) and you can name it anything you want. This will let me run the command easier and quicker next time. It will output a list of interfaces along with a listing of when the port was last active. So maybe it’s not full proof but it gives you a pretty good idea of where you might have a free port. If it last saw activity 2 years ago, odds are you are probably safe in thinking that port is now free.

alias exec free_ports show int | i proto.*notconnect|proto.*administratively down|Last in.* [8-9]w|Last in.*[0-9][0-9]w|[0-9]y|disabled|Last input never, output never, output hang never

Switch#free_ports

Of course you don’t have to create an alias and can always just run the base command itself:

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

This has been a very helpful trick for me a times and I hope it is for you as well!

No comments:

Post a Comment