Saturday, 28 May 2011

VLAN Example with using VTP (Virtual Trunking Protocol)







In this lesson we will learn to create VLAN and try to connect two different VLAN with help of Virtual trunking protocol.


I take four PC on one Switch for example and create two different department that is MARKETING AND IT.

VLAN 1 is the default value and we can not select that. You can select from 2 to 1005.

Following command is to create different department.
S1

S1(config)#vla
S1(config)#vlan 2
S1(config-vlan)#na
S1(config-vlan)#name MARKETING
S1(config-vlan)#^Z



S1(config)#vlan 3
S1(config-vlan)#na
S1(config-vlan)#name IT
S1(config-vlan)#^Z

You can check VLAN by typing "show vlan brief"

S1#show vlan brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                               active    Fa0/1, Fa1/1, Fa2/1, Fa3/1
                                                Fa4/1, Fa5/1
2    MARKETING                  active   
3    IT                                      active   
1002 fddi-default                     active   
1003 token-ring-default           active   
1004 fddinet-default                active   
1005 trnet-default                    active  


Now you will add vlan 2 that is MARKETING department will be added on pc1 and pc2.

S1(config)#interface fa
S1(config)#interface fastEthernet 0/1
S1(config-if)#swi
S1(config-if)#switchport acc
S1(config-if)#switchport access vl
S1(config-if)#switchport access vlan 2
S1(config-if)#^Z 


S1(config)#interface fastEthernet 1/1
S1(config-if)#swi
S1(config-if)#switchport acc
S1(config-if)#switchport access vla
S1(config-if)#switchport access vlan 2
S1(config-if)#^Z

 Now you will add vlan 3 that is IT department will be added on pc1 and pc2.

S1(config)#interface fa
S1(config)#interface fastEthernet 2/1
S1(config-if)#swi
S1(config-if)#switchport acc
S1(config-if)#switchport access po
S1(config-if)#switchport access vl
S1(config-if)#switchport access vlan 3
S1(config-if)#^Z

S1(config)#interface fastEthernet 3/1
S1(config-if)#swi
S1(config-if)#switchport acc
S1(config-if)#switchport access vla
S1(config-if)#switchport access vlan 3

S1(config-if)#^Z



Now you can check vlan by using same command as we used it.

S1#show vlan brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                            active    Fa4/1, Fa5/1
2    MARKETING               active    Fa0/1, Fa1/1
3    IT                                   active    Fa2/1, Fa3/1
1002 fddi-default                  active   
1003 token-ring-default        active   
1004 fddinet-default             active   
1005 trnet-default                active   


Now on this VLAN only same department PC can contact each other that is IT  pc only contact same department pc not MARKETING department.

You can see following.

In this Image pc1 try to ping pc2 which is on same department.




Now If we try to ping PC1 to PC3 which is MARKETING TO IT then we can't.



Now you can do the same on other Switch that is Switch 2.


Now after configure it connect both Switch and run the trunk command as following on both side.

S1(config)#interface fa
S1(config)#interface fastEthernet 4/1
S1(config-if)#swi
S1(config-if)#switchport mo
S1(config-if)#switchport mode tr
S1(config-if)#switchport mode trunk
S1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet4/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet4/1, changed state to up
S1(config-if)#^Z 


After applying this command on both side you can connect same department PC on different VLAN.






I hope you will enjoy it, If you have any doubt then get back to me.



No comments: