cisco · Catalyst 2960 · 24 стр.
Cisco Catalyst 2960: Руководство по настройке протокола Spanning Tree (STP)
Похожие инструкции
Содержание
Текст документа
Spanning Tree Protocol
Configuring Spanning Tree Protocol This chapter describes how to configure the Spanning Tree Protocol (STP) on port-based VLANs on the Catalyst devices. The device can use either the per-VLAN spanning-tree plus (PVST+) protocol based on the IEEE 802.1D standard and Cisco proprietary extensions, or the rapid per-VLAN spanning-tree plus (rapid-PVST+) protocol based on the IEEE 802.1w standard. A device stack appears as a single spanning-tree node to the rest of the network, and all stack members use the same bridge ID.
Restrictions for Spanning Tree Protocol, on page 1 Information About Spanning Tree Protocol, on page 1 How to Configure Spanning Tree Protocol, on page 11 Monitoring Spanning Tree Protocol Configuration Status, on page 22 Additional References for Spanning Tree Protocol, on page 22 Feature History for Spanning Tree Protocol, on page 22 Restrictions for Spanning Tree Protocol • An attempt to configure a device as the root device fails if the value necessary to be the root device is less than 1. • If your network consists of devices that support and do not support the extended system ID, it is unlikely that the device with the extended system ID support will become the root device.
The extended system ID increases the device priority value every time the VLAN number is greater than the priority of the connected devices running older software. • The root device for each spanning tree instance should be a backbone or distribution device. Do not configure an access device as the spanning tree primary root. Information About Spanning Tree Protocol The following sections provide information about spanning tree protocol: Spanning Tree Protocol Spanning Tree Protocol (STP) is a Layer 2 link management protocol that provides path redundancy while preventing loops in the network.
For a Layer 2 Ethernet network to function properly, only one active path Configuring Spanning Tree Protocol 1
Spanning-Tree Topology and Bridge Protocol Data Units
can exist between any two stations. Multiple active paths among end stations cause loops in the network. If a loop exists in the network, end stations might receive duplicate messages. Devices might also learn end-station MAC addresses on multiple Layer 2 interfaces. These conditions result in an unstable network. Spanning-tree operation is transparent to end stations, which cannot detect whether they are connected to a single LAN segment or a switched LAN of multiple segments. The STP uses a spanning-tree algorithm to select one device of a redundantly connected network as the root of the spanning tree.
The algorithm calculates the best loop-free path through a switched Layer 2 network by assigning a role to each port based on the role of the port in the active topology: • Root—A forwarding port elected for the spanning-tree topology • Designated—A forwarding port elected for every switched LAN segment • Alternate—A blocked port providing an alternate path to the root bridge in the spanning tree • Backup—A blocked port in a loopback configuration The device that has all of its ports as the designated role or as the backup role is the root device. The device that has at least one of its ports in the designated role is called the designated device.
Spanning tree forces redundant data paths into a standby (blocked) state. If a network segment in the spanning tree fails and a redundant path exists, the spanning-tree algorithm recalculates the spanning-tree topology and activates the standby path. Devices send and receive spanning-tree frames, called bridge protocol data units (BPDUs), at regular intervals. The devices do not forward these frames but use them to construct a loop-free path. BPDUs contain information about the sending device and its ports, including device and MAC addresses, device priority, port priority, and path cost.
Spanning tree uses this information to elect the root device and root port for the switched network and the root port and designated port for each switched segment. When two ports on a device are part of a loop, the spanning-tree and path cost settings control which port is put in the forwarding state and which is put in the blocking state. The spanning-tree port priority value represents the location of a port in the network topology and how well it is located to pass traffic. The path cost value represents the media speed. The short path cost method is the default STP path cost method used. Note In addition to STP, the device uses keepalive messages to detect loops.
By default, keepalive is enabled on Layer 2 ports. To disable keepalive, use the no keepalive command in interface configuration mode. Note Spanning-Tree Topology and Bridge Protocol Data Units The stable, active spanning-tree topology of a switched network is controlled by these elements: • The unique bridge ID (device priority and MAC address) associated with each VLAN on each device. In a switch stack, all switches use the same bridge ID for a given spanning-tree instance. • The spanning-tree path cost to the root device. • The port identifier (port priority and MAC address) associated with each Layer 2 interface.
Configuring Spanning Tree Protocol Spanning-Tree Topology and Bridge Protocol Data Units Configuring Spanning Tree Protocol 2
Bridge ID, Device Priority, and Extended System ID
When the devices in a network are powered up, each functions as the root device. Each device sends a configuration BPDU through all its ports. The BPDUs communicate and compute the spanning-tree topology. Each configuration BPDU contains this information: • The unique bridge ID of the device that the sending device identifies as the root device.
• The spanning-tree path cost to the root • The bridge ID of the sending device • Message age • The identifier of the sending interface • Values for the hello, forward delay, and max-age protocol timers When a device receives a configuration BPDU that contains superior information (lower bridge ID, lower path cost, and so forth), it stores the information for that port. If this BPDU is received on the root port of the device, the device also forwards it with an updated message to all attached LANs for which it is the designated device. If a device receives a configuration BPDU that contains inferior information to that currently stored for that port, it discards the BPDU.
If the device is a designated device for the LAN from which the inferior BPDU was received, it sends that LAN a BPDU containing the up-to-date information stored for that port. In this way, inferior information is discarded, and superior information is propagated on the network. A BPDU exchange results in these actions: • One device in the network is elected as the root switch (the logical center of the spanning-tree topology in a switched network). See the figure following the bullets. For each VLAN, the device with the highest device priority (the lowest numerical priority value) is elected as the root switch.
If all devices are configured with the default priority (32768), the devices with the lowest MAC address in the VLAN becomes the root device. The device priority value occupies the most significant bits of the bridge ID, . • A root port is selected for each device (except the root switch). This port provides the best path (lowest cost) when the device forwards packets to the root switch. • The shortest distance to the root switch is calculated for each device based on the path cost. • A designated device for each LAN segment is selected. The designated device incurs the lowest path cost when forwarding packets from that LAN to the root switch.
The port through which the designated device is attached to the LAN is called the designated port. All paths that are not needed to reach the root switch from anywhere in the switched network are placed in the spanning-tree blocking mode. Bridge ID, Device Priority, and Extended System ID The IEEE 802.1D standard requires that each device has a unique bridge identifier (bridge ID), which controls the selection of the root switch. Because each VLAN is considered as a different logical bridge with PVST+ and Rapid PVST+, the same device must have a different bridge ID for each configured VLAN. Each VLAN on the device has a unique 8-byte bridge ID.
The 2 most-significant bytes are used for the device priority, and the remaining 6 bytes are derived from the device MAC address. Configuring Spanning Tree Protocol Bridge ID, Device Priority, and Extended System ID Configuring Spanning Tree Protocol 3
Spanning-Tree Interface States
The 2 bytes previously used for the device priority are reallocated into a 4-bit priority value and a 12-bit extended system ID value equal to the VLAN ID. Table 1: Device Priority Value and Extended System ID Bit 2 Spanning tree uses the extended system ID, the device priority, and the allocated spanning-tree MAC address to make the bridge ID unique for each VLAN. Support for the extended system ID affects how you manually configure the root switch, the secondary root switch, and the switch priority of a VLAN. For example, when you change the switch priority value, you change the probability that the switch will be elected as the root switch.
Configuring a higher value decreases the probability; a lower value increases the probability. Port Priority Versus Path Cost If a loop occurs, spanning tree uses port priority when selecting an interface to put into the forwarding state. You can assign higher priority values (lower numerical values) to interfaces that you want selected first and lower priority values (higher numerical values) that you want selected last. If all interfaces have the same priority value, spanning tree puts the interface with the lowest interface number in the forwarding state and blocks the other interfaces. The spanning-tree path cost default value is derived from the media speed of an interface.
If a loop occurs, spanning tree uses cost when selecting an interface to put in the forwarding state. You can assign lower cost values to interfaces that you want selected first and higher cost values that you want selected last. If all interfaces have the same cost value, spanning tree puts the interface with the lowest interface number in the forwarding state and blocks the other interfaces. If your device is a member of a switch stack, you must assign lower cost values to interfaces that you want selected first and higher cost values that you want selected last instead of adjusting its port priority.
Spanning-Tree Interface States Propagation delays can occur when protocol information passes through a switched LAN. As a result, topology changes can take place at different times and at different places in a switched network. When an interface transitions directly from nonparticipation in the spanning-tree topology to the forwarding state, it can create temporary data loops. Interfaces must wait for new topology information to propagate through the switched LAN before starting to forward frames. They must allow the frame lifetime to expire for forwarded frames that have used the old topology. Each Layer 2 interface on a device using spanning tree exists in one of these states:
• Blocking—The interface does not participate in frame forwarding. • Listening—The first transitional state after the blocking state when the spanning tree decides that the interface should participate in frame forwarding. • Learning—The interface prepares to participate in frame forwarding. • Forwarding—The interface forwards frames. Configuring Spanning Tree Protocol Port Priority Versus Path Cost Priority Value Bit 16 Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 Configuring Spanning Tree Protocol 4