1
0
Fork 0
mirror of https://gitlab.com/netravnen/NetworkLabNotes.git synced 2024-11-23 19:17:54 +00:00
NetworkLabNotes/chapter/section/spanningtree.tex

415 lines
21 KiB
TeX
Raw Normal View History

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SECTION BEGIN spanning tree protocol %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Spanning Tree}
Spanning Tree exists for the \textbf{sole} reason to save "your" network and all the broadcast storms an network engineer having a bad day can by mistake create!
STP comes from the above desire where redundancy was wanted but no protocol existed before STP to help in this regard.
\begin{table}[h]
\centering
\caption{Spanning Tree standrds}
\label{stpstandards}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{|l|l|l|l|l|}
\hline
\textbf{} & \textbf{Standard} & \textbf{Ressource Usage} & \multicolumn{2}{l|}{\textbf{Convergence}} \\ \hline
CST & 802.1D & Low & Slow & All vlans \\ \hline
PVST+ & Cisco & High & Slow & Per vlan \\ \hline
RSTP & 802.1w & So-so (Med.) & Fast & All vlans \\ \hline
RPVST+ & Cisco & On-the-double (V.High) & Fast & Per vlan \\ \hline
MST & 802.1s & Med. - High & Fast & Vlan list \\ \hline
\end{tabular}%
}
\end{table}
\subsection{Port Roles}
When a switch is enabled for Spanning Tree. One of the following roles will have been assumed by any port on the switch in question.
\begin{itemize}
\item \textbf{Root port:} Only 1 port on any switch (non-counting the root bridge!). Is always the port with the lowest metric (aka. best path) to the root bridge.
\begin{itemize}
\item The upstream/-link port closest to the root bridge on all switches apart from the root bridge.
\end{itemize}
\item \textbf{Designated port:} A designated port is the port on any segment closest to the root bridge and forwarding traffic.
\begin{itemize}
\item The port on any switch in downstream direction closet to the root bridge.
\end{itemize}
\item \textbf{\textit{Non}-designated port:} Put in blocking mode and not currently forwarding traffic.
\begin{itemize}
\item All switch ports which did not get elected as the root or designated port.
\end{itemize}
\item \textbf{Disabled port:} The port has been one-way-or-another shut down.
\end{itemize}
\subsubsection{specific port roles}
\begin{itemize}
\item \textbf{Alternative port} is an active port in network with an alternative path to the root bridge. A port in alternative mode will remain active but \textit{discards} all traffic until the the current designated path fails.
\item \textbf{Backup port} is running in active mode and \textit{discards} all traffic it recieves until the current designated port on the segment the backup port is connected to, fails.
\end{itemize}
Election of ports goes in order of the following values (low is best): 1) root bridge id, 2) lowest path cost to root bridge, 3) sender bridge id, 4) sender port bridge id
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SECTION BEGIN standards %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Standards}
\begin{itemize}
\item STP {\scriptsize Spanning Tree Protocol}
\begin{itemize}
\item IEEE 802.1D
\item Was created in a time where bridged networks was the norm.
\item Supports a single vlan/lan.
\end{itemize}
\item CST {\scriptsize Common Spanning Tree}
\begin{itemize}
\item An evolution of stp
\item Cst still only supports one STP instance.
\item But CST do thou in contrast to STP support \textit{multiple} vlans.
\end{itemize}
\item PVST {\scriptsize Per Vlan Spanning Tree}
\begin{itemize}
\item Now obsolute and succeded by PVST+
\end{itemize}
\item PVST+ {\scriptsize Per Vlan Spanning Tree Plus}
\begin{itemize}
\item Runs an instance of STP per vlan.
\item Can guarante better utilization of available network bandwidth.
\item Root bridge and port priorities can be configured per vlan.
\item Uses the term alternate for nondesignated port.
\end{itemize}
\item RSTP {\scriptsize Rapid Spanning Tree Protocol}
\begin{itemize}
\item IEEE 802.1w
\item A future development of the original 802.1D standard meant to provide faster convergance. As the original STP standard wasn't actually that fast.
\end{itemize}
\item RPVST+ {\scriptsize Rapid Per Vlan Spanning Tree Plus}
\begin{itemize}
\item A cisco implementation of RSTP based upon pvst+.
\end{itemize}
\item MST {\scriptsize Multiple Spanning Tree}
\begin{itemize}
\item Originally a cisco developed protocol. MST has since been developed as an IEEE standard.
\item MST can as CST map multiple vlans to a single STP instance.
\item MST \textit{differently} than CST supports multiple STP instances.
\item Fx. Instance 1: Vlan 1-99, Instane 2: Vlan 100-199.
\end{itemize}
\end{itemize}
\subsection{Features}
\subsubsection{BPDU}
\textbf{B}ridge \textbf{P}rotocol \textbf{D}ata \textbf{U}nits is on cisco equipment sent out every 2 seconds and generally catogorizes into 2 categories:
\begin{itemize}
\item \textit{Configuration} BPDU used for STP calculations and
\item \textit{Topology change notifications} BPDUs used to notify other network nodes of a change in the network.
\end{itemize}
Any network node with switchports and STP + BPDU enabled sends out BPDU packets with the ports mac as the src address. The destination mac is is designated STP multicast addr 01:80:C2:00:00:00.
\subsubsection{Root Bridge}
Using a \textbf{R}oot \textbf{B}rigde as the reference point for the STP instance and calculation of root/designated/non-designated ports.\\This election process uses a pre-configured bridge priority (ranges from $0$ to $2^{16}$) (defaults to $2^{15}$). If a tie in priority is found the switch in possession of the lowest mac address wins the root bridge election.
2017-05-31 16:36:13 +00:00
\begin{txt}
|<-------- bridge id 8 bytes --->|
+----------+---------------------+
| Bridge | MAC |
| priority | Address |
+----------+---------------------+
|< 2 byte >|<----- 6 bytes ----->|
\end{txt}
\subsubsection{Port Cost}
\begin{table}[h]
\centering
\caption{Default port cost in spanning tree}
\label{stpportcost}{!}{%
\begin{tabular}{|l|l|}
\hline
\textbf{Link} & \textbf{Default Cost} \\ \hline
10 Gbps & 1 \\ \hline
1 Gbps & 4 \\ \hline
100 Mbps & 19 \\ \hline
10 Mbps & 100 \\ \hline
\end{tabular}%
}
\end{table}
\fig{spanningtree/portroles}{stpportroles}{Port Election}
\textit{\textbf{NB:} beware that when working with bundled links (aka. ether-/port-channel). Then the link cost will be calculated based upon the summarized bandwidth accross all links.}
\fig{spanningtree/portstates}{stpportstates}{Port States}
\section{Rapid Spanning Tree Protocol}
\fig{rstp/portroles}{rstpportroles}{Port Roles}
\fig{rstp/portlinktypes}{rstpportlinktypes}{Port link types}
Things to be aware of regarding RSTP port roles
\begin{itemize}
\item \textbf{Shared} port state will only ever be present on segments where a hub is present.
\item \textbf{Point-2-Point} port is connected to a single switch on the other end.
\item \textbf{Edge} port roles is only ever connected to end devices. Status as Edge port is lost if a BPDU is ever recieved.
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% SECTION BEGIN port roles %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Port roles}
\subsection{Fast port roles}
Cisco did on their part early on enhance the original spanning tree standard with some proprietary portroles that can (on cisco switch equipment) skip steps in the port role election process. And configure a STP switchport to a specific behavior as described below:
\begin{itemize}
\item PortFast
\begin{itemize}
\item Configures access port to transition directly to forwarding state.
\item Improve convergence times of non-RSTP.
\item Port does no forwan TCN\footnote{\textbf{Needs finding out what TCN is.}} BPDUs either.
\item PortFast can be enabled either A) per port \textit{or} B) globally for all ports in access mode.
\begin{enumerate}
\item Per port: {\footnotesize Accesss port}\\\cliline{cisco-switch(config-if)# spanning-tree portfast}
\item Per port: {\footnotesize Trunk port}\\\cliline{cisco-switch(config-if)# spanning-tree portfast trunk}
\item Globally:\\\cliline{cisco-switch(config)# spanning-tree portfast default}
\end{enumerate}
\end{itemize}
\item UplinkFast
\begin{itemize}
\item Enables fast uplink failover on access switch.
\item Improve convergence times of non-RSTP.
\item Enabled only with non-RSTP
\item Integrated into Cisco's RSTP implementaion and enabled by defaut.
\item Cisco proprietary
\item Only works if switch has blocked ports
\item Designed with switches in access layer as deployment target.
\item Enabled for the entire switch. Cannot be enabled pr. vlan.
\item \cliline{cisco-switch(config)# spanning-tree uplinkfast} enables the feature.
\end{itemize}
\item BackboneFast
\begin{itemize}
\item Enables fast convergence in distribution or core layer when STP change occurs.
\item Improve convergence times of non-RSTP.
\item Enabled only with non-RSTP
2017-05-25 23:38:04 +00:00
\item Integrated into Cisco's RSTP implementaion and enabled by default.
\item Disabled by default
\item \cliline{cisco-switch(config)# spanning-tree backbonefast} enables the feature.
\item \textit{Scenario:} If switch needs searching new path root bridge. BackboneFast shortens process.
\begin{enumerate}
\item Switch will search for alternative path to root.
\item If BPDU recieved on blocked port. Port considered alternative path path to root.
\item If alternate path identified. RQL{\footnotesize \textbf{R}equest \textbf{L}ink \textbf{B}locking} packets are out for identify either A) an alternative path to the root bridge \textit{or} B) an up-/downstream switch with a path to the root bridge.
\end{enumerate}
\end{itemize}
\end{itemize}
\subsection{Loop Prevention}
\begin{itemize}
\item BPDU Guard
\begin{itemize}
2017-05-25 23:38:04 +00:00
\item Disables the PortFast-enabled port if a BPDU is received. The port goes into mode \texttt{err-disable}.
\item Enable per port:\\\cliline{cisco-switch(config-if)# spanning-tree bpduguard enable}
\item Enable globally for portfast enabled ports:\\\cliline{cisco-switch(config)# spanning-tree portfast bpduguard default}
\end{itemize}
\item BPDU Filter
\begin{itemize}
\item Suppresses BPDUs on ports
2017-05-25 23:38:04 +00:00
\item Behaves differently depending if enabled
\item A) globally \textit{or}
\begin{enumerate}
\item Affects all active portfast enabled ports, which \underline{don't} have a BPDU port configuration.
\item If BPDU recieved on port, portfast and BPDU filter is disabled.
\item Sends \textbf{10} BPDUs on startup. If BPDU recieved in this timeframe \textit{same consequence as above} happens to the port.
\item \cliline{cisco-switch(config-if)# spanning-tree bpdufilter enable}
2017-05-25 23:38:04 +00:00
\end{enumerate}
\item B) per-port:
\begin{enumerate}
\item Port ignores all recieved BPDUs.
\item Port sends no BPDUs.
\item \cliline{cisco-switch(config-if)# spanning-tree bpdufilter enable}
2017-05-25 23:38:04 +00:00
\end{enumerate}
\item Beware to \underline{only} enable BPDU filter on ports connected to end hosts. Consequence if not followed \underline{can} result in creating bridging loops.
\item Beware to \underline{only enable either} BPDU guard \textbf{\textit{or}} filter. \footnote{Cisco recommendation}
\end{itemize}
\item Root Guard
\begin{itemize}
\item \st{Prevents external switches from becoming roots}
\item If enabled, prevents any ports from becoming a root-port. Ports will remain as designated ports \textit{effectivily} preventing the switch becoming the root bridge.
\item This, too, behaves in s similiar manner as BPDU guard, putting the port in \texttt{err-disable} mode when a BPDU packet is recieved on the port.
\item Enabled per-port with\\\cliline{cisco-switch(config-if)# spanning-tree guard root}
\end{itemize}
\item Loop Guard
\begin{itemize}
\item Prevents an alternate port from becoming the designated port if no BPDUs are received
\begin{enumerate}
\item Normally when cisco swicthes stop recieving BPDUs ingress in a port. The port will go to listeting, learning, forwarding state equaling a loop.
\item With Loop guard enabled the will go to \texttt{loop-inconsistent} blocking state instead.
\end{enumerate}
\item Enabled per-port\\\cliline{cisco-switch(config-if)# spanning-tree guard loop}
\item Enabled globally\\\cliline{cisco-switch(config)# spanning-tree loopguard default} {\small only on p2p links}
\item Works on per-vlan basis when PVSTP is used.
2017-05-28 18:50:23 +00:00
\item On ether-channel links with uni-directional link failures, loop guard will put put the whole ether-channel into loop-inconsistent state.
\end{itemize}
\item \textbf{Beware} root and loop guard is mutually exclusive
\begin{itemize}
\item Root guard works on designated ports and does not allow the ports to become \textit{non}-designated ports, where
\item Loop guard works on \textit{non}-designated ports and does not allow the ports to become designated ports {\footnotesize though expiration of times}.
\end{itemize}
\end{itemize}
\subsection{Link}
\begin{itemize}
\item Unidirectional Link Detection (UDLD)
\begin{itemize}
\item Cisco proprietary feature.
\item By default only enables on fiber optic links.
\item Works by sending packes every 15 seconds (default timer). If not packet is recieved back, the port can either log (default) a messaage or actively try to re-establish the link (aggresive). 1 packet/second for 8 sec. is send. If non is returned the port will go to \texttt{err-disable} state.
\item \cliline{cisco-switch(config)\# udld \{enable | aggresive\}}
2017-05-28 18:50:23 +00:00
\item On ether-channel links with uni-directional link failures, udld will disable individual failed links.
\item For the best protection. Aggresive mode is recommended.
\item It is recommended to turn on udld in global conf mode.
\end{itemize}
\item FlexLinks
\begin{itemize}
\item Cisco proprietary feature.
\item An alternate solution to running STP in the environment.
\begin{itemize}
\item STP is auto-disabled on interfaces running FlexLinks.
\item Configured with 2 physical links with and active/backup configuration.
\item Enables convergence time of less than 50 milliseconds.
\end{itemize}
\item FlexLinks is good alternative to running STP in an environment with customers who you do \textit{not} want to run STP with. Fx. Service Provider/Enterprise/Datacenter environment.
\item Preemtion for FlexLinks is \textit{not} enabled-by-default.
\begin{enumerate}
\item Detects link failure.
\item Moves any dynamic unicast MAC addresses learned on primary link to standby link.
\item Moves standby link to forwarding state.
\item Transmits dummy multicast packets over new active interface. {\small Dummy multicast packet format is as follows: \textbf{destination:} 01:00:0c:cd:cd:cd, \textbf{source:} MAC address of the hosts or ports on the newly active FlexLinks port}
\end{enumerate}
\item {\small \textbf{Note:}} Configuring FlexLinks outside of access layer switches can be very complex!
\item Enabled FlexLinks on an interface: \\
\cliline{cisco-switch(config)# interface fa0/1} \\
\cliline{cisco-switch(config-if)# switchport backup interface fa0/2}
\item \textbf{What} FlexLinks can be:
\begin{enumerate}
\item A physical port
\item A Bundled link {\footnotesize (aka. ether-channel)}
\item 1 FlexLink per physical/logical port
\item Link speeds need not be the same
\end{enumerate}
\end{itemize}
\end{itemize}
2017-05-28 18:50:23 +00:00
\begin{table}[h]
\centering
\caption{UDLD|Loopguard compared}
\label{udldloopguard}
\resizebox{\columnwidth}{!}{%
2017-05-28 18:50:23 +00:00
\begin{tabular}{|l|l|l|}
\hline
\thead{Functionality} & \thead{Loop guard} & \thead{UDLD} \\ \hline
2017-05-28 18:50:23 +00:00
Action granularity & Per vlan & Per port \\ \hline
\makecell{Protection against STP\\failures caused by uni-directional\\ links} & \makecell{Yes, when enabled on all\\potential non-designated ports\\in redundant topology} & \makecell{Yes, when enabled on all\\links in redundant topology} \\ \hline
\makecell{Protection against STP\\failures caused by problem in\\software resulting in designated\\switch not sending BPDUs} & Yes & No \\ \hline
2017-05-28 18:50:23 +00:00
Protection against mis-wiring & No & Yes \\ \hline
\end{tabular}%
}
\end{table}
\fig{spanningtree/stpbestpractice}{stpbestpractice}{STP best practice}
\section{Multiple Spanning Tree}
\begin{itemize}
\item \itemtitle{Known limitations}{Regarding the cisco world of things}
\begin{enumerate}
\item A maximum of 16 instances is supported. {\footnotesize From 0 to 15.}
\end{enumerate}
\item \textbf{Beware} that instance 0 is the \textit{I}nternal \textit{S}panning \textit{T}ree. And therefore cannot be configured for user-mapped Vlans.
\item Aggregates the configured vlans into groups/instances/processes. This in turn provides lower resource utilization on switches. \dWinkey
\item Backwards compatible with 802.1D STP/802.1w/RSTP and Cisco PVST+.
\item Converges faster than PVRST+.
\item \itemtitle{Challenges}{Arises because of older hardware and the architecture of the protocol}
\begin{enumerate}
\item Operability with older/legacy hardware/equipment is not always possible.
\item \textit{Of course} it is more complex compared to standard STP (older) protocols. {\footnotesize Staff may require teachings of the way of the protocol.}
\end{enumerate}
\end{itemize}
\begin{table}[h]
\centering
\caption{MST Attributes}
\label{mstattr}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{|l|l|}
\hline
\thead{Data} & \thead{What ?} \\ \hline
32 bytes & alphanumeric configuration name \\ \hline
2 bytes & configuration revision number \\ \hline
Table of 4096 elements & \makecell{associates each of the potential\\4096 VLANs with an instance} \\ \hline
\end{tabular}%
}
\end{table}
\subsection{MST Regions}
It is the network admins job to propagate an even configuration to all switches in a single region by using CLI or SNMP. Currently IOS does not support any other options to do the job.
\begin{itemize}
\item \itemtitle{Boundaries}{MST differs between regions by}
\begin{enumerate}
\item sending a digest computer from the Vlan-to-instance mapping table of the switch sending the digest.
\item the characteristics of the MST protocol for that single switch.
\end{enumerate}
\item if computed digest and MST characteristics between switches is \textit{found matching}, the switches considers themselves part of the same MST region.
\item \textbf{Beware} that unlike VTP, MST does not automatically increase the configuration revision number. This \textit{has to be done} manually.
\end{itemize}
\fig{spanningtree/mstregions}{mstregions}{MST Regions all Vlans running mappen to the default instance 0.}
\fig{spanningtree/mstregions2}{mstregions2}{MST Regions vlans mapped to different instances.}
\pagebreak % avoids column break for the following text
\begin{txt}
|<-------- bridge id ----------->|
+----------+-----------+---------+
| Bridge | Extended | MAC |
| priority | system ID | Address |
+----------+-----------+---------+
/\
||
MST inst. no. carried in
Ext. Syst. ID Area
\end{txt}
\subsection{Common Troubleshooting}
\begin{itemize}
\item Duplex mismatch: Mismatch half/full duplex.
\item Unidirectional link failure
\item Frame corruption: Physical interfaces can be defective/with errors.
\item Resource errors: High compute usage in the Control Plane. {\scriptsize Remember the Spanning Tree Process in fx. Cisco Catalyst switches is handled in software.}
\item PortFast configuration error: Can lead to bridging loops when mis-wiring happens together with logical port configuration errors.
\end{itemize}