STP Cost, Port States and Timers
Each port's default STP cost depends on its speed: 19 for 100 Mbps and 4 for 1 Gbps in the older values. In a stable network the root sends a Hello every 2 seconds. When a root port fails, the switch picks a new one, at once or after MaxAge, and the port then spends 15 seconds in listening and 15 in learning before it forwards.
By Arif, founder of Daveth · Updated
The full 13 min walkthrough is in Daveth Pro (Network). See what the plan opens
What this page answers
How does spanning tree calculate path cost?
Each port has a default cost that depends on its speed, such as 19 for 100 Mbps and 4 for 1 Gbps in the older values. A switch's root cost is the total of the port costs along its path to the root. Read it in “Default port costs”
What are the STP timers?
Hello, 2 seconds between the root's Hellos; MaxAge, 20 seconds, how long a switch waits after it stops hearing Hellos before changing the tree; and forward delay, 15 seconds in listening and again in learning. Read it in “The timers”
What are the spanning tree port states?
Blocking and forwarding for a stable port, and listening and learning, 15 seconds each by default, for a port moving to forwarding. A blocking port sends and receives no user frames. Read it in “The timers”
Choosing a port, then letting it forward
Monday, 9 a.m. The cleaners unplug the meeting-room cable, SW2's Gi0/1 to SW3's Gi0/1, to move a table. That cable is SW3's root port. The laptops in the meeting room lose the rest of the office. About half a minute later, they're back, over Sam's cable.
"So the spare worked," Maya says. "But it had a spare. Why half a minute?"
Two separate things happen when a root port fails. SW3 chooses a new root port: at once, or after a wait, depending on how the old one failed. Then that port has to be allowed to carry user frames, and in the original STP that takes time on purpose. Everything on this page is the original STP; a faster version, which reacts to changes differently, is the next topic.
A new driver has been picked. The keys still aren't handed over mid-turn.
Default port costs
STP works with no configuration at all: every setting has a useful default. 03.3.2 showed how an engineer changes the priority or a port's cost to steer the tree. Here is where the default costs, like the 4 and 19 the office uses, come from: each port's default STP cost depends on its speed.
| Speed | Older values (1998 and before) | Newer values (2004 and after) |
|---|---|---|
| 10 Mbps | 100 | 2,000,000 |
| 100 Mbps | 19 | 200,000 |
| 1 Gbps | 4 | 20,000 |
| 10 Gbps | 2 | 2,000 |
| 100 Gbps | N/A | 200 |
| 1 Tbps | N/A | 20 |
These switches have long used the older column by default; the newer column suits links faster than 10 Gbps, and one global command on each switch makes it the default instead. The older values are the ones to memorise: 100 for 10 Mbps, 19 for 100 Mbps, 4 for 1 Gbps and 2 for 10 Gbps.
The default follows the speed the port is running at, not the fastest it could run. SW3's Gi0/2 is a gigabit port, but Sam's cable ends on LAB-SW1's FastEthernet port, so the link runs at 100 Mbps, and Gi0/2's cost is 19, not 4. Costs are per port and per VLAN, and a cost an engineer has configured on a port replaces the default, so when you work out root costs, check for one before assuming.
It's basically like a delivery van's arrival time: it's worked out from the speed the van is doing on this road, not the top speed on its brochure. (Where it stops: a van's speed changes minute by minute. A port's speed, and so its default cost, only changes when the link comes up at a different speed.)
Gi0/2's CV says gigabit. Today it came in at 100 Mbps, and STP goes by today's shift.
While nothing changes
Once the tree is chosen, STP keeps it alive with Hellos. In a stable network the same three steps repeat:
- The root creates a Hello, with root cost 0, and sends it out all its working ports, the ones forwarding. By default it does this every 2 seconds.
- Each nonroot switch receives it on its root port, puts in its own bridge ID as the sender and its own root cost, and sends it on out all its designated ports. The root bridge ID stays the same.
- Steps 1 and 2 repeat until something changes.
So each Hello crosses every working link once. In the office, that's LAB-SW1 sending out Gi0/1 and Fa0/24, and SW2 passing it on out Gi0/1 to SW3. SW3 hears it on both its ports: from SW2 on Gi0/1, its root port, and from LAB-SW1 on Gi0/2. Gi0/2 blocks, but a blocking port still receives Hellos.
The office before 9 a.m.: the Hellos every 2 seconds

- Every 2 seconds, by default, LAB-SW1 sends a Hello out Gi0/1 and Fa0/24. SW2 passes it on out its designated port, Gi0/1. So SW3 hears Hellos on both its ports, and each working link carries one Hello each time.
- Gi0/1 is SW3's root port (root cost 8), forwarding. Gi0/2, Sam's cable, is neither root port nor designated. It blocks, but it still receives Hellos.
- Gi0/2 is blocking: it doesn't forward user frames, and it doesn't learn MAC addresses from frames arriving on it.
Each switch counts on those regular Hellos to know its path to the root still works. If they stop, or a Hello arrives with different details, something has failed, and the switch starts changing the tree.
You can think of it as the root calling out "still here" every two seconds, down the tree. (Where it stops: a person who goes quiet might just be busy. For a switch, silence past a set limit means the path is gone.)
The timers
Three timers control how STP reacts. Every switch uses the root's values, which the root lists in its Hellos, so there's one set of timers for the whole tree.
| Timer | Default | What it's for |
|---|---|---|
| Hello | 2 seconds | The time between Hellos created by the root. |
| MaxAge | 10 times Hello (20 seconds) | How long a switch waits, after it stops hearing Hellos, before it tries to change the tree. |
| Forward delay | 15 seconds | How long a port spends in listening, and then again in learning, on its way from blocking to forwarding. |
Miss one Hello, and a switch carries on as normal. If no Hello arrives for MaxAge, 20 seconds by default (10 times the 2-second Hello), it reacts. Then it makes all its choices again, from the Hellos it's still getting: which switch is root, which port is its root port, and whether it's designated on each of its other links.
It works kind of like waiting for a bus that's due every two minutes: miss one and you wait; after twenty minutes with nothing, you find another way. (Where it stops: you might give up early or late. A switch waits exactly MaxAge, unless the port itself goes down, which tells it at once.)
One missing Hello is a hiccup. Ten in a row is a pattern.
Converging after a failure
Now the cleaners. How long SW3 waits before it chooses again depends on how the Hellos stop.
If the root port's interface fails, the switch knows at once that no more Hellos will come in there, so it doesn't wait for MaxAge. That's the pulled cable. If the link stays up but, for some reason, the Hellos stop arriving, it has nothing but silence to go on, so it waits MaxAge first.
Either way, SW3's choices come out the same:
- The root: still LAB-SW1. It still has the lowest bridge ID; that's why it was root in the first place.
- The root port: Gi0/2 is now the only port hearing Hellos, so it becomes the root port, whatever its cost: 0 + 19 = 19.
- Designated ports: SW3's ports to the meeting-room laptops stay designated. No other switch is on those links.
Only SW3 reacts. SW2 still hears its Hellos on Gi0/2, the hallway, so it has nothing to change. And SW3's Gi0/1, with its cable pulled, isn't working any more: STP puts a failed port in the disabled state.
A dark port tells SW3 straight away. A lit port that has gone quiet makes it wait for proof.
Continue the lesson
The whole lesson, with its drawings and its questions. 2 more sections after the ones above.


