cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
27762
Views
15
Helpful
6
Replies
Highlighted

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

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Collaborator

If you are good at regular

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

6 REPLIES 6
Highlighted
Collaborator

If you are good at regular

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

Highlighted
Zig Beginner
Beginner

Re: If you are good at regular

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...

Highlighted
Hall of Fame Expert

Re: If you are good at regular

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

 

 

Highlighted
Zig Beginner
Beginner

Re: If you are good at regular

Great, exactly what I needed, thanks...

Highlighted

Oh that's cool! I did not

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

Highlighted
Collaborator

That's great. Glad it helped

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

CreatePlease to create content
Content for Community-Ad