CCIE Pursuit Blog

June 5, 2008

Setting STP Root Bridge for “All Active VLANs”

Filed under: Cisco,Cisco Certification,IOS,Switching — cciepursuit @ 5:13 pm
Tags: , ,

I was going through the IE Volume I v5 (Beta) labs and ran across the following task:

Configure sw1 as the STP Root Bridge for all active VLANs.

I’ve seen similar tasks on other IE labs.  The task’s scope will depend on the phrasing:

all VLANs” – ATP* as this could mean all possible VLANs (1-4094) or all active VLANs (see below)
all possible VLANs” – ATP is you are running VTP as this could mean only the VLANs possible with VTP (1-1001) or all possible VLANs (1-4094)
all active VLANs” – only the VLANs that are being used in the Layer 2 network (be sure that you have already built all of your VLANs).

* – Ask The Proctor  🙂

In this example we’re running VTP on all switches (one VTP domain).  sw1 is a VTP client and all of the VLANs are built.  We can get the VLANs by issuing the “show vlan brief” command:

Rack25SW1(config)#do sh vlan br

VLAN Name                             Status    Ports
—- ——————————– ——— ——————————-
1    default                          active    Fa0/2, Fa0/4, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/19, Fa0/20, Fa0/21
                                                Fa0/22, Fa0/23, Fa0/24, Gi0/1
                                                Gi0/2
5    VLAN0005                         active
7    VLAN0007                         active
8    VLAN0008                         active
9    VLAN0009                         active
10   VLAN0010                         active
22   VLAN0022                         active
43   VLAN0043                         active
58   VLAN0058                         active    Fa0/5
67   VLAN0067                         active
79   VLAN0079                         active
146  VLAN0146                         active    Fa0/1
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

If there are only a handful of VLANs then you can just create a list of VLANs from this output.  If there are more then I use the following method:

1) I set the switch to VTP transparent mode.  That should create a configuration line with all of the VLANs listed in the “show vlan brief” output (except for VLAN 1):

Rack25SW1(config)#vtp mode trans
Setting device to VTP TRANSPARENT mode.

Rack25SW1(config)#do sh run | i vlan
vlan internal allocation policy ascending
vlan 5,7-10,22,43,58,67,79,146
 switchport access vlan 146
 switchport access vlan 58

2) Copy that line (adding VLAN 1 if necessary) :

Rack25SW1(config)#spanning-tree vlan 1,5,7-10,22,43,58,67,79,146 root primary

3) Put the switch back into VTP client mode:

Rack25SW1(config)#vtp mode client
Setting device to VTP CLIENT mode.

Rack25SW1(config)#do sh run | i vlan
spanning-tree vlan 1,5,7-10,22,43,58,67,79,146 priority 24576
vlan internal allocation policy ascending
 switchport access vlan 146
 switchport access vlan 58

To verify:

Rack25SW1(config)#do sh spannnig vlan 1 | i Address
             Address     001b.d490.7c00
             Address     001b.d490.7c00

Both MAC Addresses are the same (the local switch’s MAC and the root bridge’s MAC) so this is the root bridge for that VLAN.  Now issue “show spanning-tree root”

Rack25SW1#sh spanning-tree root

                                        Root    Hello Max Fwd
Vlan                   Root ID          Cost    Time  Age Dly  Root Port
—————- ——————– ——— —– — —  ————
VLAN0001         24577 001b.d490.7c00         0    2   20  15
VLAN0005         24581 001b.d490.7c00         0    2   20  15
VLAN0007         24583 001b.d490.7c00         0    2   20  15
VLAN0008         24584 001b.d490.7c00         0    2   20  15
VLAN0009         24585 001b.d490.7c00         0    2   20  15
VLAN0010         24586 001b.d490.7c00         0    2   20  15
VLAN0022         24598 001b.d490.7c00         0    2   20  15
VLAN0043         24619 001b.d490.7c00         0    2   20  15
VLAN0058         24634 001b.d490.7c00         0    2   20  15
VLAN0067         24643 001b.d490.7c00         0    2   20  15
VLAN0079         24655 001b.d490.7c00         0    2   20  15
VLAN0146         24722 001b.d490.7c00         0    2   20  15

All of the the Root MAC Addresses are the same AND they match the local switch’s MAC address so we’re golden.

 

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: