My Blog List

Saturday, March 19, 2011

VLAN Configurations

What is a VLAN? 

A VLAN is a virtual LAN. In technical terms, a VLAN is a broadcast domain created by switches. Normally, it is a router creating that broadcast domain. With VLAN’s, a switch can create the broadcast domain. 

How can devices on different VLAN’s communicate?

Devices on different VLAN’s can communicate with a router or a Layer 3 switch. As each VLAN is its own subnet, a router or Layer 3 switch must be used to route between the subnets. 

What is a trunk port?

When there is a link between two switches or a router and a switch that carries the traffic of more than one VLAN, that port is a trunk port.



How to create a VLAN?

 According to above network , it used 1841 Router , 2950-24 switch and Pc s. 

First of all you can configure switch . 

Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 2                            // Create vlan and give vlan id
Switch(config-vlan)#name VLAN2        // You can assign vlan name as VLAN2
Switch(config)#vlan 3                           //
Create vlan and give vlan id
Switch(config-vlan)#name VLAN3       //You can assign vlan name as VLAN3
 According to this network you can create 3 vlan networks  .

vlan 1 is the default vlan .

After  creating  vlans you must assign PC s to specific vlans .

Switch(config)#interface fa0/2 // PC 0 is assign in interface fastEthernet 0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 2 // assign PC 0 to vlan 2

Same as this you must assign other PC s to each vlans.

Network address of 
                               vlan 1 -
                               vlan 2 -
                               vlan 3 -

When we move to Router configuration we must assign sub network for 3 vlans .

Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface fastEthernet 0/0.1       //  by giving 0/0.1 it creates sub network
Router(config-subif)#encapsulation dot1Q 1   // select vlan1
Router(config-subif)#ip address  // assign ip address for vlan 1

 encapsulation dot1Q
Allows you to use a router interface as a trunk port to a switch. This is also known as "Router on a stick" because the switch uses the router to route between VLANs.

 Same as vlan 1 we must configure other two vlans .

Configure trunk port

Then you must configure trunk port of switch . 

Switch(config)#interface fastEthernet 0/1     // go to interface mode of the fast Ethernet port of switch (which    connected to router)
Switch(config-if)#switchport trunk allowed vlan add 2   // add vlan 2 for  switchport trunk .

You can ping between different vlans or in same LAN .