Layer 2 switching and VLANs are foundational concepts in networking.
Layer 2 switching operates at the Data Link Layer (Layer 2) of the OSI model. Its main job is to forward data (frames) between devices in the same network segment based on their MAC addresses.
Learning MAC Addresses:
AA:BB:CC:DD:EE:FF arrives on port 1, the switch learns that AA:BB:CC:DD:EE:FF is reachable via port 1.Forwarding Frames:
Avoiding Loops:
A Virtual Local Area Network (VLAN) is a way to divide a single physical network into multiple logical networks. Devices in the same VLAN can communicate with each other as if they are on the same physical network, even if they are not.
Switches use the following components for Layer 2 operations:
Frames are units of data exchanged at Layer 2. The switch processes frames as follows:
Switch ports can be configured for VLANs in several ways:
Devices in different VLANs cannot communicate by default. Inter-VLAN routing is required to enable communication between VLANs. This is done using:
Juniper’s configuration model differs significantly from Cisco's flat-style VLAN configuration. VLANs and Layer 2 forwarding are configured under structured hierarchies using logical interfaces (called "units") and families.
To assign a physical interface to a VLAN in Junos:
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 SALES
ethernet-switching: Enables Layer 2 bridging on the interface.
interface-mode access: Makes the port an access port.
vlan members SALES: Assigns the interface to the VLAN named "SALES".
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 [ SALES HR ]
VLANs themselves must be defined under the vlans hierarchy:
set vlans SALES vlan-id 10
While traditional enterprise switching uses ethernet-switching family, bridge-domains are used in provider-style Layer 2 VPNs and advanced VLAN separation scenarios.
A bridge domain is a logical Layer 2 broadcast domain that may contain one or more VLANs or interfaces.
set bridge-domains BD-100 domain-type bridge
set bridge-domains BD-100 vlan-id 100
set bridge-domains BD-100 interface ge-0/0/1.0
This structure is typically used when implementing EVPN, VPLS, or routing instances that require Layer 2 segmentation without using ethernet-switching.
While not always directly tested, bridge domain terminology may appear in configuration recognition questions.
You should understand that bridge-domain represents a more flexible, service-provider style L2 segment than basic vlan.
In service provider environments, it's often necessary to map customer VLANs (C-VLANs) into provider VLANs (S-VLANs), a process known as VLAN translation or VLAN mapping.
This is a subset of QinQ (802.1ad) tunneling.
Not heavily tested in JN0-351, but understanding the purpose helps when encountering QinQ-related terms.
| Customer Side | Service Provider Side |
|---|---|
| C-VLAN (e.g., 100) | S-VLAN (e.g., 2000) |
Packets are encapsulated with an additional 802.1Q tag, creating a double-tagged frame.
set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan-id 100
set interfaces ge-0/0/1 unit 0 input-vlan-map push dot1q vlan-id 2000
In Juniper, Inter-VLAN Routing is performed using IRB (Integrated Routing and Bridging) interfaces, which combine Layer 2 and Layer 3 functionality.
An IRB interface is used as the Layer 3 gateway for VLANs.
It enables routing between VLANs using a virtual interface.
set vlans SALES vlan-id 10
set vlans SALES l3-interface irb.10
set interfaces irb unit 10 family inet address 192.168.10.1/24
irb.10 is the logical Layer 3 interface bound to VLAN 10.
Each VLAN requiring Layer 3 routing must be assigned a unique IRB unit.
In multiple-choice questions, IRB interfaces are Juniper's equivalent of SVI (Switched Virtual Interfaces) in Cisco.
You should be able to identify irb.10 as the default gateway for VLAN 10.
| Feature | Purpose | Junos Term / Feature |
|---|---|---|
| VLAN assignment | Bind interfaces to VLANs | family ethernet-switching |
| Bridge domains | SP-style L2 segmentation | bridge-domains hierarchy |
| VLAN translation | Customer-to-provider VLAN mapping | input-vlan-map, QinQ |
| IRB | Inter-VLAN routing (L3 gateway) | irb.10, l3-interface |
How do I configure a trunk port on a Juniper EX switch that allows multiple VLANs?
Configure the interface with port-mode trunk and assign VLAN members under the interface.
In JunOS, trunk ports carry traffic from multiple VLANs. The interface must be placed in trunk mode and explicitly allowed VLAN IDs. For example:
set interfaces ge-0/0/10 unit 0 family ethernet-switching port-mode trunk
set interfaces ge-0/0/10 unit 0 family ethernet-switching vlan members [10 20 30]
This allows VLANs 10, 20, and 30 to traverse the trunk. If the VLAN is not listed, the switch drops the frames. A common troubleshooting issue is forgetting to allow the VLAN on both sides of the trunk.
Demand Score: 82
Exam Relevance Score: 88
What is the difference between access mode and trunk mode on a Juniper switch?
Access mode carries traffic for a single VLAN, while trunk mode carries traffic for multiple VLANs.
Access ports connect end devices such as PCs or printers and belong to only one VLAN. Frames arriving on the port are untagged and internally mapped to the configured VLAN.
Trunk ports connect switches or routers and carry traffic for multiple VLANs simultaneously. VLAN tagging (IEEE 802.1Q) identifies which VLAN each frame belongs to. Misconfiguration often occurs when a switch port is configured as access but expected to pass tagged frames.
Demand Score: 77
Exam Relevance Score: 85
Why is a VLAN not passing traffic across a trunk between two Juniper switches?
The VLAN is likely not included in the trunk VLAN membership on one side.
Both trunk interfaces must allow the same VLAN IDs. If one switch allows VLAN 20 but the other does not, traffic for VLAN 20 will be dropped. Other causes include VLAN not created in the VLAN database or mismatched tagging expectations.
Troubleshooting steps:
Verify VLAN exists
Check trunk VLAN membership
Verify interface mode
Confirm tagging configuration
Demand Score: 79
Exam Relevance Score: 84
What happens if an untagged frame arrives on a trunk port?
The frame is assigned to the native VLAN.
In IEEE 802.1Q trunks, one VLAN may be configured as the native VLAN. Frames arriving without a VLAN tag are mapped to that VLAN internally. On Juniper switches, this behavior depends on configuration such as native-vlan-id.
If the native VLAN is mismatched between two trunk ports, traffic may appear in the wrong VLAN or fail to communicate. This is a common troubleshooting scenario in enterprise networks.
Demand Score: 70
Exam Relevance Score: 80