VLAN Technologies
Virtual LANs: creating logical network segments and VLAN tagging protocols.
The Problem with a "Flat" Network
Imagine a growing company in a single large office space. Initially, with just a few employees, a simple network with one or two interconnected switches works perfectly. Every computer is plugged in, and everyone can communicate with everyone else. This type of network is known as a flat network.
As the company expands, however, this simple design starts to show significant problems:
- Broadcast Storms & Performance Degradation: In an Ethernet network, some types of traffic, known as broadcasts, are sent to every single device. A broadcast frame is like a general announcement made over an office intercom: everyone has to stop and listen, even if the message isn't for them. As more devices are added, the amount of broadcast traffic (e.g., from ARP requests) increases. This can lead to a "broadcast storm," where the network is so busy processing these announcements that the performance for useful data transmission plummets. All devices on a flat network are part of the same .
- Lack of Security: In a flat network, there is no inherent separation between devices. An employee in the Accounting department can easily see network resources in the Engineering department. A malicious user or a compromised machine on one part of the network could potentially access or disrupt traffic across the entire company.
- Organizational Inflexibility: What if you need to move an employee from the Sales team on the first floor to a desk on the second floor? In a physically segmented network, this would require re-cabling their computer into a different physical switch dedicated to the Sales department. This is expensive, time-consuming, and doesn't scale. The network's physical layout dictates its logical structure.
The solution to these problems is to break the single large broadcast domain into multiple smaller, logically isolated ones, without having to buy and install separate physical hardware for each group. This is the magic of VLANs.
What is a VLAN? Creating Virtual Networks
A VLAN, or , is a technology that allows you to take a single physical LAN and logically segment it into multiple separate broadcast domains.
Think of a large physical office building as your physical network infrastructure (cables and switches). A VLAN is like logically assigning different departments (e.g., Sales, Engineering, HR) to different virtual "floors" within that same building. Even though an employee from Sales and an employee from Engineering might be sitting right next to each other and plugged into the same physical switch, the VLAN configuration makes it as if they are on completely separate floors. They cannot communicate directly, and a broadcast announcement made on the "Sales floor" will not be heard on the "Engineering floor".
How VLANs Work: Port Assignments and Tagging
The magic of VLANs is implemented within intelligent network switches. The switch is responsible for keeping track of which devices belong to which VLAN and ensuring that traffic does not cross between them. This is achieved through two primary concepts: port assignments and frame tagging.
1. VLAN Port Assignment (Access Ports)
The most basic way to create a VLAN is by assigning each port on a switch to a specific VLAN. A port configured this way is called an access port.
- An access port belongs to only one VLAN.
- It is typically used to connect end devices like computers, printers, or IP phones to the network.
- When a frame enters an access port, the switch assumes it belongs to the VLAN assigned to that port.
- The switch will only forward that frame to other ports that are assigned to the same VLAN. It will never forward it to a port belonging to a different VLAN.
For example, you could configure ports 1-8 on a switch to be in VLAN 10 (Sales) and ports 9-16 to be in VLAN 20 (Engineering). A computer plugged into port 1 can communicate freely with a computer on port 5, but it cannot communicate at all with a computer on port 10, even though they are on the same physical switch.
2. Inter-Switch Communication: Trunks and VLAN Tagging
Assigning ports works great on a single switch, but what happens when your network has multiple switches? How does Switch A know that a frame coming from Switch B belongs to VLAN 10 and not VLAN 20? This is solved using trunk ports and VLAN tagging.
- A is a special type of port designed to connect switches to other switches, routers, or servers.
- Unlike an access port, a trunk port is not assigned to a single VLAN. Instead, it is configured to carry traffic for multiple VLANs at the same time.
- To keep track of which frame belongs to which VLAN as it crosses the trunk link, the switch adds a special "tag" to each frame before it leaves the trunk port. The receiving switch reads the tag, knows which VLAN the frame belongs to, and can then forward it correctly to access ports in that VLAN.
The IEEE 802.1Q Standard
The industry-standard protocol for VLAN tagging is IEEE 802.1Q. It defines how the tag is added to the Ethernet frame. The 802.1Q tag is a 4-byte (32-bit) field inserted into the Ethernet frame header between the Source MAC address and the EtherType/Length field. This insertion increases the maximum frame size from 1518 to 1522 bytes.
[ Destination MAC ] [ Source MAC ] [ 802.1Q Tag ] [ EtherType ] [ Data Payload ] [ FCS ]
The 4-byte tag itself contains:
- Tag Protocol Identifier (TPID): A 16-bit field with a value of
0x8100that identifies the frame as an 802.1Q tagged frame. - Priority Code Point (PCP): A 3-bit field used for Quality of Service (QoS), allowing traffic to be prioritized (e.g., giving voice traffic higher priority than email).
- Drop Eligible Indicator (DEI): A 1-bit field that can be used to indicate frames that can be dropped during times of network congestion.
- VLAN Identifier (VID): A 12-bit field which specifies the VLAN to which the frame belongs. With 12 bits, it allows for possible VLANs, although some IDs are reserved.
The Native VLAN: A Special Case for Trunks
One special concept related to 802.1Q trunk links is the Native VLAN. A trunk port must have one designated Native VLAN (by default, it's usually VLAN 1). The key rule for the Native VLAN is:
Traffic belonging to the Native VLAN is transmitted without a VLAN tag across the trunk link.
When a switch receives an untagged frame on a trunk port, it assumes that the frame belongs to the Native VLAN configured for that port. This feature was designed for backward compatibility, for example, to allow communication with older devices or hubs that do not understand VLAN tags. For security reasons, it is a best practice for administrators to change the Native VLAN from the default VLAN 1 to an unused VLAN and to ensure it is configured identically on both ends of the trunk link to avoid security vulnerabilities and unexpected network behavior.
The Benefits of Using VLANs
Implementing VLANs provides a powerful set of tools for network administrators, directly addressing the limitations of flat networks.
- Improved Performance and Broadcast Control: By breaking a large network into smaller broadcast domains, VLANs drastically reduce the amount of broadcast traffic each device has to process. A broadcast from a device in VLAN 10 is only sent to other devices in VLAN 10. This contains the "noise," freeing up bandwidth and CPU cycles on devices in other VLANs, which significantly improves overall network performance.
- Enhanced Security: VLANs provide traffic isolation at Layer 2. Devices in different VLANs cannot communicate directly. This means sensitive data from the Finance department (VLAN 30) is completely invisible to the Marketing department (VLAN 40) by default, even if they share the same physical switches. It's a fundamental first step in securing a network.
- Increased Flexibility and Scalability: VLANs separate the logical network structure from the physical layout. An employee can move their computer to any office on any floor, and as long as the new network port is assigned to their correct VLAN by the administrator, they will remain part of their departmental network. This makes moves, adds, and changes much simpler and cheaper. You can also easily create new VLANs for new projects or teams without having to run new cables.
- Simplified Administration: Grouping users and devices into logical VLANs simplifies network management. Policies for security, QoS, or access control can be applied to an entire VLAN at once, rather than having to configure each device individually.