Автор: Ben Piper
Издательство: John Wiley & Sons Limited
Жанр: Зарубежная компьютерная литература
isbn: 9781119658801
isbn:
Calculating the Root Ports
The root bridge always has all of its ports in a forwarding state, so it's up to the non-root bridges to prevent bridging loops. Each non-root bridge must determine its root port—the port that has the lowest-cost path to the root bridge. For switches connected directly to the root, this is easy. If a non-root bridge has only one interface to the root, that interface becomes the root port. On the other hand, if a bridge has multiple connections to the root, only the one with the lowest cost to the root will become the root port. All other ports leading back to the root bridge are blocked, thus preventing a loop.
For a switch connected directly to the root, the root port will be the port with the lowest cost. If the costs are equal, the root port will be the one with the lowest designated port ID. To see how this works, refer to Figure 2.5. SW3 is the root for VLAN 1. SW1 has two direct links to the root: Gi1/0 and Gi1/1. The port with the lowest cost to the root will become the root port. The port cost is based on interface bandwidth, as shown in Table 2.1.
Table 2.1 STP port costs by speed
Speed | Cost |
10 Mbps | 100 |
100 Mbps | 19 |
1 Gbps | 4 |
10 Gbps | 2 |
Figure 2.5 VLAN 1 topology with SW3 as root
Because Both of SW1's interfaces facing SW3 are 1 Gbps interfaces, they each have a cost of 4, as shown in the following output from SW1:
SW1#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol rstp Root ID Priority 32769 Address 0015.fa83.e900 Cost 4 Port 5 (GigabitEthernet1/0) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 36865 (priority 36864 sys-id-ext 1) Address 0015.f9fb.1e80 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 300 sec Interface Role Sts Cost Prio.Nbr Type ------------------- ---- --- --------- -------- -------------------------------- Gi0/0 Desg FWD 4 128.1 P2p Gi0/1 Desg FWD 4 128.2 P2p Gi0/2 Desg FWD 4 128.3 P2p Gi0/3 Desg FWD 4 128.4 P2p Gi1/0 Root FWD 4 128.5 P2p Gi1/1 Altn BLK 4 128.6 P2p ! Output truncated
STP must block one port, and the output shows that Gi1/0 is the root port. Why was Gi1/0 selected instead of Gi1/1? Here's where confusion sets in for a lot of people. You might assume that Gi1/0 was selected because the port ID—listed in the Prio.Nbr column—is lower for Gi1/0 than Gi1/1. But this is not the reason. Observe the following output from SW1:
SW1#show spanning-tree interface gigabitEthernet 1/0 detail Port 5 (GigabitEthernet1/0) of VLAN0001 is root forwarding Port path cost 4, Port priority 128, Port Identifier 128.5. Designated root has priority 32769, address 0015.fa83.e900 Designated bridge has priority 32769, address 0015.fa83.e900 Designated port id is 128.5, designated path cost 0 Timers: message age 16, forward delay 0, hold 0 Number of transitions to forwarding state: 1 Link type is shared by default BPDU: sent 38, received 293 SW1#show spanning-tree interface gigabitEthernet 1/1 detail Port 6 (GigabitEthernet1/1) of VLAN0001 is alternate blocking Port path cost 4, Port priority 128, Port Identifier 128.6. Designated root has priority 32769, address 0015.fa83.e900 Designated bridge has priority 32769, address 0015.fa83.e900 Designated port id is 128.6, designated path cost 0 Timers: message age 16, forward delay 0, hold 0 Number of transitions to forwarding state: 0 Link type is shared by default BPDU: sent 4, received 295
Notice that for each port there are two slightly different references to a port ID:
Gi1/0Port ID: 128.5Designated port ID: 128.5
Gi1/1Port ID: 128.6Designated port ID: 128.6
The port ID is what SW1 has configured on its interface, whereas the designated port ID is what SW3 has configured on its facing interface. SW1's STP instance uses the designated port ID to select the root port. How does SW1 know SW3's port ID? It's transmitted in the BPDU from SW3. In other words, the root port is determined by the port ID on the opposite end of the link.
Calculating the Root Ports of Indirectly Connected Switches
It's fairly easy to determine the root port for a bridge that's directly connected to the root. But what about the root port of a bridge that's indirectly connected, perhaps separated by one or two switches? Looking at Figure 2.4, you can see that SW2 has four possible paths back to the root:
SW1—BIA 0015.f9fb.1e80, bridge priority 36865Gi0/0Gi0/1
SW4—BIA 001d.45cf.e800, bridge priority 32769Gi1/0Gi1/1
SW2 will first consider which port offers the lowest cost to the root, which is the sum of all interface costs between SW2 and the root. Let's first look at the path through SW1.
1 SW2 Gi0/0 or Gi0/1 has an interface cost of 4.
2 SW1 Gi1/0 (root port) has an interface cost of 4.
SW2's path through SW1 to the root has a total cost of 8. Now let's consider the path through SW4.
1 SW2 Gi1/0 or Gi1/1 has an interface cost of 4.
2 SW4 Gi0/0 has an interface cost of 4.
SW2's path through SW4 to the root also has a cost of 8. Because both path costs are equal, SW2 will choose the bridge with the lowest bridge ID, which in this case is SW4. Although SW4 has a higher BIA than SW1, it has a lower priority. Because the costs are equal, SW2 will select the port with the lowest port priority as the root port, as shown in the following output:
SW2#show spanning-tree vlan 1 interface gigabitEthernet 1/0 detail Port 5 (GigabitEthernet1/0) of VLAN0001 is root forwarding Port path cost 4, Port priority 128, Port Identifier 128.5. Designated root has priority 32769, address 0015.fa83.e900 Designated bridge has priority 32769, address 001d.45cf.e800 Designated port id is 128.5, designated path cost 4 Timers: message age 15, forward delay 0, hold 0 Number of transitions to forwarding state: 1 Link type is shared by default BPDU: sent 37, received 823 SW2#show spanning-tree vlan 1 interface gigabitEthernet 1/1 detail Port 6 (GigabitEthernet1/1) of VLAN0001 is alternate blocking Port path cost 4, Port priority 128, Port Identifier 128.6. Designated root has priority 32769, address 0015.fa83.e900 Designated bridge has priority 32769, address 001d.45cf.e800 Designated port id is 128.6, designated path cost 4 Timers: message age 15, forward delay 0, hold 0 Number of transitions to forwarding state: 0 Link type is shared by default BPDU: sent 3, received 822
SW4 is advertising a port priority of 128.5 on Gi1/0, which is lower СКАЧАТЬ