cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
13094
Views
0
Helpful
8
Replies

Can you show mac address-table sorted by interfaces?

trickylalit
Level 1
Level 1

Could I Display like int gi 1/0/1, 1/0/2......

On Similar lines you can exclude  specific interface when you run the command. Say I want to see all mac addresses in order of interface and exclude the trunk interface.

Thank you

8 Replies 8

chrihussey
VIP Alumni
VIP Alumni

I don't think there is a way to have the output display in the order of interface, but if you wan to see the mac address table on a switch and exclude the uplink trunk port you can use the pipe with the proper interface modifier. 

So if you had a 4500 switch with G1/5 being the uplink and you wanted to omit that from the output it would be:

sh mac address-table | exclude GigabitEthernet1/5

If you had two uplinks one being G1/3 and 1/5 then it would be:

sh mac address-table | exclude GigabitEthernet1/[3,5]

There's a ton of ways of doing regular expressions, but this should give you an idea.

Hope this helps.

Hello Chris,

I tried but no luck

sh mac address-table | exclude GigabitEthernet 1/0/[47,48,49]

Thanks,

Try "sh mac address-table | exclude GigabitEthernet 1/0/[47-49]", if that doesn't work let me know the platform you are trying it on and if I have it available I'll try it out.

Ooops, should have been "sh mac address-table | exclude GigabitEthernet 1/0/[4][7-9]"

Hello Hussey,

Thank you for the pointing to right direction. You had a space after GigabitEthernet and after removing the space it worked. Thank you for the help.


sh mac address-table | exclude Gi1/0/47|1/0/48|1/0/49
sh mac address-table | exclude Gi1/0/[4][7-9]

If you can edit your answer, I will mark it correct

Hello,

I think you would need a TCL script and concatenate the output of different show commands, since you need the MAC addresses and the interfaces configured as trunks, and both won't show up in the same command output.

I'll see if I can get a script to work...

Hello Gpauwen,

It is not something mission critical, I was just hoping if there was easier way like SQL query using regex. So please don't spend extra time on this. I also don't have experience running TCL script against IOS.

Thanks,

serge123
Level 1
Level 1

Here how you can do it

If you would want to exclude interface Gi1/1/1-4

sh mac address-table | exclude Gi1/1/1|Gi1/1/2|Gi1/1/3|Gi1/1/4

Review Cisco Networking for a $25 gift card