Layer 2 bridging is a fundamental concept in networking that enables devices within the same VLAN (Virtual Local Area Network) to communicate as if they were on the same physical network. VLANs help to segment large networks into smaller, logical sub-networks, enhancing traffic isolation, security, and efficiency.
VLANs (Virtual Local Area Networks) logically group devices within a Layer 2 network, regardless of their physical location.
What is a VLAN?
Why Use VLANs?
VLAN IDs:
VLAN Frame Tagging:
Q-in-Q VLAN tagging (also called Provider Bridging) allows service providers to encapsulate customer VLAN tags within a provider's VLAN tag.
How It Works:
Use Case:
Configuration Example:
set interfaces ge-0/0/1 unit 0 encapsulation flexible-vlan-tagging
set interfaces ge-0/0/1 unit 0 vlan-id 100
encapsulation flexible-vlan-tagging: Allows adding multiple VLAN tags.vlan-id 100: Assigns the outer (provider) VLAN tag.Switches in Layer 2 networks use MAC (Media Access Control) addresses to forward traffic.
How MAC Learning Works:
Key Points:
Trunking allows a single link to carry traffic for multiple VLANs, enabling communication between VLANs across different switches.
What is a Trunk?
Common Use Cases:
How VLAN Tagging Works:
Configuration Example for a Trunk Port:
set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode trunk
set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members [ vlan10 vlan20 ]
interface-mode trunk: Configures the port as a trunk.vlan members [ vlan10 vlan20 ]: Allows VLANs 10 and 20 to traverse the trunk.Configuring VLANs involves creating VLANs and assigning ports to them.
Step 1: Create VLANs:
set vlans vlan10 vlan-id 10
set vlans vlan20 vlan-id 20
Step 2: Assign VLANs to Ports:
set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members vlan10
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members vlan20
Explanation:
vlan10 vlan-id 10: Creates VLAN 10 with ID 10.vlan20 vlan-id 20: Creates VLAN 20 with ID 20.ge-0/0/1 to VLAN 10.ge-0/0/2 to VLAN 20.Understanding the difference between access and trunk ports is fundamental for VLAN implementation.
Access Ports:
Configuration Example:
set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access
set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members vlan10
interface-mode access: Configures the port as an access port.vlan members vlan10: Assigns the port to VLAN 10.Trunk Ports:
Configuration Example:
set interfaces ge-0/0/2 unit 0 family ethernet-switching interface-mode trunk
set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members [ vlan10 vlan20 ]
interface-mode trunk: Configures the port as a trunk port.vlan members [ vlan10 vlan20 ]: Allows VLANs 10 and 20 to traverse the trunk.Private VLANs are used to provide additional isolation within a VLAN. They are common in service provider networks and data centers.
Key Concepts:
Use Case:
Configuration Example:
set vlans primary-vlan vlan-id 100
set vlans isolated-vlan vlan-id 101
set vlans isolated-vlan primary-vlan primary-vlan
set vlans community-vlan vlan-id 102
set vlans community-vlan primary-vlan primary-vlan
Proper VLAN design and management are crucial for performance, scalability, and security.
Configure a native VLAN for untagged traffic:
set interfaces ge-0/0/3 unit 0 family ethernet-switching native-vlan-id 999
set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members [ vlan10 vlan20 ]
native-vlan-id 999: Assigns VLAN 999 as the native VLAN for untagged traffic.A voice VLAN is a special VLAN dedicated to VoIP traffic. It ensures QoS (Quality of Service) for voice packets.
Configuration Example:
set vlans voice-vlan vlan-id 200
set interfaces ge-0/0/4 unit 0 family ethernet-switching voice-vlan vlan-id 200
When VLANs are not functioning as expected, consider the following steps:
Check if a port is correctly assigned to a VLAN:
show configuration interfaces ge-0/0/1
Ensure that the MAC address of connected devices is learned correctly:
show ethernet-switching table
Verify VLAN configuration and status on the switch:
show vlans
Ensure both ends of a trunk link are configured correctly and allow the same VLANs:
show interfaces terse
Layer 2 bridging allows devices within the same broadcast domain to communicate directly. Virtual LANs (VLANs) logically divide a physical Layer 2 network into smaller segments to improve traffic control, security, and scalability. VLANs are fundamental in enterprise and service provider networks.
VLANs can be categorized based on how membership is assigned. Understanding these types is useful for both configuration and troubleshooting in real-world scenarios and exams.
The most commonly used VLAN type.
Ports on a switch are manually assigned to a VLAN.
All devices connected to those ports become part of the assigned VLAN.
Simple to configure but less flexible in dynamic environments.
| Type | Description |
|---|---|
| MAC-Based VLAN | Assigns VLANs based on a device’s MAC address. |
| Protocol-Based VLAN | VLAN assignment based on the Layer 3 protocol (e.g., IPv4 vs. IPv6). |
Requires additional infrastructure like a VLAN Management Policy Server (VMPS) or custom configurations.
Useful in environments where devices move frequently (e.g., universities or hot-desk offices).
While VLANs operate at Layer 2 (Data Link Layer), communication between different VLANs must occur at Layer 3 (Network Layer).
Communication between different VLANs requires a Layer 3 device (e.g., a router or L3 switch) via Inter-VLAN Routing.
Inter-VLAN routing can be implemented:
Using a router-on-a-stick setup.
With Layer 3 switches that support SVI (Switched Virtual Interface).
set interfaces vlan unit 10 family inet address 192.168.10.1/24
set vlans vlan10 vlan-id 10 l3-interface vlan.10
vlan.10.| Topic | Key Point |
|---|---|
| VLAN Types | Includes Static (port-based), MAC-based, and protocol-based VLANs. |
| Layer 3 Relationship | VLANs require a router or Layer 3 switch to communicate across VLAN boundaries. |
What is the difference between an access port and a trunk port?
An access port carries traffic for a single VLAN, while a trunk port carries traffic for multiple VLANs using tagging.
Access ports connect end devices such as PCs or servers and transmit frames belonging to only one VLAN. Frames are sent untagged because the end device typically does not understand VLAN tags. Trunk ports connect switches or routers and carry traffic for multiple VLANs simultaneously. To identify which VLAN each frame belongs to, trunk ports add a VLAN tag using IEEE 802.1Q tagging. The receiving device reads the tag and forwards the frame within the correct VLAN. Misconfiguration of trunk ports is a common cause of connectivity issues, especially when VLAN IDs do not match between switches.
Demand Score: 80
Exam Relevance Score: 86
Why might VLAN traffic fail to pass across a trunk link?
Because the VLAN may not be allowed on the trunk or the VLAN IDs do not match.
Trunk links carry multiple VLANs between network devices. However, trunk configuration often restricts which VLANs are allowed to traverse the link. If a VLAN is not included in the allowed VLAN list, traffic from that VLAN will be dropped. Another common issue occurs when VLAN IDs differ between devices, causing frames to be associated with different broadcast domains. Troubleshooting typically involves verifying trunk configuration, allowed VLAN lists, and VLAN ID consistency across switches.
Demand Score: 77
Exam Relevance Score: 84
What is the purpose of VLAN tagging?
VLAN tagging identifies which VLAN a frame belongs to when multiple VLANs share a link.
When frames travel across trunk links, switches must differentiate traffic belonging to different VLANs. IEEE 802.1Q tagging inserts a 4-byte tag into the Ethernet frame header containing the VLAN ID and priority information. This tag allows receiving switches to correctly place frames into the appropriate VLAN. Without tagging, frames from multiple VLANs would become mixed on trunk links, breaking network segmentation.
Demand Score: 73
Exam Relevance Score: 83
What is the difference between a VLAN and a broadcast domain?
A VLAN creates a separate broadcast domain within a Layer-2 network.
A broadcast domain is a group of devices that receive broadcast frames sent by any device within the same network segment. VLANs logically divide a physical switch into multiple broadcast domains, isolating traffic between groups of devices. For example, devices in VLAN 10 cannot directly receive broadcasts from VLAN 20. This separation improves security, reduces broadcast traffic, and enables better network segmentation.
Demand Score: 71
Exam Relevance Score: 80