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
In a nutshell
  • 802.1Q tag: 4 bytes, TPID 0x8100, 3-bit PCP, 12-bit VLAN ID (1 to 4094).
  • Access: interface-mode access with vlan-id; trunk: interface-mode trunk with vlan-id-list.
  • Native VLAN: native-vlan-id at the physical level, with flexible-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.

Hostuntaggedaccess portBridge domain BD100vlan 100trunk port, tag 100 addedNext switch

How it works

The 802.1Q tag

The tag is 4 bytes, inserted after the source MAC address.

FieldSizePurpose
TPID16 bitsTag protocol identifier, 0x8100 for 802.1Q
PCP3 bitsPriority (802.1p class of service)
DEI1 bitDrop eligible indicator
VID12 bitsVLAN ID; usable range 1 to 4094

Port modes

ModeCarriesFrames on the wire
AccessOne VLANUntagged
TrunkA list of VLANsTagged, except the native VLAN
Native VLAN on a trunkOne VLANUntagged 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 statementMeaning
vlan-taggingUnits use single 802.1Q tags
stacked-vlan-taggingUnits use two tags (outer and inner)
flexible-vlan-taggingSingle-tagged and dual-tagged units on the same port
encapsulation flexible-ethernet-servicesLets each unit choose its own encapsulation, such as bridging on one unit and routing on another
encapsulation ethernet-bridgeThe 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 receivesBridge domain vlan-id 100Bridge domain vlan-id none
UntaggedPush 100 on input, pop on outputNo change
Tag 100No changePop the tag on input, push it on output
Tag 200Swap 200 to 100 on input, 100 to 200 on outputPop on input, push on output
Customer tag 200swap on inputBridge domainnormalized vlan 100swap on outputOther porttag 100
Exam tip

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.

Watch out

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 access with vlan-id; trunk: interface-mode trunk with vlan-id-list.
  • Native VLAN: native-vlan-id at the physical level, with flexible-vlan-tagging.
  • Service provider style: flexible-vlan-tagging, encapsulation flexible-ethernet-services, units with encapsulation vlan-bridge and vlan-id, listed under the bridge domain.
  • The bridge domain vlan-id is the normalized VLAN; tags are pushed, popped or swapped to match it.
  • Verify with show bridge domain, show l2-learning interface and show bridge mac-table.

Check yourself

  • A unit with vlan-id 200 is placed in a bridge domain configured with vlan-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-id on the physical interface, together with flexible-vlan-tagging.

  • Which encapsulation lets one physical port mix bridged and routed units?

    encapsulation flexible-ethernet-services on 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.