12-28-2024 06:14 AM - edited 12-28-2024 06:16 AM
SW1---------SW2-----------SW3----------SW4-----------SW5
Got multiple C2690's trunked together in daisy chain design, as we all know when you try to see mac address table in one switch it will show you all the mac addresses in the chain, wonder if there is filter that can show only the mac's for the switch you connecting to.
Thank you all.
12-28-2024 06:19 AM
Try use show mac address | exclude <trunk> between SW
MHM
12-28-2024 06:46 AM
Ah, @MHM Cisco World got his reply in while I was still composing mine, but he shows the basic syntax of what I too was suggesting.
However, where he shows "<trunk>", using RegEx, you can provide multiple interfaces, which don't actually have to be trunk interfaces too.
BTW, what OP desires can be difficult to determine because at the MAC level, the switch only knows it has seen it ingress on a port, but that doesn't indicate whether it's directly connected or not. Consider a trunk to a VM host, one physical device but possibly multiple MACs. I.e. even with all possible information available on the switch, a 100% correct result might not be possible.
Consider, if only one host was on-line, connected to SW5, how could SW1 guarantee it can "know" it's not directly connected to SW1?
12-28-2024 06:24 AM
At the moment, not at any hardware or emulator to experiment with, but off the top of my head, use a piped show excluding trunk interface(s). That's not 100% foolproof as access ports may have switches, hubs, APs, etc. connected to them.
12-28-2024 10:18 AM
@MaxJ Unfortunately, there's no direct filter to show only the MAC addresses specific to the directly connected switch in a daisy chain setup. The MAC address table will always show all learned MACs across the network. However, you can use the show mac address-table interface [interface-id] command to narrow it down to MACs learned on a specific interface, which can help isolate the connected switch's MACs.
12-29-2024 02:27 AM
Two ways. One is to exclude the trunk port. Another one is to only include the physical ports (try to match all possible with some common keyword if you have combination of 100M, 10G, 25G, etc).
sh mac add | i GigabitEthernet
sh mac add | i Ethernet
In excluding trunk, use a design consideration to use port-channel interface always for trunks, even if it's single ports. In such way, we may expand it in future if required and also it will be useful for such cases.
show mac address-table | exclude Port-channel
12-29-2024 04:13 AM
Commenting on two suggestions. . .
Hopefully, his first example of the two command lines is not intended to use both but either.
Again, as I believe both include and exclude use RegEx, you don't necessarily need to match on a common keyword, but that's fine too (especially if weak in using RegEx, although it's worth learning).
His second suggestion has merit, as it would be unusual to use port-channel for non infrastructure links (although some server hosts might use it). Do know, network devices often have a limit in the number of port-channel interfaces they support, some with a rather low limit, but probably not too likely you'll bump into that.
BTW, I believe OP was hoping for a nice option that switch would reveal the distinction, but how you might determine what port you want to exclude (or include) might be determined using CDP/LLDP info, MAC table showing multiple MACs on a port, or possibly Cisco's L2 traceroute. I believe some management tools will pull MAC tables from multiple network devices, and can use that to identify edge port for any MAC.
12-29-2024 04:35 AM
Another Design consideration, incase we have port-channel interface for non-switch links like servers or something else, dedicate some range of Port-channel groups for switch to switch links, example from 10 to 19 or 101 to 199 for uplinks, so that it will be easy for someone to understand Port-channel 1x or 1xx will be always switch to switch links.
If we follow or implement this, then the below command will help to filter and look for the local mac address only.
show mac address-table | exclude Port-channel1
12-29-2024 05:22 AM
Believe you would also need, using your port-channeling scheme, to set aside pc1. With a RegEx expression, you could match on a single digit, I believe, which would support your scheme.
12-29-2024 05:28 AM - edited 12-29-2024 05:29 AM
Yes, we can use RegEx when required.
For example, Po11, Po12 are uplinks and Po13 and Po14 are server links. We have to exclude only Po11 and Po12. In that case, we can use RegEx something as below.
show mac address-table | exclude Port-channel1[12]
Another example, Po11, Po22 are uplinks and Po12 and Po21 are server links. We have to exclude only Po11 and Po22. In that case, we can use RegEx something as below.
show mac address-table | exclude Port-channel11|Port-channel22
12-29-2024 06:00 AM
That's fine, but in your prior reply, wouldn't your
show mac address-table | exclude Port-channel1
Exclude Port-channel 1x or 1xx or 1?
Your intent was 1..9 for switch links, correct?
12-29-2024 07:50 AM
Not 1..9. In that case we should exclude Port-channel[1-9]
show mac address-table | exclude Port-channel1 will exclude Port-channel 1x and 1xx and 1
12-29-2024 08:41 AM
Hmm, believe you're still missing the issue.
You wrote:
". . . dedicate some range of Port-channel groups for switch to switch links, example from 10 to 19 or 101 to 199 for uplinks, so that it will be easy for someone to understand Port-channel 1x or 1xx will be always switch to switch links."
And wrote:
"show mac address-table | exclude Port-channel1"
So is Port-channel1 to be excluded as a switch<>switch link?
I.e. you're excluding 1x and 1xx, which is fine, but you didn't specify whether you wanted to exclude just 1, which is what your example also does. This is fine if that's what you intend, but your reply might be taken as you only wanted to exclude 1x and 1xx, not the single digit of 1. Likewise you would also exclude 1xxx.
12-29-2024 08:46 AM
"show mac address-table | exclude Port-channel1"
I actually meant it will match any line which match the keyword "Port-channel1" which includes Port-channel1, Port-channel1x, Port-channel1xx, Port-channel1xxx, and anything *Port-channel1*
12-29-2024 09:23 AM
@Devaa wrote:
"show mac address-table | exclude Port-channel1"
I actually meant it will match any line which match the keyword "Port-channel1" which includes Port-channel1, Port-channel1x, Port-channel1xx, Port-channel1xxx, and anything *Port-channel1*
Okay, that's fine. Again, the way your original reply, on this, was written, it might have been misinterpreted you only meant to exclude two digit or three digit port-channel numbers that began with 1.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide