Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Cisco Switching Black Book - Sean Odom, Hanson Nottingham.pdf
Скачиваний:
87
Добавлен:
24.05.2014
Размер:
2.89 Mб
Скачать

Parent and Child Switches

A switch’s diameter is a unit of measurement between the root switch and child switches. The root bridge counts as the first switch. Each subsequent child switch out from the root bridge is counted to yield the diameter number. A parent switch brings you one switch closer to the root bridge, and a child switch takes you one switch farther away from the root bridge.

Each root bridge can be configured with a diameter from a minimum of two switches to a maximum of seven switches. By modifying the diameter, you will subsequently change the timer values that are advertised by the root to reflect a more accurate network diameter. For example, a diameter of 2 yields a MaxAge of 10 seconds and a FwdDelay of 7 seconds. Cisco recommends that you change the diameter to correctly reflect your network rather than manually changing the timers.

Root Bridge Selection

One of the most important decisions that you make when configuring the STP protocol on your network is the placement of the root bridge. In the spanning tree, the root bridge should be located as close as possible to the center of the network. Certain commands can help the administrator determine which device will become the root bridge. The proper placement of the root bridge(s) optimizes the paths that are chosen by the STP to allow data traffic to flow through the network. It also provides deterministic paths for data to take.

In order to get the most optimal paths through the network, you must sometimes ignore the default root bridge used by STP. This means you must manually configure the bridge that should be the root bridge, as well as the secondary root bridge. The function of the secondary root bridge is to become the root bridge, should the original root bridge fail.

Tip

Typically, root bridges are Distribution layer switches, not Access layer switches. The root

 

bridge should never be a Core layer switch, because the Core layer’s responsibility is to move

 

traffic as quickly as possible.

The Selection Process

The root bridge selection process begins as soon as the switch powers up. The root bridge is the reference point in the network from which graph theory is used to calculate the cost of each link for each instance of a spanning tree. Using these calculations, the switches must determine if loops exist in the network and the path costs associated with each path through the network. The switch immediately assumes at startup that it gets to be the root bridge, and it configures its bridge ID equal to the root ID in the BPDU. The bridge ID field of a BPDU message is actually made up of two parts, as follows:

Bridge priority—A 2−byte value set by the switch. By default, the priority is set to 0x8000 or 32,768.

Media Access Control (MAC) address—The 6−byte MAC address of the switch or bridge.

These two fields of the bridge ID help an STP switch yield a value that can be compared with other switches’ bridge IDs to determine which switch will become the root bridge. The lower the bridge ID value, the higher the chance of a root−bridge assignment. If more than one switch has the same low bridge priority value, the bridge with the lowest MAC address then becomes the root bridge. Table 10.3 shows the bridge priority values assigned by STP.

Table 10.3: The bridge priority values assigned by Spanning Tree Protocol.

Priority Assignment

Value

Default bridge priority

32,768

205

Secondary root bridge priority

16,384

Root bridge priority

8,192

The switches participating in STP (other than the root bridge) must form an association with the root bridge shortly after the root bridge has been elected. Each switch examines each BPDU as it arrives on each port. When a switch receives the same information on more than one port, it is an indication that the switch has a redundant path to the root bridge. The switch then determines which port will forward data and which ports will be blocked from sending data. This decision is made by analyzing the path cost and port ID fields of the BPDUs.

Bridges look at the path cost first to determine if the port has the lowest−cost path to the root switch. If the port has the lowest port cost, the port is placed in forwarding mode. All the other ports that are receiving the same BPDU information are placed in blocking mode.

In blocking mode, the port will still forward BPDU and system information to the switch processor. If the path cost is equal, as in the case of identical links, the bridge looks at the port ID as a tie breaker. The port with the lowest port ID forwards, and all other ports are blocked.

Port Costs, Path Costs, and Port Priorities

After the root bridge has been elected, all the switches determine the best loop−free path to the root switch. STP uses several different costs, with the port priority as the tiebreaker. The sum of all the port costs to a destination through all the ports the frames must travel makes up the path cost. Table 10.4 shows the default port cost and port priority assigned to each port.

Table 10.4: The default port settings for STP.

Variable

Default

Port priority

32 (Except 1900 and 2820 series—128)

Port cost

62

When the BPDU is sent to the other bridges, it carries the path cost. The spanning tree looks first at the path cost and decides which ports should forward and which ports should be blocked. If the path costs are equal for more than one port, then the spanning tree looks at the port ID. The port with the lower port ID has priority, making that port the forwarding port. If the path cost and the port ID are the same, then the STP will use the port priority as the tiebreaker. We’ll look more at equal cost paths in the next section.

Tip On both the Command Line Interface (CLI) based IOS and the Set/Clear command−based IOS, you should assign lower numbers to ports attached to faster media and higher numbers to ports attached to slower media. The defaults differ for media, as shown in Table 10.5.

Table 10.5: Examples of path cost calculations.

Physical Wire Speed

Path Cost

10Mbps

100

100Mbps

10

155Mbps

6

1000Mbps (1Gbps)

1

10000Mbps (10Gbps)

1

The port priority on each port can be modified to influence the links that will be forwarding. The port with the lowest priority value forwards frames for all VLANs. In the event that all ports have the same priority value, the port with the lowest port number will forward the frames. The possible port priority value range is from 0 to 63.

206

Equal Cost Paths

If two or more links have the same root path cost, such as two identical links running between two switches, STA has a problem choosing the designated port or a root path through the network using the lowest path cost. The bridge ID is used to determine the root bridge in the network and also the root port. By default, the priority on all devices running STP is 32,768.

If two switches or bridges have the same priority value, then the MAC address is used to break the tie. The bridge or port with the lowest ID wins. For example, let’s look at the two switches depicted in Figure 10.5. One switch uses the MAC address 0000.80ac.0000.1111, and the other switch uses the MAC address 0000.80ac.0000.2222. The switch using 0000.80ac.0000.1111 would become the root bridge or the root port, depending on which decision the switch is making.

Figure 10.5: Two ports on two switches with equal cost paths through the network.

We didn’t consider another option: As the administrator, you can assign a lower path cost to faster physical media, or you can assign slower media a higher path cost. You can also decide which link to give a higher cost path when multiple links are equal. The range of numbers that can be assigned to the port costs are 1 through 65,535. Typically, the path cost is determined by dividing 1,000 by the physical wire speed in megabits per second (Mbps), as shown in Table 10.5.

Note The path cost can never be lower than one.

STA recalculates the cost of using each link whenever a bridge joins the network or when a topology change is detected in the network. This calculation requires communication between the spanning tree bridges, which is accomplished through the passing of BPDU messages between switches.

Spanning Tree Convergence Time

The convergence time is the time it takes STP members to begin transmitting data on a redundant link after a link in forwarding mode has failed. It is also the initial period between the time an STP member powers up and when all the active links are placed in forwarding mode. In both cases, during the convergence time, no data is forwarded.

Note Convergence is necessary to make sure that all devices have the same topology information.

Earlier in this chapter we discussed the STP default timers. The MaxAge default is set to 20 seconds and the FwdDelay is set to 30 seconds, because FwdDelay is used by both the listening and learning states (discussed in the next section). The values have meaning only at a root bridge. You can adjust FwdDelay and MaxAge; however, doing so may cause a data loop temporarily in more complex networks. The downtime could be as high as 50 seconds using the following formula:

2 * FwdDelay + MaxAge = Down Time

207

For example, the downtime caused by using the defaults would be the following:

2 * 15 + 20 = 50 seconds

Now that you have learned about the timers and how BPDUs operate in the network, let’s take a closer look at how ports transition through different states before forwarding data.

STP Port States

Each port participating in STP transitions through four port states, or modes, in a designated order before the port can forward frames it receives. These states are blocking, listening, learning, and forwarding. A fifth state—the disabled state—can be manually configured by the switch.

Let’s look at the different port states and when each is used (see Figure 10.6):

Figure 10.6: The convergence process of the port states in Spanning Tree Protocol.

Blocking—The port will not forward frames. It merely accepts BPDUs the port receives and processes them. All ports are in the blocking state by default when the switch is powered up. The port stays in a blocked state if STP determines that a lower−cost path exists to the root bridge. The port does not put any of the information it hears into the address table.

Listening—The port continues to process BPDUs to make sure no loops occur on the network before it passes data frames. In this state the port is not forwarding frames or learning new addresses.

Learning—The port is not forwarding frames but is learning addresses and putting them in the address table. The learning state is similar to the listening state, except the port can now add information it has learned to the address table. The port is still not allowed to send or receive frames.

Forwarding—The port now begins to learn from the BPDUs and starts to build a filter table. A port is not placed in a forwarding state until there are no redundant links or the port determines the lowest cost path to the root bridge or switch.

Disabled—The port has been manually shut down by the network administrator or by the system due to a hardware problem.

Let’s take a step−by−step look at what happens to a port when the switch is powered up:

1.After the switch’s initialization or startup, all the ports immediately go to a blocking state.

2.After the configured MaxAge has been reached, the switch transitions from the blocking state to the learning state.

3.After the configured FwdDelay time has been reached, the port enters the learning state.

4.After the configured FwdDelay has been reached in the learning state, the port either transitions into forwarding mode or back to blocking mode. If STP has decided the port will be a forwarding port, the port is placed in forwarding mode; but if the port is a higher−cost redundant link, the port is placed in blocking mode again.

Each port state can be manually modified using the Cisco IOS. If properly configured, the ports should create a stable network, and the ports of each switch should transition to either a forwarding or blocking state.

208

Соседние файлы в предмете Программирование