VLANs and Trunking
What does Virtual Local Area Network (VLAN) mean?
Virtual LAN is a Layer 2 technique which allows you to divide your physical network into logical segments.The most beneficial elements of a VLAN is that it removes latency in the network, which saves network resources and increases network efficiency. In addition, VLANs are created to provide segmentation and assist in issues like security, network management and scalability. Furthermore, traffic patterns can easily be controlled by using VLANs.
Let’s see how to configure a simple virtual LAN .
Configuration
Switch 1
|
Ethernet Ports
|
|
Vlan
10 Interface IP
|
192.168.10.1
|
1-10
|
Vlan
10 Desktop IP
|
192.168.10.100
|
|
Vlan
20 Interface IP
|
192.168.20.1
|
11-18
|
Vlan
20 Desktop IP
|
192.168.20.100
|
|
Vlan
20 Interface IP
|
192.168.30.1
|
19-23
|
Vlan
10 Desktop IP
|
192.168.30.100
|
VLAN Configuration
Step 1Create new VLANs 10, 20, 30 in Switch and assign an IP address to switched virtual interface or an SVI using the following sequence of configuration commands
To Create VLAN
Switch1(config)#vlan 10
Switch1(config-vlan)#name HR
Switch1(config-vlan)#vlan 20
Switch1(config-vlan)#name Sales
Switch1(config-vlan)#vlan 30
Switch1(config-vlan)#name IT
Assigning IP address to VLAN interface
Switch1(config)#interface vlan 10
Switch1(config-if)#ip address 192.168.10.1 255.255.255.0
Switch1(config-if)#no shutdown
Switch1(config)#interface vlan 20
Switch1(config-if)#ip address 192.168.20.1 255.255.255.0
Switch1(config-if)#no shutdown
Switch1(config)#interface vlan 30
Switch1(config-if)#ip address 192.168.30.1 255.255.255.0
Switch1(config-if)#no shutdown
Next step is to assign interfaces for VLANs 10,20,30 respectively
Switch1(config)#interface range fastEthernet 0/1-10
Switch1(config-if-range)#switchport mode access
Switch1(config-if-range)#switchport access vlan 10
Switch1(config-if-range)#exit
Switch1(config)#interface range fastEthernet 0/11-18
Switch1(config-if-range)#switchport mode access
Switch1(config-if-range)#switchport access vlan 20
Switch1(config-if-range)#exit
Switch1(config)#interface range fastEthernet 0/19-23
Switch1(config-if-range)#switchport mode access
Switch1(config-if-range)#switchport access vlan 30
Switch1(config-if-range)#exit
Vlan is configured and assigned interfaces for vlan.If you want to communicate between virtual LANs you need a enable ip routing in Layer 3 device.
To enable ip routing
Switch1(config)#ip routing
Test this Scenario
Do a ping test from vlan 10 to other Vlans or Vise Versa.Consider your office is extend and you have another Floor.
Now you need to extend the VLAN to the second floor. Here you need to configure another layer 3 switch (switch 2) with the same configuration of switch 1 and need to connect cables from VLAN 10 ,VLAN 20 and VLAN 30 to the respective ports of switch 2.
Here you are wasting 3 port in switch 1 and 3 ports in switch 2,so total 6 ports. Also you are laying 3 cables. If you increase the VLAN then you waste more ports and cables. To over come this ,the better way is to setup a trunk port as described in the diagram.
A trunk is a point-to-point link between two network devices that carries more than one VLAN over a single link and the process known as trunking. With VLAN trunking, you can extend your configured VLAN across the entire network.
In this demonstration am using port 24 as trunk port.
Configure the Switch 2 same as we done in switch 1 (VLAN Configuration-Step 1)
Switch 2
|
Ethernet Ports
|
|
Vlan
10 Interface IP
|
192.168.10.2
|
1-10
|
Vlan
10 Desktop IP
|
192.168.10.200
|
|
Vlan
20 Interface IP
|
192.168.20.2
|
11-18
|
Vlan
20 Desktop IP
|
192.168.20.200
|
|
Vlan
20 Interface IP
|
192.168.30.2
|
19-23
|
Vlan
10 Desktop IP
|
192.168.30.200
|
|
Trunk
Port
|
24
|
VLAN Trunking
Step 1Switch 1
Switch1(config)#interface fastEthernet 0/24
Switch1(config-if)#switchport mode trunk
Switch1(config-if)#switchport trunk allowed vlan 1-99
Switch 2
Switch2(config)#interface fastEthernet 0/24
Switch2(config-if)#switchport mode trunk
Switch2(config-if)#switchport trunk allowed vlan 1-99
Note : When you try to configure trunk port you might see following error
"An interface whose trunk encapsulation is Auto can not be configured to trunk mode" .To fix this you need set encapsulation to 802.1q using the following command in interface fastEthernet 0/24
Switch1(config-if)#switchport trunk encapsulation dot1q
This should fix your issue.
0 comments:
Post a Comment