Layer 2 Switching and VLANs
Two halves of a VLAN
Junos splits VLAN configuration into a definition and a membership decision. set vlans BLUE vlan-id 10 defines the VLAN and its 802.1Q tag; the port decides how frames enter it with interface-mode access or interface-mode trunk (older non-ELS EX code still says port-mode). An access port sits in exactly one VLAN and sends untagged frames. A trunk port carries tagged VLANs listed as vlan members, or a vlan-id-list [10 20 30], plus at most one untagged VLAN named by native-vlan-id. Layer 3 lives on a routed VLAN interface (RVI), vlan.10, which owns a single MAC address and acts as the gateway for that broadcast domain.
What questions probe
- A trunk with no
native-vlan-iddrops untagged frames rather than guessing. vlan-id allis for Q-in-Q/transparent trunking; it accepts any tag and should not be used casually.- The RVI comes up only when at least one member interface in that VLAN is up.
- MAC learning, aging, and the forwarding table are per VLAN; check
show ethernet-switching table. - ELS versus non-ELS syntax (
switch-optionsvsethernet-switching-options) is a favourite distractor.
Worked example
A trunk to a downstream switch that needs VLAN 10 tagged and VLAN 20 untagged:
set vlans BLUE vlan-id 10
set vlans NATIVE vlan-id 20
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 BLUE
set interfaces ge-0/0/1 native-vlan-id 20
Rule of thumb: the tag lives on the frame only while it crosses a trunk; every access port strips it, so untagged misconfigurations usually show up as one VLAN that cannot reach its own gateway.