CCNP Enterprise Certification Study Guide: Implementing and Operating Cisco Enterprise Network Core Technologies. Ben Piper
Читать онлайн книгу.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 than the port priority of 128.6 that it's advertising on Gi1/1. SW2 will thus select Gi1/0 as the root port. But suppose that you wanted Gi1/1 to be the root port instead. Although there are a few ways to do this, I recommend one of the following:
Decrease the port cost of Gi1/1 on SW2
Decrease the port priority of Gi1/1 on SW4
Alternatively, you could increase the port cost or priority, but it's best not to. If you were to add another connection between the switches later—say using a lower port number like Gi0/3—it would then become the root port. By decreasing the port cost or priority, you can ensure that your desired port always remains the root port.
Modifying Port Cost
To get SW2 to use Gi1/1 as the root port, you can decrease the port cost from 4 to 2:
SW2(config)#int gigabitEthernet 1/1 SW2(config-if)#spanning-tree vlan 1 cost ? <1-200000000> Change an interface's per VLAN spanning tree path cost SW2(config-if)#spanning-tree vlan 1 cost 2 SW2(config-if)#do show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol rstp Root ID Priority 32769 Address 0015.fa83.e900 Cost 6 Port 6 (GigabitEthernet1/1) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0015.fa88.4e80 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 Altn BLK 4 128.1 P2p Gi0/1 Altn BLK 4 128.2 P2p Gi0/2 Desg BLK 4 128.3 P2p Gi0/3 Desg BLK 4 128.4 P2p Gi1/0 Altn BLK 4 128.5 P2p Gi1/1 Root FWD 2 128.6 P2p ! Output truncated
Gi1/1 is now the root port. Let's change it back to 4:
SW2(config-if)#spanning-tree vlan 1 cost 4 SW2(config-if)#do show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol rstp Root ID Priority 32769 Address 0015.fa83.e900 Cost 8 Port 5 (GigabitEthernet1/0) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0015.fa88.4e80 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 Altn BLK 4 128.1