Figure 14-1 shows the network topology for the configuration of VLANs on a 2900 series switch using the commands covered in this chapter.
This example shows the configuration of the switch only. Chapter 15, "VTP and Inter-VLAN Communication," covers configuration of the routers.
switch>en | Enters privileged mode |
switch#config t | Enters global configuration mode |
switch(config)#hostname 2900Switch | Sets the host name |
2900Switch(config)#no ip domain-lookup | Turns off checking for DNS entries on spelling mistakes |
2900Switch(config)#enable secret cisco | Sets the secret password to cisco |
2900Switch(config)#line con 0 | Enters console mode |
2900Switch(config-line)#logging synchronous | Informational lines will not affect the command being entered |
2900Switch(config-line)#login | Turns on password challenge for console mode |
2900Switch(config-line)#password class | Sets password to class |
2900Switch(config-line)#exit | Returns to global config mode |
2900Switch(config)#line vty 0 15 | Enters all 16 vty modes. The same commands will apply to all lines |
2900Switch(config-line)#login | Challenges a remote user for a password |
2900Switch(config-line)#password class | Sets the password to class |
2900Switch(config-line)#exit | Returns to global config mode |
2900Switch(config)#ip default-gateway 192.168.1.1 | Sets the default gateway for switch |
2900Switch(config)#int vlan1 | Enters the virtual interface VLAN 1 |
2900Switch(config-if)#ip address 192.168.1.2 255.255.255.0 | Sets the IP address of the switch |
2900Switch(config-if)#no shut | Turns on the interface |
2900Switch(config-if)#exit | Returns to global config mode |
2900Switch(config)#exit | Returns to privileged mode |
2900Switch#vlan database | Enters the VLAN database |
2900Switch(vlan)#vlan 10 name Sales | Creates VLAN 10 |
2900Switch(vlan)#vlan 20 name Engineering | Creates VLAN 20 |
2900Switch(vlan)#vlan 30 name Marketing | Creates VLAN 30 |
2900Switch(vlan)#exit | Applies VLAN information and exits |
2900Switch#config t | Enters global configuration mode |
2900Switch(config)#int fa0/2 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 10 | Assigns this port to VLAN 10 |
2900Switch(config-if)#int fa0/3 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 10 | Assigns this port to VLAN 10 |
2900Switch(config)#int fa0/4 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 10 | Assigns this port to VLAN 10 |
2900Switch(config-if)#int fa0/5 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 20 | Assigns this port to VLAN 20 |
2900Switch(config)#int fa0/6 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 20 | Assigns this port to VLAN 20 |
2900Switch(config-if)#int fa0/7 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 20 | Assigns this port to VLAN 20 |
2900Switch(config)#int fa0/8 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 20 | Assigns this port to VLAN 20 |
2900Switch(config-if)#int fa0/9 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 30 | Assigns this port to VLAN 30 |
2900Switch(config)#int fa0/10 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 30 | Assigns this port to VLAN 30 |
2900Switch(config-if)#int fa0/11 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 30 | Assigns this port to VLAN 30 |
2900Switch(config)#int fa0/12 | Moves to interface mode |
2900Switch(config-if)#switchport mode access | Sets the switchport mode to access |
2900Switch(config-if)#switchport access vlan 30 | Assigns this port to VLAN 30 |
2900Switch(config-if)# | Returns to privileged mode |
2900Switch#copy run start | Saves config to NVRAM |