Layer 2 Bridging or VLANs · Topic 2 of 4
VLAN Port Modes, Tagging and Bridge Domains
Configure MX access and trunk ports, native VLANs, 802.1Q tags, bridge domains and VLAN normalization for the JNCIS-SP JN0-364, with show commands.
- 5 min
- 802.1Q tag: 4 bytes, TPID 0x8100, 3-bit PCP, 12-bit VLAN ID (1 to 4094).
- Access:
interface-mode accesswithvlan-id; trunk:interface-mode trunkwithvlan-id-list. - Native VLAN:
native-vlan-idat the physical level, withflexible-vlan-tagging.
What it is
A VLAN splits one physical Layer 2 network into separate broadcast domains. Frames carry their VLAN in an 802.1Q tag, and each port is either an access port carrying one untagged VLAN or a trunk port carrying many tagged VLANs.
On the MX each VLAN is a bridge domain with a vlan-id. Interfaces join it either automatically, through family bridge with interface-mode, or explicitly, as tagged units listed under the bridge domain.
How it works
The 802.1Q tag
The tag is 4 bytes, inserted after the source MAC address.
| Field | Size | Purpose |
|---|---|---|
| TPID | 16 bits | Tag protocol identifier, 0x8100 for 802.1Q |
| PCP | 3 bits | Priority (802.1p class of service) |
| DEI | 1 bit | Drop eligible indicator |
| VID | 12 bits | VLAN ID; usable range 1 to 4094 |
Port modes
| Mode | Carries | Frames on the wire |
|---|---|---|
| Access | One VLAN | Untagged |
| Trunk | A list of VLANs | Tagged, except the native VLAN |
| Native VLAN on a trunk | One VLAN | Untagged frames are placed in it |
Enterprise style: access and trunk
First create the bridge domains, then put interfaces in them by VLAN ID.
user@mx# set bridge-domains BD100 vlan-id 100
user@mx# set bridge-domains BD200 vlan-id 200
user@mx# set interfaces ge-1/0/0 unit 0 family bridge interface-mode access
user@mx# set interfaces ge-1/0/0 unit 0 family bridge vlan-id 100
user@mx# set interfaces ge-1/0/1 unit 0 family bridge interface-mode trunk
user@mx# set interfaces ge-1/0/1 unit 0 family bridge vlan-id-list [ 100 200 ]
An access port uses vlan-id; a trunk uses vlan-id-list, which also accepts ranges such as 100-199. The bridge domain with the matching vlan-id must exist, and you do not list these interfaces under the bridge domain.
To accept untagged frames on a trunk, add a native VLAN at the physical level together with flexible tagging:
user@mx# set interfaces ge-1/0/1 flexible-vlan-tagging
user@mx# set interfaces ge-1/0/1 native-vlan-id 100
Service provider style: one unit per VLAN
interfaces {
ge-1/0/2 {
flexible-vlan-tagging;
encapsulation flexible-ethernet-services;
unit 100 {
encapsulation vlan-bridge;
vlan-id 100;
}
unit 300 {
encapsulation vlan-bridge;
vlan-id 300;
}
}
}
bridge-domains {
BD100 {
vlan-id 100;
interface ge-1/0/2.100;
}
}
| Physical statement | Meaning |
|---|---|
vlan-tagging | Units use single 802.1Q tags |
stacked-vlan-tagging | Units use two tags (outer and inner) |
flexible-vlan-tagging | Single-tagged and dual-tagged units on the same port |
encapsulation flexible-ethernet-services | Lets each unit choose its own encapsulation, such as bridging on one unit and routing on another |
encapsulation ethernet-bridge | The whole untagged port is one bridged unit, unit 0 |
VLAN normalization
The bridge domain's vlan-id is the normalized VLAN. A unit whose tag differs is translated automatically, so ge-1/0/3.1 with vlan-id 200 can join BD100 and its frames are swapped to 100 on the way in and back to 200 on the way out.
| Interface unit receives | Bridge domain vlan-id 100 | Bridge domain vlan-id none |
|---|---|---|
| Untagged | Push 100 on input, pop on output | No change |
| Tag 100 | No change | Pop the tag on input, push it on output |
| Tag 200 | Swap 200 to 100 on input, 100 to 200 on output | Pop on input, push on output |
MAC addresses are learned against the normalized VLAN, so ports that use different customer tags can still share one MAC table if they belong to one bridge domain.
Monitoring and troubleshooting
user@mx> show interfaces terse ge-1/0/1
user@mx> show bridge domain
user@mx> show l2-learning interface
user@mx> show bridge mac-table bridge-domain BD100
Work from the bottom up: physical link up, unit up with bridge in the protocol column of show interfaces terse, interface listed in show bridge domain, then MAC addresses learned. A trunk whose vlan-id-list does not include a VLAN never shows in that bridge domain.
Common mistakes
Forgetting the bridge domain. An enterprise-style trunk listing VLAN 300 has nowhere to put those frames if no bridge domain has vlan-id 300.
Mixing the two styles on one unit. A unit either uses family bridge with interface-mode or encapsulation vlan-bridge with an explicit bridge domain membership.
Expecting untagged traffic on a trunk without a native VLAN. Untagged frames on a trunk are dropped unless native-vlan-id is configured.
Do not write family ethernet-switching or set vlans for an MX in an exam answer. Those are the EX and QFX ELS forms; the MX form is family bridge and bridge-domains.
What to remember for the exam
- 802.1Q tag: 4 bytes, TPID 0x8100, 3-bit PCP, 12-bit VLAN ID (1 to 4094).
- Access:
interface-mode accesswithvlan-id; trunk:interface-mode trunkwithvlan-id-list. - Native VLAN:
native-vlan-idat the physical level, withflexible-vlan-tagging. - Service provider style:
flexible-vlan-tagging,encapsulation flexible-ethernet-services, units withencapsulation vlan-bridgeandvlan-id, listed under the bridge domain. - The bridge domain
vlan-idis the normalized VLAN; tags are pushed, popped or swapped to match it. - Verify with
show bridge domain,show l2-learning interfaceandshow bridge mac-table.
Check yourself
A unit with
vlan-id 200is placed in a bridge domain configured withvlan-id 100. What happens to its frames?The tag is swapped from 200 to 100 on input and back to 200 on output, because 100 is the normalized VLAN.
An enterprise-style trunk has
vlan-id-list [ 100 200 ]but untagged frames arriving on it are dropped. What is missing?A
native-vlan-idon the physical interface, together withflexible-vlan-tagging.Which encapsulation lets one physical port mix bridged and routed units?
encapsulation flexible-ethernet-serviceson the physical interface.
Topic 2 of 4 in Layer 2 Bridging or VLANs
Test yourself on Layer 2 Bridging or VLANs
The full Juniper JNCIS-SP JN0-364 question bank has 860 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.