NetLabT2_L1 & L2
NetLabT2_L1 & L2
Level: 4
Faculty of Engineering
Networks Lab
Virtual LAN
Lect 1 & 2
A VLAN is a virtual LAN that allows you to segment your network without the need for physical
segmentation logically. VLANs are very flexible and can be used to provide security, flexibility, and
performance benefits. VLANs work by encapsulating Ethernet frames with a VLAN header that
contains the VLAN ID. This ID is used to identify which devices are on which VLAN.
VLANs are created by adding switch ports to a particular VLAN. Devices on the same VLAN can
communicate with each other without the need for a router. By default, all devices are assigned to
VLAN 1, known as the default VLAN.
❖ Implementing VLAN reduces CPU overhead on each device and improves host performance, by
reducing the number of devices that send broadcast frames.
❖ Implementing VLAN enhances network security. A malicious user can no longer just plug
their workstation into any switch port and sniff the network traffic using a packet sniffer.
❖ Implementing VLAN creates more flexible designs that group users by department, or by
groups that work together, instead of by physical location
Ѻ VLAN ranges:
VLAN ID: The most critical component of the VLAN tag is the VLAN Identifier (VLAN ID), a 12-
bit field. The VLAN ID is used to identify the specific VLAN to which the frame belongs. This
identifier ranges from 1 to 4095, with some IDs reserved for specific purposes.
▪ VLAN 0, 4095: These are reserved VLAN which cannot be seen or used.
▪ VLAN 1: It is the default VLAN of switches. By default, all switch ports are in VLAN. This
VLAN can’t be deleted or edit but can be used.
▪ VLAN 2-1001: This is a normal VLAN range. We can create, edit and delete these VLAN.
▪ VLAN 1002-1005: These are CISCO defaults for fddi and token rings. These VLAN can’t be
deleted.
▪ Vlan 1006-4094: This is the extended range of Vlan.
Ѻ Configuration
Can simply create VLANs by simply assigning the vlan-id and Vlan name.
#switch1(config)#vlan 2
#switch1(config-vlan)#vlan accounts
Switch(config)#int fa0/0
VLAN Configuration
Switch>enable
Switch# configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#name ENG
Switch(config-vlan)# exit
Switch(config)#vlan 20
Switch(config-vlan)#name IT
Switch(config-vlan)#exit
Switch# show vlan
Switch# configure terminal
Example:
֎ The configuration
Switch>enable
Switch# configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#name Chemistry_Lab
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name Physics_Lab
Switch(config-vlan)#exit
❖ VLAN Trunking
Trunking and Frame Forwarding: Trunking, enabled by IEEE 802.1Q, allows switches to
transmit frames from multiple VLANs over a single physical link. Each frame is tagged before
transmission. On the receiving end, switches extract the VLAN tag, allowing them to direct the
VLAN Tagging: When a switch receives an Ethernet frame that needs to be transmitted across a
trunk link or to a device in a different VLAN, it adds the appropriate VLAN tag to the frame’s
header. This tag encapsulates the frame with the necessary VLAN information.
SW2> enable
SW2# configure terminal
SW2(config)# interface gigethernet 0/1
SW2(config-if)# switchport trunk encapsulation ?
dot1q Interface uses only 802.1q trunking encapsulation when trunking
isl Interface uses only ISL trunking encapsulation when trunking
negotiate Device will negotiate trunking encapsulation with peer on interface
֎ The configuration
In SW1
SW1> enable
SW1# configure terminal
SWl(config)# vlan 10
SWl(config-vlan)# exit
SWl(config)# vlan 11
SWl(config-vlan)# exit
SWl #conf t
SWl (config)#int vlan 1
SWl (config-if)#ip add 192.168.1.1 255.255.255.0
SWl (config-if)#no shutdown
SWl (config-if)#int vlan 10
SWl (config-if)#ip add 192.168.2.1 255.255.255.0
SWl (config-if)#no shutdown
SWl (config-if)#int vlan 11
SWl (config-if)#ip add 192.168.3.1 255.255.255.0
SWl (config-if)#no shutdown
SW2> enable
SW2# configure terminal
SW2(config)# vlan 10
SW2(config-vlan)# exit
SW2(config)# vlan 11
SW2(config-vlan)# exit
֎ Native VLAN
A native VLAN is a special VLAN whose traffic traverses on the 802.1Q trunk without any VLAN
tag. A native VLAN is defined in 802.1Q (it supports untagged traffic while inter-switch link
doesn’t support untagged traffic.) trunk port standard which supports traffic coming from several
VLANs as well as the traffic that doesn’t come from a VLAN. The native VLAN is per trunk per
switch configuration. The 802.1Q trunk port assigns untagged traffic on a native VLAN. That is,
the native VLAN detects and identifies traffic coming from each end of a trunk link. By default, the
native VLAN is VLAN 1, but it can be changed to any number such as VLAN 10, VLAN 20,
VLAN 99, etc.
Switch(config)#int g0/1
Switch(config-if)# switchport trunk native vlan 10
Modification of The default VLAN is always VLAN 1, By default, Native VLAN is VLAN 1, but it
VLAN and it can’t be changed. can be changed to any VLAN.
Default VLAN is specified through the Native VLAN is specified through the
Operand
VLAN operand command. NATIVE operand command.
Disabling of It is not possible to disable Default
It is possible to disable VLAN.
VLAN VLAN.
Encapsulation
It supports .1Q as well as ISL. It only supports .1Q.
type
Tagging is allowed in Native VLAN if
Tagging Tagging is allowed in default VLAN.
required but it is Untagged by default.
DTP, is a trunking protocol that is developed and proprietary to Cisco which is used to
automatically negotiate trunks between Cisco switches. Trunk negotiations are managed by DTP
only if the port is directly connected to each other.
The scenarios in which the switch interface will either become a trunk or access interface.
Dynamic Dynamic
trunk access
Auto desirable
Dynamic Auto access trunk trunk access
VTP (VLAN Trunking Protocol) is a Cisco proprietary protocol used by Cisco switches to
exchange VLAN information. With VTP, you can synchronize VLAN information (such as VLAN
ID or VLAN name) with switches inside the same VTP domain. A VTP domain is a set of trunked
switches with the matching VTP settings (the domain name, password and VTP version). All
switches inside the same VTP domain share their VLAN information with each other.To better
understand the true value of VTP, consider an example network with 100 switches. Without VTP, if
you want to create a VLAN on each switch, you would have to manually enter VLAN configuration
commands on every switch! VTP enables you to create the VLAN only on a single switch. That
switch can then propagate information about the VLAN to every other switch on the network and
cause other switches to create it. Likewise, if you want to delete a VLAN, you only need to delete it
on one switch, and the change is automatically propagated to every other switch inside the same
VTP domain.
Requirements – There are some requirements for VTP to communicate VLAN information
between switches. These are:
1. The VTP version must be same on the switches user wants to configure
2. VTP domain name must be same on the switches
3. One of the switches must be a server
4. Authentication should match if applied
• Server – The switches are set to this mode by default. This mode allows you to create, add and
delete VLANs. The changes you want to make should be done in this mode. Any changes that are
done on this mode(on a particular switch) will be advertised to all the switches that are in the same
VTP domain. In this mode, the configuration are saved in NVRAM.
֎ Delete VLANs
Switch# erase startup-config
Switch# dir flash:
Switch # delete vlan.dat
Inter-VLAN routing
Inter-VLAN routing is the ability to route, or send, traffic between VLANs that are normally
blocked by default. Switches and VLANs work at the MAC address Layer (Layer 2). Traffic can’t
be routed between VLANs at Layer 2 based on MAC addresses. Therefore, routers (or Layer 3
switches) that use IP addresses (Layer 3) are required for inter-VLAN routing. Inter VLAN Routing is
the process of forwarding network traffic from one VLAN to another VLAN using a router. As we know
that, VLAN trunk allows you to communicate between two or more same VLAN on different switches. Same
like this, Inter VLAN routing allows you to communicate between two or more completely different VLAN
in the same switch or other with the help of layer device Router.
• Traditional Method
• Router on stick
• Inter VLAN in layer 3 switch
1- Traditional Method
This is an old method and not in use nowadays. In this method, you need separate physical
interfaces for each VLAN. For example, if there is 10 VLAN then your router must have 10
physical ports to configure Inter VLAN. For this reason, it is also cost-effective.
2- Router on a stick
Instead of this, you can add all the VLAN in the single port of a router itself by creating virtual
subinterfaces. (eg: f0/0.1, f0/0.2, f0/0.3, etc)
Example:
The configuration
In switch
Switch#enable
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#name ENG
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name IT
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#name Cyber
Switch(config-vlan)#exit
Switch#conf terminal
Switch(config)#interface gig 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport nonegotiate
Switch(config-if)#end
Switch#show interface trunk
Switch#write
In Router
Router>en
Router#conf t
Router(config)#int g0/1
Router(config-if)#no shut
Router(config-if)#exit
Router(config)#int g0/1.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip add 192.168.10.1 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#int g0/1.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip add 192.168.20.1 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#int g0/1.30
Router(config-subif)#encapsulation dot1Q 30
Router#configure terminal
Router(config)#ip dhcp pool Netvlan10
Router(dhcp-config)#network 192.168.10.0 255.255.255.0
Router(dhcp-config)#default-router 192.168.10.1
Router(dhcp-config)#exit
Router(config)#ip dhcp excluded-address 192.168.10.1
This method allows you to configure Inter VLAN Routing in the switch itself. But, for this, you
need layer 3 switches. You cannot configure Inter VLAN on layer 2 switch.
A multilayer switch is a network device that has the ability to operate at higher layers of the OSI
reference model, unlike the Data Link Layer (DLL) traditionally used by switches. A multilayer
switch can perform the functions of a switch as well as that of a router at incredibly fast speeds. A
switch traditionally inspects frames, while a multilayer switch inspects deeper into the protocol
description unit (at packet or even at segment level). Multilayer switches use ASIC hardware
circuits to perform routing functions. This differs from typical routers, which reside on a
microprocessor and use applications running on it to perform their routing operations.