1

We know that layer2 switch doesn't use Mac address ,uses only certain port number to accept the frame.

But I have been read on book as well as internet that uses Mac address to find spanning tree for different purposes like for break the tie.

For example in the below image to find the root bridge lowest Mac address has been used and Temple switch has won the lowest Mac address.

enter image description here

My question is why Mac address has used for switch to find the spanning tree to avoid the switching loop?

2
  • "We know that layer2 switch doesn't use Mac address ,uses only certain port number to accept the frame." That is not true. Switches have a MAC address table that relates the MAC address to the interface on which the last frame with the source MAC address was seen. The table is used to forward frames to the specific interface for the destination MAC address.
    – Ron Maupin
    Apr 24 at 15:10
  • @RonMaupin that's I am asking, switch has Mac address table correspondence to it's interface but switch has not Mac address and switch not consider as host and it is transparent device on layer2, so switch doesn't need Mac address. But STP switch uses Mac address? Why?
    – Alok Maity
    Apr 24 at 15:15

3 Answers 3

4

Switches that run STP do have MAC addresses because they generate BPDUs. Those frames require a source address.

It may be helpful to understand the difference between control plane and data plane. These are two logical concepts that describe different functions of devices.

When we say a switch transparently forwards frames, we are only talking about the data plane. But when we add other things like STP or LACP, these functions are part of the control plane. There’s also a management plane to describe how you administer the switch.

6
  • Switch's that run STP, it's every interface uses one Mac address? Or every interface has its respective Mac address?
    – Alok Maity
    Apr 24 at 19:39
  • 1
    There is no standard. Cisco has a unique address for each interface
    – Ron Trunk
    Apr 24 at 19:50
  • "Cisco has a unique address for each interface "---- if switch has 3 interface then it uses one Mac address for all?
    – Alok Maity
    Apr 24 at 19:54
  • 1
    No. Three different Mac addresses
    – Ron Trunk
    Apr 24 at 19:55
  • 1
    One mac table. That has nothing to do with spanning tree.
    – Ron Trunk
    Apr 24 at 21:24
1

but switch has not Mac address and switch not consider as host and it it transparent device, so switch doesn't need Mac address.

Switches do have MAC addresses. They have at least one base MAC address, and some vendors will have each interface with its own MAC address based on the base MAC address. The link-only protocols (STP, LLDP, etc.) need a source MAC address, and the have destination multicast MAC addresses that are not forwarded beyond the link on which they are seen.

Remember that ethernet frames require both source and destination MAC addresses in the frame header, so frames for STP need to have those MAC addresses filled in. A switch sending a BPDU for STP will use its MAC address as the source MAC address, and it will use the special destination multicast MAC address for STP as the destination MAC address.

Switches are transparent to the hosts, but they cannot be transparent to each other for the special protocols they use to communicate with each other.

10
  • It should be noted that simple switches (just basic L2 forwarding, no management) don't have a MAC address of their own.
    – Zac67
    Apr 24 at 15:47
  • That depends. Some do, as we discovered when people brought in simple four- or five-port switches and connected them, killing the port on the Cisco switch with BPDU guard enabled. The switches get confiscated because they are not approved for use on our network.
    – Ron Maupin
    Apr 24 at 15:50
  • @RonMaupin """The link-only protocols (STP, LLDP, etc.) need a source MAC address, and the have destination multicast MAC addresses that are not forwarded beyond the link on which they are seen. """----- on my question image the link between switch temple and s3 has correspondence interface multicast Mac addresses but these Mac addresses are not forwarded the link between S2 and S3?
    – Alok Maity
    Apr 24 at 16:12
  • Correct. The IEEE has defined a multicast MAC address range that standards-compliant switches will not forward frames with destination addresses in that range. Frames with destination MAC addresses in that range are consumed by the switch, and they are not forwarded to other interfaces.
    – Ron Maupin
    Apr 24 at 16:16
  • 1
    No, there is only one MAC address for a switch interface. Frames forwarded for hosts have the host MAC addresses because they are transparently forwarded. Only the switch protocols need a switch MAC address.
    – Ron Maupin
    Apr 24 at 16:31
1

We know that layer2 switch doesn't use Mac address ,uses only certain port number to accept the frame.

You seem to be referring to a simple layer-2 switch not using a MAC address itself. It uses MAC addresses from attached nodes all the time to forward frames. A managed switch requires a MAC address of its own.

But I have been read on book as well as internet that uses Mac address to find spanning tree for different purposes like for break the tie.

Each STP bridge needs to use a unique bridge identifier, see IEEE 802.1Q 8.13.8 Unique Identification of a Bridge:

A unique EUI-48 Universally Administered MAC address, termed the Bridge Address, shall be assigned to each Bridge. The Bridge Address may be the individual MAC address of a Bridge Port; in which case, use of the address of the lowest numbered Bridge Port (Port 1) is recommended.

That ID is primarily used to identify which bridge originated a BDPU, so the distributed STP algorithm can work.

The bridge ID is also used to break the tie in case there's more than a single bridge configured with the lowest priority value (=highest root priority). For that, the bridge ID is appended to the priority value and the bridge with the lowest combined value is chosen as root bridge.

You should always purposefully select and configure your root bridge. Leaving the position of the root bridge up to chance is asking for trouble. Some edge switch could randomly own the lowest MAC address in your network and root the spanning tree. Not only would any reboot or other offline case topple over the tree but the data flows would also align along that randomly rooted tree - chances are that your core switches don't talk to each other directly but through some lower-tier switch.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.