All switches in the Layer 2 network participating in STP gather information on other switches in the network through an exchange of data messages called BPDUs. The exchange of BPDUs results in the following actions:
The switch with the highest switch priority (the lowest numerical priority value) is elected as a Root Switch. If all switches are configured with the default priority (32768), the switch with the lowest MAC address becomes the Root Switch. The switch’s priority value occupies the most significant bits of the Bridge ID. The Root Switch is the logical center of the STP topology in a switched network. Redundant paths to the Root are put in STP blocking mode.
BPDUs contain information about the sending switch and its ports, including switch’s and port’s MAC addresses, switch priority, port priority, and path cost. The STP uses this information to elect the Root Switch and the root port for the switched network, and the root port and the designated port for each switched segment.