How do I create a VLAN?
Configuring VLANs can vary even between different models of Cisco switches. Your goals, no matter what the commands are, is to:
Create the new VLANs Put each port in the proper VLAN
Lets say we wanted to create VLANs 5 and 10. We want to put ports 2 & 3 in VLAN 5 (Marketing) and ports 4 and 5 in VLAN 10 (Human Resources). On a Cisco 2950 switch, here is how you would do it:
At this point, only ports 2 and 3 should be able to communicate with each other and ports 4 & 5 should be able to communicate. That is because each of these is in its own VLAN. For the device on port 2 to communicate with the device on port 4, you would have to configure a trunk port to a router so that it can strip off the VLAN information, route the packet, and add back the VLAN information.
What do VLANs offer?
VLANs offer higher performance for medium and large LANs because they limit broadcasts. As the amount of traffic and the number of devices grow, so does the number of broadcast packets. By using VLANs you are containing broadcasts. VLANs also provide security because you are essentially putting one group of devices, in one VLAN, on their own network.
Configuration of VTP client on switch B
SwitchB#vlan database SwitchB(vlan)#vtp client SwitchB(vlan)#vtp domain group1 SwitchB(vlan)#exit
Trunking with 802.1q Now create 802.1q trunk link between the two switches to allow communication between VLANs. On both switches, SwitchA and SwitchB type the following command with 802.1q at the fastethernet 0/1 interface. SwitchA(config)#configure terminal SwitchA(config)#interface fastethernet 0/1 SwitchA(config-if)#switchport mode trunk (enter in global configuration mode) (select the Ethernet 0 of port 1) (set port 1 as trunk port)
SwitchA(config-if)#switchport trunk encapsulation dot1q SwitchA(config-if)#end SwitchB(config)#interface fastethernet 0/1 SwitchB(config-if)#switchport mode trunk (exit from interface 1) (select the Ethernet 0 of port 1) (set port 1 as trunk port)
SwitchA(config-if)#switchport trunk encapsulation dot1q SwitchB(config-if)#end (exit from interface 1)
To verify that fastethernet 0/1 has been established as trunk port, type the show interface fastethernet 0/1 switchport at the privileged EXEC mode.
Although the VLAN definitions have migrated to the switch B using VTP, but it is necessary to assign ports to these VLANs on switch B.
Now assigning the ports 2 and 3 to VLAN 2, it must be done from the interface mode. Enter the following commands to add port 2 and 3 to VLAN 2.
SwitchB(config)#configure terminal SwitchB(config)#interface fastethernet 0/2 SwitchB(config-if)#switchport access vlan 2 SwitchB(config-if)#exit SwitchB(config)#interface fastethernet 0/3 SwitchB(config-if)#switchport access vlan 2 SwitchB(config-if)#exit
(enter in global configuration mode) (select the Ethernet 0 of port 2) (allot the membership of vlan 2) (exit from interface 2) (select the Ethernet 0 of port 3) (allot the membership of vlan 2) (exit from interface 3)
Now assigning the ports 4 and 5 to VLAN 3, enter the following commands to add port 4 and 5 to VLAN 3. SwitchB(config)#configure terminal SwitchB(config)#interface fastethernet 0/4 SwitchB(config-if)#switchport access vlan 3 SwitchB(config-if)#exit SwitchB(config)#interface fastethernet 0/5 SwitchB(config-if)#switchport access vlan 3 SwitchB(config-if)#exit (enter in global configuration mode) (select the Ethernet 0 of port 4) (allot the membership of vlan 3) (exit from interface 4) (select the Ethernet 0 of port 5) (allot the membership of vlan 3) (exit from interface 5)