STP uses a distributed algorithm that selects one bridge of a redundantly connected network as the root of a spanning tree-connected active topology. STP assigns roles to each port depending on what the port's function is in the active topology. Port roles are as follows:
•Root—A forwarding port that is elected for the spanning-tree topology
•Designated—A forwarding port that is elected for every switched LAN segment
•Alternate—A blocked port providing an alternate path to the root port in the spanning tree
•Backup—A blocked port in a loopback configuration
The switches that have ports with these assigned roles are called the root or designated switches.
In Ethernet networks, only one active path may exist between any two stations. Multiple active paths between stations can cause loops in the network. When loops occur, some switches recognize the stations on both sides of the switch. This situation causes the forwarding algorithm to malfunction allowing the duplicate frames to be forwarded.
The spanning-tree algorithms provide path redundancy by defining a tree that spans all of the switches in an extended network and then forces certain redundant data paths into a standby (blocked) state. At regular intervals, the switches in the network send and receive spanning-tree packets that they use to identify the path. If one network segment becomes unreachable, or if the spanning-tree costs change, the spanning-tree algorithm reconfigures the spanning-tree topology and reestablishes the link by activating the standby path.
The spanning-tree operation is transparent to end stations, which do not detect whether they are connected to a single LAN segment or a switched LAN of multiple segments.
Understanding How a Topology is Created
All switches in an extended LAN participating in a spanning tree gather information about other switches in the network through an exchange of data messages that are known as bridge protocol data units (BPDUs). This exchange of messages results in the following actions:
•A unique root switch is elected for the spanning-tree network topology.
•A designated switch is elected for every switched LAN segment.
•Any loops in the switched network are eliminated by placing redundant switch ports in a backup state; all paths that are not needed to reach the root switch from anywhere in the switched network are placed in STP-blocked mode.
The topology of an active switched network is determined by the following:
•The unique switch identifier Media Access Control ([MAC] address of the switch) that is associated with each switch
•The path cost to the root that is associated with each switch port
•The port identifier (MAC address of the port) that is associated with each switch port
In a switched network, the root switch is the logical center of the spanning-tree topology. A spanning-tree protocol uses BPDUs to elect the root switch and root port for the switched network, as well as the root port and designated port for each switched segment.
Understanding How a Switch Becomes the Root Switch
If all switches are enabled with default settings, the switch with the lowest MAC address in the network becomes the root switch. In Figure 7-1, Switch A is the root switch because it has the lowest MAC address. However, due to traffic patterns, number of forwarding ports, or line types, Switch A might not be the ideal root switch. A switch can be forced to become the root switch by increasing the priority (that is, lowering the numerical priority number) on the preferred switch. This action causes the spanning tree to recalculate the topology and make the selected switch the root switch.
You can change the priority of a port to make it the root port. When the spanning-tree topology is based on default parameters, the path between the source and destination stations in a switched network might not be ideal. Connecting higher-speed links to a port that has a higher number than the current root port can cause a root-port change. The goal is to make the fastest link the root port.
For example, assume that a port on Switch B is a fiber-optic link. Also, another port on Switch B (an unshielded twisted-pair [UTP] link) is the root port. Network traffic might be more efficient over the high-speed fiber-optic link. By changing the Port Priority parameter for the fiber-optic port to a higher priority (lower numerical value) than the UTP port, the fiber-optic port becomes the root port. You could also accomplish this scenario by changing the Port Cost parameter for the fiber-optic port to a lower value than that of the UTP port.
Understanding How Bridge Protocol Data Units Work
The BPDUs contain configuration information about the transmitting switch and its ports, including the switch and port MAC addresses, switch priority, port priority, and port cost. Each configuration BPDU contains this information:
•The unique identifier of the switch that the transmitting switch believes to be the root switch
•The cost of the path to the root from the transmitting port
•The identifier of the transmitting port
The switch sends configuration BPDUs to communicate with and compute the spanning-tree topology. A MAC frame conveying a BPDU sends the switch group address to the destination address field. All switches that are connected to the LAN on which the frame is transmitted receive the BPDU. The BPDUs are not directly forwarded by the switch, but the receiving switch uses the information in the frame to calculate a BPDU and, if the topology changes, initiates a BPDU transmission.
A BPDU exchange results in the following:
•One switch is elected as the root switch.
•The shortest distance to the root switch is calculated for each switch.
•A designated switch is selected. This is the switch that is closest to the root switch through which frames will be forwarded to the root.
•A port for each switch is selected. This is the port that provides the best path from the switch to the root switch.
•The ports included in the STP are selected.
Calculating and Assigning Port Costs
By calculating and assigning the port cost of the switch ports, you can ensure that the shortest (lowest cost) distance to the root switch is used to transmit data. You can calculate and assign the lower path cost values (port costs) to the higher bandwidth ports by using either the short method (which is the default) or the long method. The short method uses a 16-bit format that yields values from 1 to 65535. The long method uses a 32-bit format that yields values in the range of 1 to 200,000,000.
Calculating the Port Cost
The IEEE 802.1D specification assigns 16-bit (short) default port cost values to each port that is based on bandwidth. You can also manually assign port costs between 1-65535. The 16-bit values are only used for the ports that have not been specifically configured for port cost.
Port Speed | Default Cost Value | Default Range |
---|---|---|
10 Mbps | 100 | 1 to 65535 |
100 Mbps | 19 | 1 to 65535 |
1 Gbps | 4 | 1 to 65535 |
Spanning-Tree Port States
Topology changes can take place in a switched network due to a link coming up or a link going down (failing). When a switch port transitions directly from nonparticipation in the topology to the forwarding state, it can create temporary data loops. Ports must wait for new topology information to propagate through the switches in the LAN before they can start forwarding frames. Also, they must allow the frame lifetime to expire for frames that have been forwarded using the old topology.
t any given time, each port on a switch using a spanning-tree protocol is in one of these states:
•Blocking
•Listening
•Learning
•Forwarding
•Disabled
A port moves through these states as follows:
•From initialization to blocking
•From blocking to listening or to disabled
•From listening to learning or to disabled
•From learning to forwarding or to disabled
•From forwarding to disabled
You can modify each port state by using management software, for example, VLAN Trunking Protocol (VTP). When you enable spanning tree, every switch in the network goes through the blocking state and the transitory states of listening and learning at power up. If properly configured, each port stabilizes into the forwarding or blocking state.
When the spanning-tree algorithm places a port in the forwarding state, the following occurs:
•The port is put into the listening state while it waits for protocol information that suggests it should go to the blocking state.
•The port waits for the expiration of a protocol timer that moves the port to the learning state.
•In the learning state, the port continues to block frame forwarding as it learns station location information for the forwarding database.
•The expiration of a protocol timer moves the port to the forwarding state, where both learning and forwarding are enabled.
Blocking State
A port in the blocking state does not participate in frame forwarding . After initialization, a BPDU is sent to each port in the switch. A switch initially assumes that it is the root until it exchanges BPDUs with other switches. This exchange establishes which switch in the network is really the root. If only one switch resides in the network, no exchange occurs, the forward delay timer expires, and the ports move to the listening state. A switch always enters the blocking state following switch initialization.
A port in the blocking state performs as follows:
•Discards frames that are received from the attached segment.
•Discards frames that are switched from another port for forwarding.
•Does not incorporate station location into its address database. (There is no learning on a blocking port, so there is no address database update.)
•Receives BPDUs and directs them to the system module.
•Does not transmit BPDUs that are received from the system module.
•Receives and responds to network management messages.
Listening State
The listening state is the first transitional state that a port enters after the blocking state. The port enters this state when the spanning tree determines that the port should participate in frame forwarding.
A port in the listening state performs as follows:
•Discards frames that are received from the attached segment.
•Discards frames that are switched from another port for forwarding.
•Does not incorporate station location into its address database. (There is no learning at this point, so there is no address database update.)
•Receives BPDUs and directs them to the system module.
•Processes BPDUs that are received from the system module.
•Receives and responds to network management messages.
Learning State
A port in the learning state prepares to participate in frame forwarding. The port enters the learning state from the listening state.
A port in the learning state performs as follows:
•Discards frames that are received from the attached segment.
•Discards frames that are switched from another port for forwarding.
•Incorporates station location into its address database.
•Receives BPDUs and directs them to the system module.
•Receives, processes, and transmits BPDUs that are received from the system module.
•Receives and responds to network management messages.
Forwarding State
port in the forwarding state performs as follows:
•Forwards frames that are received from the attached segment.
•Forwards frames that are switched from another port for forwarding.
•Incorporates station location information into its address database.
•Receives BPDUs and directs them to the system module.
•Processes BPDUs that are received from the system module.
•Receives and responds to network management messages.
Disabled State
A port in the disabled state does not participate in frame forwarding or STP. A port in the disabled state is virtually nonoperational. A disabled port performs as follows:
•Discards frames that are received from the attached segment.
•Discards frames that are switched from another port for forwarding.
•Does not incorporate station location into its address database. (There is no learning, so there is no address database update.)
•Receives BPDUs but does not direct them to the system module.
•Does not receive BPDUs for transmission from the system module.
•Receives and responds to network management messages.
No comments:
Post a Comment