Understanding VLAN operation in L2 and L3 Switches

Understanding VLAN operation in L2 and L3 Switches

## Introduction to VLAN#

VLAN is called as virtual local area network, used in Switches and it operates at Layer 2 and Layer 3. A VLAN is a group of hosts which communicate as if they were attached to the same broadcast domain, regardless of their physical location.

For example, all workstations and servers used by a particular workgroup team can be connected to the same VLAN, regardless of their physical connections to the network or the fact that they might be intermingled with other teams. VLANs have the same attributes as physical LANs, but you can group end stations even if they are not physically located on the same LAN segment.

{width="6.56290791776028in" height="2.733021653543307in"}

Figure 29‑1: Virtual local area network (VLAN)

A VLAN behaves just like a LAN in all respects but with additional flexibility. By using VLAN technology, it is possible to subdivide a single physical switch into several logical switches. VLANs are implemented by using the appropriate switch configuration commands to create the VLANs and assign specific switch interfaces to the desired VLAN.

Switches implement VLANs by adding a VLAN tag to the Ethernet frames as they enter the switch. The VLAN tag contains the VLAN ID and other information, which is determined by the interface from which the frame enters the switch. The switch uses VLAN tags to ensure that each Ethernet frame is confined to the VLAN to which it belongs based on the VLAN ID contained in the VLAN tag. The VLAN tags are removed as the frames exit the switch on the way to their destination.

Any port can belong to a VLAN, and unicast, broadcast, and multicast packets are forwarded and flooded only to end stations in that VLAN. Each VLAN is considered a logical network. Packets destined for stations that do not belong to the VLAN must be forwarded through a router.

In the below screenshot, the stations in the development department are assigned to one VLAN, the stations in the marketing department are assigned to another VLAN, and the stations in the testing department are assigned to another VLAN.

{width="6.416666666666667in" height="3.21875in"}

Figure 29‑2: Hosts in one VLAN need to communicate with hosts in another VLAN This is known as Inter-VLAN routing

VLANs divide broadcast domains in a LAN environment. Whenever hosts in one VLAN need to communicate with hosts in another VLAN, the traffic must be routed between them. This is known as Inter-VLAN routing. This can be possible by using L3 switch.

### What is a layer 3 switch?#

Layer 3 switch (also known as a multi-layer switch) is a multi-functional device that have the same functionality like a layer 2 switch, but behaves like a router when necessary. It's generally faster than a router due to its hardware-based routing functions, but it's also more expensive than a normal switch.

## Network Setup#

Open NetSim and click on Examples > Experiments > Advanced Routing >Understanding VLAN operation in L2 and L3 Switches then click on the tile in the middle panel to load the example as shown in below Figure 29‑3.

{width="6.4256955380577425in" height="3.4479166666666665in"}

Figure 29‑3: List of scenarios for the example of Understanding VLAN operation in L2 and L3 Switches

NetSim UI displays the configuration file corresponding to this experiment as shown below Figure 29‑4.

{width="4.19255905511811in" height="2.8372900262467193in"}

Figure 29‑4: Network set up for studying the Intra-VLAN

## Procedure#

Intra-VLAN

Intra-VLAN is a mechanism in which hosts in same VLAN can communicate to each other.

The following set of procedures were done to generate this sample:

Step 1: A network scenario is designed in NetSim GUI comprising of 3 Wired Nodes and 1 L2 Switch in the "Internetworks" Network Library.

Step 2: L2 Switch 1 Properties are configured as follows Table 29‑1.

L2 Switch 1

Interface ID VLAN Status VLAN ID VLAN Port Type

Interface_1 TRUE 2 Access _Port

Interface_2 TRUE 2 Access _Port

Interface_3 TRUE 3 Access _Port

Table 29‑1: L2 Switch 1 Properties

In all the INTERFACE (ETHERNET) > DATALINK LAYER Properties of L2 Switch 1, "VLAN Status" is set to TRUE.

{width="4.119851268591426in" height="1.3097790901137358in"}

Figure 29‑5: DATALINK LAYER Properties of L2 Switch 1

Now click on "Configure VLAN" option and the VLAN 2 fields are entered as shown below Figure 29‑6.

{width="5.015307305336833in" height="3.916868985126859in"}

Figure 29‑6: VLAN Configure window

To add a new entry after entering the required fields, click on the ADD button.

{width="4.978437226596675in" height="3.8854166666666665in"}

Figure 29‑7: Configuring VLAN Properties in VLAN 2

To configure another VLAN, click on the "+" symbol located in the top.

{width="4.864583333333333in" height="3.796557305336833in"}

Figure 29‑8: Configuring VLAN Properties in VLAN 3

And then we can add the entry to it.

Step 3: Enable the plots and run simulation for 10 Seconds and observe the throughputs.

Inter-VLAN

NetSim UI displays the configuration file corresponding to this experiment as shown below Figure 29‑9.

{width="5.109471784776903in" height="3.477280183727034in"}

Figure 29‑9: Network set up for studying the Inter-VLAN

The following set of procedures were done to generate this sample:

Step 1: A network scenario is designed in NetSim GUI comprising of 5 Wired Nodes and 1 L3 Switch in the "Internetworks" Network Library.

Step 2: The Wired Node properties are set as per the below table Table 29‑2.

Node Wired Node2 Wired Node3 Wired Node4 Wired Node5 Wired Node6

          I/f1_Ethernet   I/f1_Ethernet   I/f1_Ethernet   I/f1_Ethernet   I/f1_Ethernet


IP Address 10.0.0.4 10.1.0.4 11.2.0.4 11.3.0.4 11.4.0.4

Default 10.0.0.3 10.1.0.3 11.2.0.3 11.3.0.3 11.4.0.3 Gateway

Table 29‑2: Wired Node properties

Step 3: The L3 Switch 1 Properties are set as per the below table

L3 I/f1_Ethernet I/f2_Ethernet I/f3_Ethernet I/f4_Ethernet I/f5_Ethernet Switch

       IP Address      IP Address      IP Address      IP Address      IP Address


L3 10.0.0.3 10.1.0.3 11.2.0.3 11.3.0.3 11.4.0.3 Switch 1

Table 29‑3: L3 Switch 1 Properties

L3 Switch 1

Interface ID VLAN Status VLAN ID VLAN Port Type

Interface_1 TRUE 2 Access _Port

Interface_2 TRUE 2 Access _Port

Interface_3 TRUE 3 Access _Port

Interface_4 TRUE 3 Access _Port

Interface_5 TRUE 3 Access _Port

Table 29‑4: VLAN configurations Properties

The VLAN configurations done are shown as follows:

{width="4.271048775153106in" height="3.3333333333333335in"}

Figure 29‑10: Configuring VLAN Properties in VLAN 2

{width="4.297740594925634in" height="3.3541666666666665in"}

Figure 29‑11: Configuring VLAN Properties in VLAN 3

Step 4: Enable plots and run simulation for 10 seconds and observe the throughputs.

## Output and Inference for Intra-VLAN#

Throughput (Mbps)

Application 1 0.58

Application 2 0

Table 29‑5: Results Comparison

The throughput for 2^nd^ application is zero because the source and destination is in different VLANs, thereby traffic flow or communication between 2 VLANs using Layer 2 switch is not possible. To overcome this problem, an L3 switch is used.

## Output and Inference for Inter-VLAN#

Throughput (Mbps)

Application 1 0.58

Application 2 0.58

Application 3 0.58

Table 29‑6: Results Comparison

In this case, application1 is in VLAN2, application2 is in VLAN3 and application 3 is in between VLAN2 and VLAN3. From the above results, the throughput for application 3 (different VLANs) is nonzero, because of using L3 switch. So, communication between 2 VLANs is possible using L3 Switch.