VLAN Lab Part 3: Final Answers to the Lab

Analysis
Oct 13, 20103 mins

Post Your Alternatives, Too

This week I’ll wrap up the lab by showing what I think is the “best” (shortest) config to complete the lab variation #2 from last week’s post. For those that missed the last two weeks, we’re in the middle of a VLAN-oriented CCNA/CCNP lab, with an overarching goal of using the fewest commands, ala Name That Tune.

Last week’s post changed the requirements so that the switches didn’t require a VTP password. That opened up a couple of advantages for shortening the config:

  • You can avoid the vtp password fred command on the three switches
  • You can take advantage of how switches can, in some conditions, learn the VTP domain name dynamically – and therefore start participating in a VTP domain.

In this case, if just one of the three switches sets its VTP domain name to a non-null (default) value, and the switches successfully trunk, all three switches will learn the domain name, and start using VTP. With all defaults, a switch has a null domain name. Once a switch has a domain name, it will send a VTP update over its trunks. Switches that receive this VTP update over a trunk, with the default null domain name, hear the update, and use that VTP domain name. In short, to get VTP working in this lab, all you need to do is configure a VTP domain name on only one of the three switches.

The solution I listed last week shows all three switches needing to configure the VLAN, whether explicitly or as a side-effect of the switchport access vlan x command. Also, to prevent VLAN 2 broadcasts from arriving at switch S3, S2 needed to remove VLAN 2 from the allowed VLAN list on the S2-S3 trunk. The shortest config (at least that I could think of) uses the VLAN pruning feature of VTP to prevent these broadcasts, as shown in this sample configuration:

Solution 2: Remove VTP password requirement

SW1:

interface F0/11
 switchport access vlan 2

SW2:

interface F0/11
 switchport access vlan 2
interface range G0/1,G0/2
 switchport mode dynamic desirable
vtp domain barney
vtp pruning

SW3:

! no commands

With this config, the switches trunk. SW1 and SW2 start out knowing about VLAN 2 as a side-effect of the switchport access vlan 2 commands on each switch. SW3 hears SW2’s VTP update, domain fred, and starts using that domain – and therefore learning about VLAN 2. SW2’s config also enables VTP VLAN pruning, so that SW2’s G0/1 trunk (to SW3) no longer lists VLAN 2 in the list of ports unpruned and in an STP forwarding state.

Did anyone out there find a shorter config? Or a different config with 8 lines? Last post for this series – post any final questions here. Thanks all! 

VLAN Lab (October 2010):

A CCNA and CCNP VLAN Lab

Answers to Last Week’s VLAN Lab, Plus a New Challenge