# Rapid Spanning Tree Emulation versus Actual Network



## jleman (Apr 25, 2019)

I'm comparing network emulation in FreeBSD against performance of an actual in-service network.  The network uses rapid spanning tree protocol to reconfigure if a link fails.  Testing with the actual network shows around 20 milliseconds of down time before the route is adjusted after link failure.  This is tested with a ping utility.  Best times for the emulated network are around 600 milliseconds.  I don't expect the emulated network to be exactly the same, but would have expected it to be closer than this.  I have been unable to find much information about the FreeBSD RSTP implementation.  Can anyone point me in the right direction or shed some light on this?


----------



## SirDice (Apr 25, 2019)

There's some information in bridge(4):

```
SPANNING TREE
     The if_bridge driver implements the Rapid Spanning Tree Protocol (RSTP or
     802.1w) with backwards compatibility with the legacy Spanning Tree
     Protocol (STP).  Spanning Tree is used to detect and remove loops in a
     network topology.

     RSTP provides faster spanning tree convergence than legacy STP, the
     protocol will exchange information with neighbouring switches to quickly
     transition to forwarding without creating loops.

     The code will default to RSTP mode but will downgrade any port connected
     to a legacy STP network so is fully backward compatible.  A bridge can be
     forced to operate in STP mode without rapid state transitions via the
     proto command in ifconfig(8).

     The bridge can log STP port changes to syslog(3) by enabling the
     net.link.bridge.log_stp variable using sysctl(8).
```



jleman said:


> Testing with the actual network shows around 20 milliseconds of down time before the route is adjusted after link failure. This is tested with a ping utility. Best times for the emulated network are around 600 milliseconds


This is often caused by setting a wrong root bridge (or leaving it default). Pick the right device to use as the root bridge and the network will converge much faster. This isn't specific to FreeBSD, it's how (R)STP itself works.


----------

