Comandos para Configuración de Vlans

Displaying VLAN Information

2900/2950 Series Switch

2900Switch#show vlan Shows all VLAN status
2900Switch#show vlan brief Shows all VLAN status in brief
2900Switch#show vlan id 2 Displays information of VLAN 2 only
2900Switch#show vlan name Marketing Displays information of VLAN named Marketing only

Creating Static VLANs

2900 Series Switch

2900Switch#vlan database Enters VLAN database mode
2900(vlan)#vlan 2 name Engineering Creates VLAN 2 and names it Engineering
2900(vlan)#vlan 3 name Marketing Creates VLAN 3 and names it Marketing
2900(vlan)#exit Applies changes and exits VLAN database mode
2900#  

2950 Series Switch

2950Switch#config t Enters global config mode
2950Switch(config)#vlan 10 Creates VLAN 10 and enters VLAN config mode for further definitions
2950Switch(config-vlan)#name Accounting Assigns a name to a VLAN
2950Switch(config-vlan)#exit Moves back to global config mode
2950Switch(config)#vlan 20 Creates VLAN 20 and enters VLAN config mode for further definitions
2950Switch(config-vlan)#name Sales Assigns a name to a VLAN
2950Switch(config-vlan)#exit Moves back to global config mode

Tip:

For the 2900 series switch, you must apply the changes to the VLAN database for the changes to take effect. You can also use the command apply in the VLAN database, which will apply the changes, but not exit the mode. Using the command to exit out of the VLAN database will not apply the changes to the VLAN database. You must use the command exit to exit the VLAN database and have the changes successfully applied.

Tip:

For the 2950 series switch, the use of the VLAN database is being phased out, in favor of creating VLANs in the manner demonstrated in the preceding command syntax. If you use the vlan database command at the 2950Switch# prompt, the 2950 IOS will tell you this but will still allow you to use commands the same as the 2900 series switch. Get used to this style; it is the method to be used on all future releases of switches.

Assigning Ports to VLANs

2900/2950 Series Switch

2900Switch#config t  
2900Switch(config)#int fa0/2 Moves to interface mode
2900Switch(config-if)#switchport mode access Sets switchport mode to access
2900Switch(config-if)#switchport access vlan 2 Assigns this port to VLAN 2
2900Switch(config-if)#int fa0/3 Moves to interface mode
2900Switch(config-if)#switchport mode access Sets switchport mode to access
2900Switch(config-if)#switchport access vlan 3 Assigns this port to VLAN 3
2900Switch(config-if)#exit Exits interface mode
2900Switch(config)#  

Assigning Ports Using the range Command (2950 Switch Only)

2950Switch(config)#int range fa 0/1 – 4 Enables you to set the same configuration para-meters on multiple ports at the same time. Note that there is a space before and after the hyphen
2950Switch(config-if-range)#switchport mode access Sets all ports to access mode
2950Switch(config-if-range)#switchport access vlan 10 Assigns all ports to VLAN 10

Saving VLAN Configurations

2900/2950 Series Switch

Any command entered in the VLAN database is automatically saved as long as you leave the VLAN database properly with the exit command, and not .

Switch#copy run start Saves the running-config to NVRAM

Erasing VLAN Configurations

2900/2950 Series Switch

2900Switch#delete flash:vlan.dat Removes entire VLAN database from Flash memory

Make sure there is no space between the colon (:) and the characters vlan.dat. You can potentially erase the entire contents of Flash memory with this command if the syntax is not correct

2900Switch#delete flash:  
Delete filename [ ]? vlan.dat Removes entire VLAN database from Flash memory
Delete flash:vlan.dat? [confirm] Press the ENTER key
2900Switch#
or  
2900Switch#config t  
2900Switch(config)#int fa 0/3  
2900Switch(config-if)#no switchport access vlan 3 Removes port from VLAN 3 and reassigns it to default VLAN 1
2900Switch(config-if)#exit  
2900Switch(config)#exit  
2900Switch#vlan database Enters VLAN database mode
2900(vlan)#no vlan 3 Removes only VLAN 2 from database
2900(vlan)#exit Applies changes and exits VLAN database mode

Note:

For any series switch, you cannot remove VLAN 1.

Troubleshooting VLANs

2900Switch#show vlan Displays the complete VLAN database
2900Switch#show vlan brief Displays a summary of the VLAN database
2900Switch#show interfaces Displays a summary of each interface, including speed and duplex settings
2900Switch#debug sw-vlan packets Displays information about VLAN packets a router has received but is not capable of supporting
post-author