The root switch is elected purely on the BID (Bridge ID) which is a combination of the bridge priority and the mac-address of the bridge.
The default bridge priority is 32768. So if 3 switches form your network and they all have the default bridge priority of 32768 then the switch with the lowest mac-address will be elected root bridge. If one of the switches has a lower priority than 32768 then that switch will be elected root.
The port priority and port cost are used in deciding the path to the root bridge once the root bridge has been elected.
Totally agree with Jon, and just to add a small thing about the port cost and priority, when manipulating the spanning tree root port selection, we will either alter the local port cost using spanning-tree cost on the local switch (since the total route path cost is derived from the received BPDU after adding the local port's cost) or the upstream port priority using spanning-tree port-priority on the upstream switch (since the priority received in the BPDU from the upstream is used in the root port selection), and please note that the root path cost is compared before the upstream port priority.
The root bridge is elected based on the bridge priority (2 byte priority + MAC address of the switch). You may confuse it how the root and designated port selected, because the port cost, priority come to play there.
You are very welcomed :) and i am really glade that we have helped you out through this, but i find it very strange from your side to rate Jon and me with 3 and 2 since you are that excited with the answers :)
[toc:faq]The ProblemOn traditional switches whenever we have a trunk
interface we use the VLAN tag to demultiplex the VLANs. The switch needs
to determine which MAC Address table to look in for a forwarding
decision. To do this we require the switch to do...
[toc:faq]Introduction:Netdr is a tool available on a RSP720, Sup720 or
Sup32 that allows one to capture packets on the RP or SP inband. The
netdr command can be used to capture both Tx and Rx packets in the
software switching path. This is not a substitut...
IntroductionOSPF, being a link-state protocol, allows for every router
in the network to know of every link and OSPF speaker in the entire
network. From this picture each router independently runs the Shortest
Path First (SPF) algorithm to determine the b...