Spanning tree protocol (STP) principle and configuration of PVST + to realize load balance
Yang Shufan focus on zero people comment on 4396 people read the 2017-08-17 21:46:13
The exchange of network loop produce
In actual network environment, the physical loop can improve the reliability of the network, when a line break, another line can still transfer data, however, when the switch receives the broadcast request, the switch is according to the principle of forwarding (switches from besides receives the broadcast frame all port forwarding broadcast frames), forming a loop, the broadcast frame will be more and more, eventually forming the broadcast storm, lead to network paralysis, the broadcast storm only disappears in a physical loop might stop,
WKiom1mVi1nDAahoAAC_caLaJ7s784. PNG
But a ring of physical line can provide backup for the network line, enhance the reliability of the network, this is necessary in the network design, therefore, this needs a kind of solution, on the one hand, to guarantee the reliability of the network, on the other hand to prevent the formation of the broadcast storm,
STP protocol is used to solve this problem, the STP agreement is not breaking the physical loop, but logically disconnect loop, prevent the formation of the broadcast storm,
STP profile
STP (Spanning Tree Protocol, Spanning Tree Protocol) is a circular structure change into a Tree structure, the STP Protocol is used for the physical existence of loop network, through an algorithm, in the logical block on ports, to generate a logical Tree structure, failure occurs when the circuitry, blocked line is reactivated, make the data transmitted from the line is normal,
Spanning tree algorithm
Spanning Tree protocol running the Spanning Tree Algorithm (Spanning Tree Algorithm, the STA), Spanning Tree Algorithm is complex, but the process can be summarized as the following three steps:
Step 1: choose the Root Bridge (Root Bridge)
Step 2: select the Root port (Root Ports)
Step 3: choose the specified port (Designated Ports)
As a forerunner of Bridges, switches, because the STP is developed on the basis of the bridge, so still in use now switches in the network bridge a term, used in Cisco tutorial referred to as a "bridge", this means the "switch",
1. Select the root bridge (in a ring network, can appear multiple root bridge (have more than one VLAN, or when doing load balancing), default only one)
Choose the basis of a root bridge is a bridge ID, bridge ID is an 8 bytes of field, the first two bytes of decimal is called bridge priority, after two bytes is the bridge of MAC address,
The bridge priority is used to measure the bridge priority of decimal number in the spanning tree algorithm, the range of 0-65535, the default value is 32768.
Bridge ID in its own MAC address, MAC address is switches can use the command show the version in the version information view the switch its own MAC address,
* algorithm according to the raw art number definition, when comparing a STP parameters of two values, the value of small high priority, therefore, when choosing the root bridge, the comparison method is to behold switch bridge ID value of the minimum, the small priority is selected as the root bridge, under the condition of the same priority, MAC address smaller as the root bridge,
2. Select the root port (choose one) on each non-root Bridges
After the root bridge is chosen, the network of each switch and root bridge require some links, so the STP will start the process of selecting the root port, the root port exists in non-root Bridges, need to select a root ports on each of the bridge,
Choose root port basis according to the order is as follows:
(1) to the root bridge with the lowest cost of root
(2) direct bridge ID minimum
(3) minimum port ID (directly connected to the bridge port ID the smallest port of the port)
Root path cost are the two Bridges between all lines on the path to the sum of the cost, which is a bridge to reach the root bridge the sum of all lines in the middle of the path cost,
The size of the path cost is used to represent a route bandwidth, the greater the bandwidth of a route, it also the lower the cost of data transmission,
WKioL1mVnOWRepzJAAB - yi3HN - A607. PNG
WKiom1mVnOaBzXiOAAB260zSVP8073. PNG
Port ID is a 2 bytes of STP parameters, by a byte (eight bits) port priority and a byte (eight bits) port number,
Port is a configurable STP priority parameters, based on the IOS switches on, port priority decimal value range is 0 to 255, the default value is 128,
Port number is the Catalyst for listing each port number identifier, switch, based on the IOS can support 256 ports, port number is not a port number, low port but port, the port number value is smaller,
* select the root in the STP port, first compare the root path cost of switch port, the root path cost is low for the root port, when the root path cost the same time, more connected to the switch bridge ID value, choose the bridge as the root port ID value is small; When the bridge ID is the same, more port ID value, choose smaller as the root port,
Note: in compare the port ID value, the comparison is received on the port ID value,
3. Select the specified port (choose one) on each link in
Select the root root per switch and bridge ports, a tree structure has been formed, however, all the lines are still together, and may be active, finally lead to form a loop,
In order to eliminate the loop formation, STP for final calculations, in each choose a specified port on a network segment, choose the specified port on the basis of the same as the root port, in sequence has the following three:
(1) the root path cost low
(2) the switch bridge ID value smaller
(3) the smaller values of the port ID
* in STP, when selecting a specified port first compared to the same network segment of top mouth root path cost minimum, is will arrive at the port of the root bridge recently as the specified port; When the root path cost the same time, compare the port of switch bridge ID value, choose a small switch port bridge ID value as a specified port; When the bridge ID is the same, that is to say, there are a few located on the same switch port, port ID value, choose smaller as the specified port,
Note: and root port you choose, compare the port ID value, compare the port ID value,
Spanning tree algorithm validation
On the switch using the command view spanning tree
Switch# show spanning tree
-
Bridge protocol data units (bpdus)
Switches between through BPDU (Bridge Protocol Data Unit, Bridge Protocol Data Unit) to exchange Bridge ID, root path cost information, such as switches from the port to send out a BPDU frame, use the MAC address of the port itself as a source address, the switch itself does not know whether there are other around it switches exist, therefore, BPDU frames using a STP multicast address (01-80 - c2-00-00-00) as one of its destination address, adjacent to arrive, and in the STP listening state switches,
Every two seconds, then send all of the switch port BPDU packets at a time, in order to switch (or bridge) to exchange the latest topology information, and quickly identify and detect the loop,
1. Two types of bpdus
(1) the configuration bpdus, used to generate the tree,
(2) the Topology Change notice (the Topology Change Notification, TCN) bpdus, used to notice the Change of network Topology,
2. BPDU message field
BPDU contained in the root bridge ID, the root path cost, send the bridge, port ID and timer, etc., the following is explained, the role of bpdus in a few key fields
: (1) the root bridge ID consists of a two bytes priority and a six byte bridge of MAC address, the information shows that have been designated as the root bridge equipment identification,
(2) the root path cost: show how far the bpdus transmitted from the root bridge and how much is the cost, the value of this field determines which port will be forwarded, which ports will be blocked,
(3) send the bridge ID: this is the bridge sends bpdus in information, the bridge of the MAC address, the priority and Bridges
(4) the port ID: composed by one byte port priority and a port number,
(5) the timer, timer is applied to generate the tree how long can finish it each function, these functions include message aging time, the largest aging time, access time and forward delay,
3. The STP USES the process of selecting the root bridge bpdus
The choice of the root bridge is a continuous, iterative process, it does not trigger a two seconds, check whether the bpdus root bridge ID is changed, if there is a bridge bridge ID value lower switch,
STP convergence
1. The state of the spanning tree port
Spanning tree protocol in a switch to run automatically, you can see, when switch on the light on the switch is shown as * * *, and about 30 s time cannot forwarding data, then switches the STP is doing calculation, until completion of the switches of STP calculation, some ports can be forwarding data, some port is blocked, after the network convergence, switch to forwarding data, and, when the network topology changes, switches and rerun the STP, form a new logical topology,
In the process of STP operation, switch of each port must in turn through several states, as shown:
Kla093 wKioL1mVkW3DO97SAACGPc - 1. PNG
2. Spanning tree timer
STP on the switch when sending BPDU packets to each other, trying to form a loop free topology, BPDU passes from a switch to a switch, total want to spend a certain amount of time, in addition, when the topology changes, such as lines or root bridge fault messages sent from one side of the network to the other side, to experience some of the propagation delay, due to the delay, so you need to set enough time for the switch to complete bpdus forward and spanning tree arithmetic, the conventionality, inside the switch to setting up the timer to control the length of each phase,
STP using three methods of timing to determine the convergence of a network correctly, now describes STP timer and their default values are as follows:
* Hello time: the time interval between bridge configuration bpdus sent message, the default set of ieee802.1q standard access time for two seconds,
* forwarding delay: a switch port in Listening (listen) and Learning (Learning) state the amount of time interval, its default value is 15 s,
* biggest aging time: switch loss in bpdus message store before its maximum time,
Listening and learning are adopted by the spanning tree transition state, used to force the port waiting for from all other switches in the bpdus, typical port transition is as follows:
A. from blocking to listen (20 s)
B. from listening to learn (15 s)
C. from learning to listen (15 s)
When enable STP, VLAN on each switch after power up are from to block to listen, to learn the transition state,
STP timer can use the command configuration and adjust, however, if not carefully thinking and planning, suggest don't change the default value of the timer,
STP relations with VLAN
VLAN and the relationship between the spanning tree mainly has the following kinds:
1. IEEE CST (Common Spanning Tree, general Spanning Tree)
2. Cisco PVST (Per VLAN Spanning Tree, each VLAN Spanning Tree)
3. Cisco PVST + (Per VLAN Spanning Tree Plus, enhance each VLAN Spanning Tree)
4. IEEE MST (Multiple Spanning Tree, Multiple Spanning Tree)
CST does not consider the VLAN, run STP for the unit with the switch (the exchange network to generate a STP instances), switches divide VLAN won't produce radio the loop, but because of CST does not consider the VLAN, so after the STP calculation will block one of the ports,
PVST is a Cisco proprietary protocol, PVST for each virtual local area network running separate instances of spanning tree (each VLAN to generate a STP instances),
PVST for each VLAN run independent of a spanning tree as an example, to optimize the location of the root bridge, provide the optimal path for all vlans (because the topology of the VLAN varies),
PVST, however, is not perfect, the main shortcomings are as follows:
1. In order to maintain for each VLAN and generated spanning tree, the utilization rate of the switch (such as CPU load) will be higher,
2. To support each VLAN bpdus, takes up more bandwidth, Trunk lines
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull