cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
85073
Views
20
Helpful
7
Replies

show mac address-table interface <interface range>

Does anyone know of a way to dump all connected mac addresses connected to every port on a Cisco switch(3850s)?

What would be ideal would be something like the 'show mac address-table interface' command, but for an interface range rather than a specific interface:

This is the type of output I'm looking for, with each mac address listed for the port in question:
switchxxx#show mac address-table interface g3/0/11
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
xx2 28f1.xxxx.xxxx DYNAMIC Gi3/0/11
xx2 e089.xxxx.xxxx DYNAMIC Gi3/0/11
xx3 e089.xxxx.xxxx DYNAMIC Gi3/0/11
Total Mac Addresses for this criterion: 3
switchxxx#


I'm thinking I could script it, but curious if there's an easier way.

Thanks,
Jon

1 Accepted Solution

Accepted Solutions

chrihussey
VIP Alumni
VIP Alumni

If you are good at regular expression you probably could figure something out. I'm not, but played with it a bit and if you use the pipe and designate the proper output modifiers you can get some range functionality:

Provides the output for ports G1/0/10 thru 19:

sh mac address-table | include Gi1/0/([1][0-9])

Provides the outputs for G1/0/20 thru 39:

sh mac address-table | include Gi1/0/([2-3][0-9])

Hope this helpful.

View solution in original post

7 Replies 7

chrihussey
VIP Alumni
VIP Alumni

If you are good at regular expression you probably could figure something out. I'm not, but played with it a bit and if you use the pipe and designate the proper output modifiers you can get some range functionality:

Provides the output for ports G1/0/10 thru 19:

sh mac address-table | include Gi1/0/([1][0-9])

Provides the outputs for G1/0/20 thru 39:

sh mac address-table | include Gi1/0/([2-3][0-9])

Hope this helpful.

I would like to find the correct syntax for all ports on switch 1-48...Tried several different ways but always seem to start at 1/0/10...Please help...

Hello Zig,

for first 9 ports you need a modified version

sh mac address-table | include Gi1/0/([1][0-9])

 

becomes

sh mac address-table | include Gi1/0/([1-9])

 

Hope to help

Giuseppe

 

 

Great, exactly what I needed, thanks...


@Giuseppe Larosa wrote:

Hello Zig,

for first 9 ports you need a modified version

sh mac address-table | include Gi1/0/([1][0-9])

 

becomes

sh mac address-table | include Gi1/0/([1-9])

 

Hope to help

Giuseppe

 

When I run this specific command exactly as you have typed it Giuseppe, I get the MAC associated with every port in the stack.  

The switches I am running this on are chassis, so if the supervisory module is included then I get every MAC the switch can see!

On the chassis here the supervisory modules are blades 3 and 4; so if I alter your command to this:

sh mac address-table | inc ([1-2])/0/[(1-9]) and then run the same command but with ([5-9)]/0/([1-9]), I get everything I need.

 

Thank you very much for the information!


 

Oh that's cool! I did not know you could do that.
Very helpful, thanks!

That's great. Glad it helped and thanks for the rating.

Review Cisco Networking for a $25 gift card