Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Cisco Press CCNA ICND 2004 - Cisco Press.pdf
Скачиваний:
120
Добавлен:
24.05.2014
Размер:
13.19 Mб
Скачать

Spanning Tree Protocol Configuration 57

The following examples were taken from a small network with two switches, as shown in Figure 2-12.

Figure 2-12 Two-Switch Network

 

 

Fa 0/16

Fa 0/16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Fa 0/17

Fa 0/17

 

 

SW1-2950

SW2-2950

The examples in the rest of this chapter use the network as shown in the figure. Two 2950s connect using crossover cables. The cables are plugged into interfaces 0/16 and 0/17 on both switches.

Basic STP show Commands

Example 2-1 lists information about the current state of STP in this network, with all default STP parameters.

Example 2-1 STP Status for the Network Shown in Figure 2-12 with Default STP Parameters

sw1-2950#show spanning-tree

VLAN0001

 

 

 

 

 

 

 

 

 

 

 

Spanning tree enabled protocol ieee

 

 

 

 

 

 

 

 

 

 

 

 

 

Root ID

Priority

32768

 

 

 

 

 

 

 

Address

0050.f035.a940

 

 

 

 

 

Cost

19

 

 

 

 

 

 

 

 

Port

16

(FastEthernet0/16)

 

 

 

 

Hello Time

2

sec

 

Max Age 20 sec

Forward Delay 15 sec

 

 

 

 

 

 

 

Bridge ID

Priority

32769

 

(priority 32768 sys-id-ext 1)

 

 

Address

000a.b7dc.b780

 

 

 

 

 

Hello Time

2

sec

 

Max Age 20 sec

Forward Delay 15 sec

 

 

Aging Time 300

 

 

 

 

 

 

 

Interface

 

Port ID

 

 

 

 

Designated

 

Port ID

Name

 

Prio.Nbr

 

 

Cost Sts

Cost Bridge ID

Prio.Nbr

---------------- -------- --------- --- --------- --------------------

--------

 

 

 

 

 

 

 

 

 

 

 

 

Fa0/16

 

128.16

 

 

 

 

19 FWD

 

0 32768

0050.f035.a940

128.26

Fa0/17

 

128.17

 

 

 

 

19 BLK

 

0 32768

0050.f035.a940

128.27

sw1-2950#show spanning-tree interface fastethernet 0/17

 

 

Vlan

 

Port ID

 

 

 

 

Designated

 

Port ID

Name

 

Prio.Nbr

 

 

Cost Sts

Cost Bridge ID

Prio.Nbr

---------------- -------- --------- --- --------- --------------------

--------

 

 

 

 

 

 

 

 

 

 

 

 

VLAN0001

128.17

 

 

 

 

19 BLK

 

0 32768

0050.f035.a940

128.27

 

 

 

 

 

 

 

 

 

 

 

 

58 Chapter 2: Spanning Tree Protocol

This example lists the output of the show spanning-tree command on SW1. At the beginning of the example, the SW1 output lists the root bridge ID, comprised of the priority and MAC address, first. The bridge ID combines the priority and the MAC address used to identify each bridge or switch. Next, the output lists SW1-2950’s own bridge ID. Notice that the root bridge ID is different from SW1-2950's bridge ID.

The topology in this example ends up with SW2 as the root bridge, so it forwards on both interfaces. SW1-2950 receives BPDUs on FastEthernet ports 0/16 and 0/17. From the topology, you know that the two BPDUs are both from SW2, and both tie in every respect. However, SW1 must choose one interface to put into forwarding state and one into blocking state to avoid a loop. You can see from the in the example that the port cost is 19 on each interface, the default IEE port cost for FastEthernet interfaces. So SW1 breaks the tie by using the lowest internal interface number, which is FastEthernet 0/16. So, in the example, you see SW1 port 0/16 in forwarding state and 0/17 in blocking state.

Changing STP Port Costs and Bridge Priority

In Example 2-2, the configuration changes to affect the spanning tree. First, on SW1-2950, the port cost is changed on fastethernet 0/17, which makes SW1-2950 transition that port from blocking state to forwarding state and interface fastethernet 0/16 to blocking state.

Next, SW1-2950 becomes the root by changing its bridge priority.

Example 2-2 Manipulating STP Port Cost and Bridge Priority

sw1-2950#debug spanning-tree

Spanning Tree event debugging is on

sw1-2950#configure terminal

Enter configuration commands, one per line. End with CNTL/Z. sw1-2950(config)#interface fastethernet 0/17 sw1-2950(config-if)#spanning-tree cost 2 sw1-2950(config-if)#^Z

sw1-2950#

00:23:19: STP: VLAN0001 new Root Port Fa0/17, cost 2 00:23:19: STP: VLAN0001 Fa0/17 -> listening 00:23:34: STP: VLAN0001 Fa0/17 -> learning 00:23:49: STP: VLAN0001 Fa0/17 -> forwarding

sw1-2950#show spanning-tree

VLAN0001

Spanning tree enabled protocol ieee

Root ID

Priority

32768

 

Address

0050.f035.a940

 

 

 

 

 

Cost

2

 

 

Port

17

(FastEthernet0/17)

 

Hello Time

2

sec Max Age 20 sec Forward Delay 15 sec

 

 

 

 

 

Spanning Tree Protocol Configuration 59

Example 2-2 Manipulating STP Port Cost and Bridge Priority (Continued)

 

 

Bridge ID

Priority

32769

(priority 32768 sys-id-ext 1)

 

 

 

 

 

Address

000a.b7dc.b780

 

 

 

 

Hello Time

2 sec

Max Age 20 sec Forward Delay 15 sec

 

 

 

Aging Time

300

 

 

 

 

Interface

Port ID

 

 

Designated

Port ID

 

Name

Prio.Nbr

Cost Sts

Cost Bridge ID

Prio.Nbr

 

---------------- -------- --------- --- --------- -------------------- --------

 

 

 

 

 

 

 

Fa0/16

128.16

 

19 BLK

0 32768 0050.f035.a940 128.26

 

Fa0/17

128.17

 

2 FWD

0 32768 0050.f035.a940 128.27

 

sw1-2950#configure terminal

 

 

 

 

sw1-2950(config)#spanning-tree vlan 1 root primary

 

 

vlan 1 bridge priority set to 24576

 

 

 

vlan 1 bridge max aging time unchanged at 20

 

 

 

vlan 1 bridge hello time unchanged at 2

 

 

 

vlan 1 bridge forward delay unchanged at 15

 

 

 

sw1-2950(config)#^Z

 

 

 

 

 

sw1-2950#

 

 

 

 

 

 

 

 

00:24:49: setting bridge id (which=1) prio 24577 prio cfg 24576 sysid 1 (on) id

 

6001.000a.b7dc.b780

 

 

 

 

 

00:24:49: STP: VLAN0001

we are the spanning tree root

 

 

00:24:49: STP: VLAN0001

Fa0/16 -> listening

 

 

 

00:24:49: STP: VLAN0001

Topology Change rcvd on Fa0/16

 

 

00:25:04: STP: VLAN0001

Fa0/16 -> learning

 

 

 

00:25:19: STP: VLAN0001

Fa0/16 -> forwarding

 

 

 

 

 

 

 

 

 

This example starts with the debug spanning-tree command on SW1-2950. This command tells the switch to issue informational messages whenever STP performs any significant work. These messages show up in the example as a result of the commands shown later in the example output.

Next, the port cost of the SW1-2950 interface fastethernet 0/17 is changed using the spanning-tree cost 2 command. (The default cost on a 100-Mbps link is 19.) Immediately following this command, you see the first meaningful debug messages. SW1-2950 issues a message each time an interface transitions to another state, and it includes a time stamp. Notice that the message stating that fastethernet 0/17 moves to listening state is followed by a message stating that fastethernet 0/17 has been placed in learning state—and the time stamp shows that this message was issued 15 seconds after the first one. Similarly, the message stating that fastethernet 0/17 was placed in forwarding state happens 15 seconds after that. So the debug messages simply reinforce the notion of the Forward Delay timer.

60 Chapter 2: Spanning Tree Protocol

Following the debug messages, the output of the show spanning-tree command lists fastethernet 0/16 as blocking and fastethernet 0/17 as forwarding, with the cost to the root bridge now only 2, based on the changed cost of interface fastethernet 0/17.

The next change occurs when the spanning-tree vlan 1 root primary command is issued on SW1-2950. This command changes the bridge priority to 24,576, which makes SW1-2950 the root. The debug messages that follow confirm this fact.

EtherChannel Configuration

Finally, the two switches do have parallel Ethernet connections that could be configured for EtherChannel. By doing so, STP does not block on either interface, because STP treats both interfaces on each switch as one link. Example 2-3 shows the SW1-2950 configuration and show commands for the new EtherChannel.

Example 2-3 Configuring and Monitoring EtherChannel

sw1-2950#configure terminal

Enter configuration commands, one per line. End with CNTL/Z. sw1-2950(config)#int fa 0/16 sw1-2950(config-if)#channel-group 1 mode on sw1-2950(config)#int fa 0/17 sw1-2950(config-if)#channel-group 1 mode on sw1-2950(config-if)#^Z

sw1-2950#show spanning-tree

VLAN0001

 

 

 

 

Spanning tree enabled protocol ieee

 

Root ID

Priority

24577

 

 

 

Address

000a.b7dc.b780

 

 

This bridge

is the root

 

 

Hello Time

2 sec

Max Age 20 sec

Forward Delay 15 sec

Bridge ID

Priority

24577

(priority 24576 sys-id-ext 1)

 

Address

000a.b7dc.b780

 

 

Hello Time

2 sec

Max Age 20 sec

Forward Delay 15 sec

Aging Time 15

 

 

 

 

 

Interface

Port ID

 

 

Designated

Port ID

Name

Prio.Nbr

Cost

Sts

Cost

Bridge ID

Prio.Nbr

----------------

-------- ---------

--- ---------

--------------------

--------

 

 

 

 

 

 

 

 

Po1

128.65

 

12

LIS

0

24577 000a.b7dc.b780

128.65

 

 

 

 

 

 

 

 

sw1-2950#

 

 

 

 

 

 

 

00:32:27: STP: VLAN0001 Po1 -> learning 00:32:42: STP: VLAN0001 Po1 -> forwarding

Spanning Tree Protocol Configuration 61

Example 2-3 Configuring and Monitoring EtherChannel (Continued)

sw1-2950#show etherchannel 1 summary

Flags: D - down

P -

in port-channel

I - stand-alone s -

suspended

R - Layer3

S -

Layer2

u - unsuitable for bundling

U - port-channel in use

d - default port

 

 

Group

Port-channel

Ports

-----+

------------

+-----------------------------------------------------------

 

 

 

1

Po1(SU)

Fa0/16(P) Fa0/17(P)

 

 

 

At the beginning of this example, you see the configuration on SW1-2950. On the 2950, any port can be part of an EtherChannel, with up to eight on a single EtherChannel, so the EtherChannel commands are interface subcommands. The channel-group 1 mode on interface subcommands enable EtherChannel on interfaces fastethernet 0/16 and 0/17. Both switches must agree on the number for the EtherChannel—1 in this case.

The channel-group command uses the on parameter on both switches to ensure that the two links are placed in an EtherChannel. If for some reason SW2 was not configured correctly for EtherChannel, the ports could not be used. Alternatively, the EtherChannel configuration commands on each switch could use parameters of auto or desirable instead of on. With these other parameters, the switches negotiate whether to use EtherChannel. If negotiated, an EtherChannel is formed. If not, the ports can be used without forming an EtherChannel, with STP blocking some interfaces.

The use of the auto and desirable parameters can be deceiving. If you configure auto on both switches, the EtherChannel never comes up! The auto keyword tells the switch to wait for the other switch to start the negotiations. If both switches are waiting, it’s a long wait! As long as one of the two switches is configured with the keyword desirable, the EtherChannel is negotiated.

In the rest of Example 2-3, you see several references to port-channel or Po. Because STP treats the channel as one link, the switch needs some way to represent the entire EtherChannel. The 2950 IOS uses the term Po, short for “port channel,” as a way to name the EtherChannel. (EtherChannel is sometimes called “port channeling.”) For instance, near the end of the example, the show etherchannel 1 summary command references Po1, for port channel/EtherChannel 1.