Monday, February 10, 2014

Configure Vlan and VTP in switches on Cisco Packet Tracer

Create Vlan and Configure VTP for switches in Cisco Packet Tracer

Vlan means Virtual Local Area Network. Physically it looks same Network but Logically It's different. And that is why It is called Virtual LAN. Normally the End devices can communicate to the End devices belong to same Vlan but not to different Vlan. If End devices are connected to a switch, belong to two or more different Vlans, you'll need a trunk port to send the data to It's destination. You can do it by configuring VTP. VTP means VLAN Trunking Protocol. You need to add the connection with Cross Over Cable in between two Switches. And make those Interfaces to Trunk Port. After doing this, End Devices of Same Vlan can communicate to each other.



Now you may ask, how switches identifies a data send from which vlan and in which port It should forward, so that the data can reach to It's destination. Well, The data travel into the network(I mean while you've created Vlans) with tag. Checking that tag, switches Identifies the Source(where from the data came) of the Data and the Destination(where to send) of that Data.

Now Let's see, How to Configure VLAN & VTP.

Step 1: Create the following topology in Cisco Packet Tracer. vlan and vtp configuration  

Step 2: Configure all trunk ports(Switch to Switch connection). Go to the CLI of each Switch and enter Configuration Mode. Now enter to each Interface in where the other switch is connected. And type the following command. I did It in Server Switch on Interface Fastethernet 0/1

Switch(config-if)#switchport mode trunk


Step 3: Now configure VTP in each switch. There are three mode of VTP: Server, Client, Transparent. Server mode has privilege of Cteate, Delete & Edit; Client can't do anything and Transparent can also Create, Edit or Delete vlan. While you change anything in Server switch, all those changes will automatically updated in Client switches but Transparent switches won't be updated automatically, You'll need to do all the changes in Transparent manually. Similarly, while you change anything in Transparent switch, other switches won't be affected.

The following commands are same for three types of VTP mode. Only you've to change the vtp mode. The following command is to configure VTP on Server switch. Go to configure mode to do so.

Switch(config)#vtp mode server 
Device mode already VTP SERVER.
Switch(config)#vtp domain vinfospot.com
Changing VTP domain name from NULL to vinfospot.com
Switch(config)#vtp password pass123
Setting device VLAN database password to pass123
Switch(config)#
 
 
Step 4: Create vlan in server switch(es). Go to configure mode in Server Switch CLI and type following commands to create this three vlans.
Note: In the above topology you can see 3 different vlans. One is MGT which is vlan number 99 & used for management purpose. Second one is IT which belongs to vlan number 10. And the third and last one is Admin which belongs to vlan number 20.
 
Switch(config)#vlan 99
Switch(config-vlan)#name MGT
Switch(config-vlan)#exit
Switch(config)#vlan 10
Switch(config-vlan)#name IT
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name Admin
Switch(config-vlan)#exit
Switch(config)#
 
 
Step 5: Create vlans in Transparent Switch(es). As I said in Step 3, Any changes you made in Server switch will be updated in client switches automatically, but not in Transparent. So now you've to create vlans in Transparent Switch(es) in similar way of Step 4.

Switch(config)#vlan 99
Switch(config-vlan)#name MGT
Switch(config-vlan)#exit
Switch(config)#vlan 10
Switch(config-vlan)#name IT
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name Admin
Switch(config-vlan)#exit
Switch(config)#
 
 
Step 6: Assign IPs to MGT vlan SVI(Switch Virtual Interface) of each Switch. Go to CLI mode of each Switch and Enter into configure mode and Type following commands.
Note:
For Vlan 99, IP is: 192.168.99.0
For Vlan 10, IP is: 192.168.10.0
For Vlan 20, IP is: 192.168.20.0
In Server Switch
 
Switch(config)#interface vlan 99
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan99, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan99, changed state to up

Switch(config-if)#ip address 192.168.99.11 255.255.255.0
Switch(config-if)#no shut
 
 
Step 7: Assign vlan to switchport. For each Switch(es) which is(are) directly connected to End devices, go to CLI and Enter configure mode. Now enter into the Interface(s) where the PCs are connected. And type following commands. I showed It here for Client-1 switch.

Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface fastEthernet 0/6
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#
 
Above commands you can see I assign vlan 10 into Interface Fastethernet 0/5, because the PC connected to this Interface belongs to vlan 10. In the same way I assign vlan 20 into Interface Fastethernet 0/6.

Step 7: Now assign IPs in each and every End Devices. The following image is for assigning IP in MGT PC. vlan-n-vtp-ip-assign-in-pc

Now try to ping from a PC to another belongs to same vlan. If It replies successfully, It means you're done. Another thing, From MGT PC you will get reply of ping from Switches.

Thats It. Thank You! :-)

No comments:

Post a Comment