What are VLANs ?


 

Virtual Local Area Networks, or VLANs, are groups of devices on a LAN that are configured to communicate as if they were attached to the same wire. A VLAN is a broadcast domain, which is a group of devices that are able to communicate via a broadcast message. VLANs allow you to break up one physical switch into multiple virtual switches. Traffic is segmented from other traffic when it is placed in a VLAN. Traffic cannot communicate directly from one VLAN to another without a router or SVI(Switched Virtual Interfaces) on a layer 3 switch. Imagine your company, xyz inc., has three departments and your devices are spread out through multiple buildings. You don't want users in any one department to be able to communicate with the other departments. You can accomplish this with the use of three distinct VLANs. Without the use of VLANs, you would need to have a separate physical switch for each department to accomplish the same segmentation. 

VLANs are associated with IP networks. For example, all users associated with network 192.168.1.0/24 are a part of the same VLAN. In switched networks, VLANs get assigned to access ports to add it to the broadcast domain. In order for other switches to know how to forward traffic for the VLAN you need to tag traffic as it leaves one switch and enters the other switch. This tag is a 12-bit identifier known as the VLAN ID. This is why when you look in a switch there is only 4094 possible VLANs(2^12). The VLAN ID range is 1-4094. In order for VLANs to be extended to other switches you need to know the difference between access ports and trunk ports. Access ports are ports that belong to a single VLAN and trunk ports are ports that belong to multiple VLANs. Trunk ports have to tag each packet that leaves the port(unless its untagged). In order for this to work the switch has to keep a table that identifies the device(MAC address) and the VLAN/interface that the device is a part of. This is known as the TCAM table and contains MAC addresses, VLANs, Interfaces, etc. Each time you manually configure as an access port you associate that port with that VLAN.

#configure terminal

(config)# interface gi0/1

(config)# switchport mode access

(config)# switchport access vlan 25

(config)# interface gi0/2

(config)# switchport mode trunk

So what happens when the switch is sending traffic that does not belong to a VLAN ? This is the purpose of the native VLAN. The native VLAN is used for traffic that is sent or received that is untagged. To associate untagged traffic with a VLAN, configure the native VLAN on the trunk interface.

(config)# interface gi0/2

(config)# switchport trunk native vlan 10

I should mention that the standard for tagging traffic is 802.1q. Often called "dot1q" by those that live at the packet layer.



Comments

Popular posts from this blog

AWS Identity and Access Management(IAM)

AWS Virtual Private Clouds(VPCs)

IPSec VPN - Fundamentals