In this topology, I have 2 switches which are configured to run PVST not Rapid PVST+
but simply PVST I'll show you that config in a moment.
Router 1 is connected to switch 1
and router 2 is connected to switch 2
and the routers are simply acting as edge devices or PCs in this topology.
I’ve also got a hub connected to switch 1 and switch 2.
Here’s switch 1, sh run | include span
as you can see at the moment the switches configured for PVST
I'll explain extended system IDs in more detail later
but essentially it means that the priority of the switches
based on the priority and VLAN number.
So as an example, sh Spanning Tree
this switch has a bridge ID consisting of the priority 32769
which is the default of 32768+ the extended system ID of 1
because we're looking at VLAN 1 and MAC address of the following.
this switch is currently the root
What I want you to see is that the Spanning Tree enabled here is IEEE
so in this output, it looks like you're running 802.1D
but actually, the switch is configured for Per-VLAN Spanning Tree.
Per-VLAN Spanning Tree is compatible with 802.1D switches
and therefore we can see IEEE in the output here.
Here switch 2 sh run | include span
switches configured to use PVST, extended system IDs are being used
on this switch, the brIDge ID consist of the priority 32769
which is 32768 the default + the VLAN number which is VLAN 1 in this example
this is the MAC address of the switch.
So we have 2 switches, one has this MAC address
one has this MAC address, switch 1 has become the root of the Spanning Tree
because it has a lower MAC address when compared to this switch.
So because of the lower MAC address
notice AC is lower than EA in hexadecimal
switch 1 became the root of the Spanning Tree.
What you’ll also notice is that on switch 1
all ports are forwarding in the topology
the ports that are currently connected are those ports
and they're all forwarding on switch 2, however, port 1
which is gigabit 0/0 is the root port
and it's forwarding has path cost of 4, gigabit 0/1 is blocking
or discarding to use the industry standard term.
Port 2 is forwarding, port 3 is blocking.
So this port is also blocking.
Root switches forward on all ports.
Before I show you how port status were determined
let’s have a look at the BPDUs
So I'll start capture on that link
and what we can see here in Wireshark is a Spanning Tree BPDU.
So it’s using 802.3 Ethernet frames
notice the destination address is the well-known MAC address for Spanning Tree
it is a multicast/broadcast address from this MAC address.
Here’s switch 1
notice the MAC address of the switch 00:11:c6:ac:dd:
and we're currently looking at port 3 on the switch
so notice dd00 but this is dd03
because in Spanning Tree that’s the port that we're currently looking at.
if we went and look at port 2 as an example
notice the MAC address ends in 02
we’ve got port 00 01 02 and 03
so back in Wireshark here’s our capture sent out of port 3
in Spanning Tree we can see the spanning 3 version
so this is Spanning Tree 0
because in this port its actually using 802.1D
or the original version of Spanning Tree.
The root identifier is 32768, there’s the VLAN number
and there’s the MAC address of the switch, which we can see clearly here
so notice root identifier, there’s the information of 32768 VLAN 1
there is the MAC address of the switch.
The root path cost is 0 because this switch is the root
so there’s no cost to get to the root.
There’s the port identifier and here are some timers used in Spanning Tree.
Now when a switch boots up all ports are put into a blocking state
they're then moved to other states based on timers in 802.1D
When the Spanning Tree switch boots up all ports are put into the blocking state
after 20 seconds called the max age timer ports moved
to what’s called the listening state.
if a switch is already up and you connect your cable to the port
in other words, the links goes up
it starts at the listening state
ports will then move to the learning state
based on the forward delay which is 15 seconds in duration
and after 15 seconds ports transition from the learning state to the forwarding state.
So an 802.1D or PVST it can take 50 seconds
for ports to start forwarding on switches
because they move from blocking to listening to learning to forwarding.
Now in the listening state, they are sending BPDUs
but not updating their MAC address tables.
in the learning state, BPDUs are sent
and the MAC address tables of switches are updated.
So only if based on the Spanning Tree calculation
it’s determined that a port can be opened
a port is set to the forwarding state after 50 secs.
when the switch comes up or typically if the switch is already up
and you plug in a cable into that switch after 30 secs.
The port will start forwarding.
So in the BPDU we can see the max age timer
and the forwarding delay timer.
this is determined by the root bridge
so on switch 1 which is the root bridge
we can see that the hello timer
in other words, BPDU hellos are sent out every 2 seconds
the max age time is 20 seconds
and the forwarding delay timer is 15 seconds
and that’s what we see in the BPDUs as captured in our topology.