Layer 2 Bridging or VLANs · Topic 4 of 4
Provider Bridging (Q-in-Q)
Learn Q-in-Q provider bridging on MX routers for JNCIS-SP JN0-364: S-VLAN and C-VLAN tags, vlan-tags outer and inner, push and pop VLAN maps, and checks.
- 6 min
- Includes a diagram
- Q-in-Q is IEEE 802.1ad provider bridging: outer S-VLAN, inner C-VLAN.
- Each tag adds 4 bytes; raise core MTU.
stacked-vlan-taggingfor dual tags only;flexible-vlan-taggingfor mixed single and dual tags.
What it is
Provider bridging, defined in IEEE 802.1ad and widely called Q-in-Q, lets a service provider carry a customer's VLANs across its network inside one provider VLAN. The provider adds an outer tag, the service VLAN (S-VLAN), in front of the customer's own inner tag, the customer VLAN (C-VLAN).
Each customer gets its own S-VLAN, so customers can use any C-VLAN numbers they like, even overlapping ones. The core switches on the outer tag only, and each of up to 4094 S-VLANs can carry up to 4094 C-VLANs.
How it works
Terms

| Term | Meaning |
|---|---|
| C-VLAN (C-tag) | The customer's tag, the inner tag in the core |
| S-VLAN (S-tag) | The provider's tag, the outer tag in the core |
| UNI | User network interface, the customer-facing port |
| NNI | Network-to-network interface, the provider core-facing port |
| All-to-one bundling | Every customer frame, tagged or untagged, goes into one S-VLAN |
| TPID | Tag protocol identifier; 0x8100 by default, 0x88a8 is the 802.1ad S-tag value |
Tagging statements on the physical interface
| Statement | Allows |
|---|---|
vlan-tagging | Units with one tag only |
stacked-vlan-tagging | Units with two tags only (vlan-tags outer ... inner ...) |
flexible-vlan-tagging | Single-tagged and dual-tagged units on the same port |
Each extra tag adds 4 bytes, so a Q-in-Q frame is 4 bytes longer than the customer sent. Raise the MTU on core-facing links, or full-size customer frames are dropped.
All-to-one bundling with VLAN normalization
The simplest MX design uses the bridge domain's vlan-id as the S-VLAN. The UNI is an untagged bridged port, so everything the customer sends, tagged or not, is treated as payload.
interfaces {
ge-1/0/5 {
encapsulation ethernet-bridge;
unit 0 {
family bridge;
}
}
ge-1/0/2 {
flexible-vlan-tagging;
encapsulation flexible-ethernet-services;
unit 500 {
encapsulation vlan-bridge;
vlan-id 500;
}
}
}
bridge-domains {
CUST-A-QINQ {
vlan-id 500;
interface ge-1/0/5.0;
interface ge-1/0/2.500;
}
}
Because ge-1/0/5.0 is untagged from the bridge domain's point of view, normalization pushes S-VLAN 500 on input and pops it on output. The customer's own C-tag, if any, rides inside unchanged. The NNI unit already carries tag 500, so no change is made there.
Matching both tags on a unit
A unit can also match a specific outer and inner pair with vlan-tags. Here the core-facing unit carries S-VLAN 500 with C-VLAN 100, and the bridge domain normalizes to VLAN 100.
user@mx# set interfaces ge-1/0/3 flexible-vlan-tagging
user@mx# set interfaces ge-1/0/3 encapsulation flexible-ethernet-services
user@mx# set interfaces ge-1/0/3 unit 1 encapsulation vlan-bridge
user@mx# set interfaces ge-1/0/3 unit 1 vlan-tags outer 500 inner 100
user@mx# set bridge-domains C1-VLAN100 vlan-id 100
user@mx# set bridge-domains C1-VLAN100 interface ge-1/0/3.1
Frames received with outer 500 and inner 100 are accepted, the outer tag is popped on input, and the inner tag already matches the normalized VLAN. On output the outer tag 500 is pushed again.
Explicit VLAN maps
Instead of normalization, a logical interface can rewrite tags itself with input-vlan-map and output-vlan-map. The operations include push, pop, swap, and two-tag forms such as push-push, pop-pop and swap-push. The vlan-id inside the map gives the tag value to push or swap in.
user@mx# set interfaces ge-1/0/6 unit 10 encapsulation vlan-bridge
user@mx# set interfaces ge-1/0/6 unit 10 vlan-id 10
user@mx# set interfaces ge-1/0/6 unit 10 input-vlan-map push
user@mx# set interfaces ge-1/0/6 unit 10 input-vlan-map vlan-id 600
user@mx# set interfaces ge-1/0/6 unit 10 output-vlan-map pop
Here unit 10 matches customer VLAN 10 and pushes S-VLAN 600 in front of it. A push on input must be matched by a pop on output, so the customer gets back exactly what it sent. Explicit maps are used where the bridge domain has no vlan-id to normalize to.
For provider bridges running spanning tree, RSTP and MSTP can send BPDUs to the provider bridge group address with bpdu-destination-mac-address provider-bridge-group, so the provider's BPDUs are kept apart from customer BPDUs.
Monitoring and troubleshooting
user@mx> show interfaces ge-1/0/5.0 detail
user@mx> show interfaces ge-1/0/3.1 detail
user@mx> show bridge domain
user@mx> show bridge mac-table bridge-domain CUST-A-QINQ
The interface output shows the VLAN tags the unit matches and the rewrite operations applied on input and output, such as a push on input and a pop on output. If customer traffic fails, check that the tag operations are symmetrical, that both units are in the same bridge domain, that the core MTU allows the extra 4 bytes, and that the outer tag matches what the next provider device expects.
Common mistakes
Forgetting the MTU. Q-in-Q adds 4 bytes; 1500-byte customer frames are dropped on a core link left at the customer MTU.
Using vlan-tagging for dual-tagged units. Two tags need stacked-vlan-tagging, or flexible-vlan-tagging when single and dual tags share the port.
Push without pop. An input-vlan-map push with no matching output-vlan-map pop sends the S-tag back to the customer.
In the core the outer tag is the S-VLAN. A question that asks which tag the provider switches on wants the outer tag, not the customer's C-VLAN.
What to remember for the exam
- Q-in-Q is IEEE 802.1ad provider bridging: outer S-VLAN, inner C-VLAN.
- Each tag adds 4 bytes; raise core MTU.
stacked-vlan-taggingfor dual tags only;flexible-vlan-taggingfor mixed single and dual tags.vlan-tags outer X inner Yon a unit matches a tag pair.- All-to-one bundling: untagged bridged UNI plus bridge domain
vlan-idas the S-VLAN; push on input, pop on output. input-vlan-mapandoutput-vlan-maprewrite tags explicitly with push, pop, swap and two-tag variants.- Default TPID 0x8100; 0x88a8 is the 802.1ad S-tag value.
Check yourself
A UNI with
encapsulation ethernet-bridgeis in a bridge domain withvlan-id 500. What happens to a customer frame tagged with VLAN 10?VLAN 500 is pushed as the outer tag on input, and the customer's tag 10 stays inside as the inner tag.
Which physical interface statement allows both single-tagged and dual-tagged units on one port?
flexible-vlan-tagging.Customer frames of 1500 bytes are lost across a Q-in-Q core, but small frames pass. What is the likely cause?
The core MTU does not allow the extra 4-byte outer tag.
Topic 4 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.