Files
firestuff/2006-03-16-spanning-tree-protocol-introduction.html

55 lines
3.0 KiB
HTML
Raw Normal View History

2019-04-21 17:52:18 +00:00
<!--# set var="title" value="Spanning Tree Protocol Introduction" -->
2019-04-25 02:45:09 +00:00
<!--# set var="date" value="2006-03-16" -->
2019-04-21 17:52:18 +00:00
<!--# include file="include/top.html" -->
<p>Ive been considering increased network redundancy for awhile. After trying a few more things live than I should have, I decided to set up some gear in the lab and do some testing. First up is spanning tree.</p>
<p>STP is, simply, an ethernet-level protocol for disabling redundant links until theyre needed to avoid loops (which effectively kill ethernet networks). It works by electing a root “bridge” (meaning switch in this case). Every other bridge checks to see if it has more than one link to the root; if it does, it puts every link but one in blocking state. This lets you build neat redundant networks:</p>
<p><img src="data:image/webp;base64,<!--# include file="images/stp.webp.base64" -->" alt=""></p>
2019-04-21 17:52:18 +00:00
<p>(<strong>A</strong>, <strong>B</strong> and <strong>C</strong> are switches; <strong>1</strong> and <strong>2</strong> are servers)</p>
<p>I just plugged the above arrangement in (three Catalyst 2950s) and it worked. STP is enabled on Cisco switches by default.</p>
<p>A little closer examination showed more details. On <strong>B</strong>:</p>
<pre><code>#show spanning-tree
….
This bridge is the root
….
Fa0/2 Desg FWD
Fa0/3 Desg FWD
</code></pre>
<p><strong>B</strong> is the root, and both links out of it are “desg” — designated links to those switch segments and “FWD” — forwarding packets.</p>
<p>On <strong>A</strong>:</p>
<pre><code>#show spanning-tree
….
Fa0/1 Desg FWD
Fa0/2 Root FWD
</code></pre>
<p>This is the first oddity: Fa0/1 links to <strong>C</strong>, and should be blocking. However, apparently only one end of each link blocks. The switch knows that Fa0/2 is a link to the root bridge.</p>
<p>On <strong>C</strong>:</p>
<pre><code>#show spanning-tree
….
Fa0/1 Altn BLK
Fa0/3 Root FWD
</code></pre>
<p>This switch has realized that theres a loop, and blocked the port that provides the longest route to the root bridge, as expected.</p>
<p>Now, I start a ping of <strong>2</strong> from <strong>1</strong>. Then I unplug the link between <strong>A</strong> and <strong>B</strong> that is currently carrying the traffic. The ping stops. 49 seconds later, it starts again. The Fa0/1 interface on <strong>C</strong> went from BLK to LIS to LRN to FWD.</p>
<p>Now, I plug the link back in. The ping stops again. Fa0/1 on <strong>C</strong> sees the loop immediately and goes to BLK. The restored interface on <strong>B</strong> goes to LIS, then LRN, and finally FWD. The ping resumes in 31 seconds.</p>
<p>Spanning tree isnt particularly fast, and it doesnt really “route”. Ethernet packets often traverse less-than-optimal paths through the switch fabric since STP doesnt care where they came from or where theyre going; it only shuts down interfaces that might loop. Nevertheless, its simple and effective at building switch redundancy.</p>
<!--# include file="include/bottom.html" -->