JNCIS-ENT JN0-352 · Layer 2 Switching · VLANs

Layer 2 switching: VLANs, trunks and IRB

How an EX switch learns, floods and forwards frames, how VLANs split one switch into several broadcast domains, how trunks and the native VLAN carry them between switches, and how IRB interfaces route between VLANs.

38 min read9 chapters3 labs15 quiz7 scenarios15 interview Q&A

This first module is free: read the lesson and take the quiz. Create a free account to run up to 3 hands-on labs.

Log inStart free
Jump to chapter (9)
01

Layer 2 switching: what you will learn and the big picture

What you will learn in this module. You will learn how an EX switch running Junos moves Ethernet frames inside a campus: how it learns MAC addresses, how VLANs cut one switch into several separate networks, how trunks carry many VLANs between switches, what the native VLAN does, and how IRB interfaces route between VLANs. This is the Layer 2 Switching and VLANs part of the JNCIS-ENT exam (JN0-352). By the last chapter you will be able to build, verify and troubleshoot all of it on the same lab devices you will use in the simulator.

Prerequisites. This module assumes you finished the JNCIA-Junos modules. In particular you should be comfortable with the CLI from JNCIA CLI: configure, set, show | compare, commit, rollback and operational show commands. We will not re-teach them, we will simply use them. You should also know what an IP address, a subnet mask and a default gateway are.

Analogy: an office building with locked floors

Think of a switch as the lift lobby and corridors of an office building. A frame is a letter addressed to a desk. The switch is the clerk who remembers which corridor each desk is on, so most letters go straight to the right door instead of being shouted down every corridor. A VLAN is a locked floor: Finance people can walk their own floor freely, but they cannot walk into Design. If Finance must talk to Design, the letter goes to the reception desk on the ground floor, which is a router. A trunk is the main lift shaft: it carries people from every floor, and each passenger wears a coloured badge (the 802.1Q tag) saying which floor they belong to.

PC1 VLAN 10 PC2 VLAN 20 ACCaccess switch COREirb.10 irb.20 trunk 802.1Q accessaccess

Hosts attach to access ports, switches connect with a trunk, and the core routes between VLANs with IRB.

The pieces you will meet

Frame
The Layer 2 unit of data: destination MAC, source MAC, optional VLAN tag, payload.
MAC table
The switch's memory of which address lives behind which port (the Ethernet switching table).
VLAN
A virtual LAN: one separate broadcast domain inside the switch, identified by a 12-bit ID from 1 to 4094.
Access port
A port for one end device that belongs to exactly one VLAN and carries untagged frames.
Trunk port
A port between switches that carries many VLANs, each frame tagged.
IRB
Integrated routing and bridging: the switch's own Layer 3 interface inside a VLAN, used as the hosts' default gateway.

Enhanced Layer 2 Software (ELS)

Modern EX switches such as the EX4300 and EX2300 use ELS, a Junos configuration style where VLANs are defined under [edit vlans] and ports use family ethernet-switching on unit 0. All the commands in this module use that style. Older EX models used a different syntax with vlan members under [edit ethernet-switching-options]; the exam and the lab use ELS.

Worked example: the labs in this module. Lab 1 uses one switch AS1 and four PCs (192.168.50.11 to .14) in the Chennai design studio; you split them into VLANs DESIGN (110) and FINANCE (120). Lab 2 uses an access switch ACC and a core switch CORE in Pune with VLANs SALES (10) and ENG (20) and IRB gateways 10.10.10.1 and 10.10.20.1. Lab 3 is a Hyderabad troubleshooting ticket about trunks and the native VLAN. Every chapter prepares you for one of these.

Common beginner mistake. Thinking a VLAN is an IP subnet. A VLAN is a Layer 2 broadcast domain, and a subnet is a Layer 3 idea. By convention one VLAN maps to one subnet, but the switch does not enforce it, and two VLANs using the same subnet simply cannot talk to each other.

Exam trap. The exam may show old-style EX syntax or ELS syntax and ask which is valid. Check for set vlans NAME vlan-id N and interface-mode; those mark ELS.

The flat office that grew too big

A design studio ran 90 devices in one broadcast domain. Printers, laptops and phones all heard every broadcast, ARP traffic was constant, and the finance desks could see the designers' shared folders. After the network team created three VLANs and a routed core, broadcast noise dropped sharply and finance traffic was reachable only through the gateway where an access list could control it.

Lesson: VLANs shrink broadcast domains and give you a place to apply policy.

"Why do we use VLANs instead of buying a separate switch per department?"

A strong answer: VLANs give logical separation on shared hardware, reduce broadcast domain size, simplify moves because membership is configuration not cabling, and let you apply security policy at the routing point. Mention that inter-VLAN traffic needs a Layer 3 device, in our labs an IRB interface.

Key takeaways

  • A switch learns source MACs and forwards by destination MAC; a VLAN is a separate broadcast domain.
  • Access ports carry one untagged VLAN; trunks carry many tagged VLANs.
  • IRB interfaces are the gateways that route between VLANs on the switch.
  • This module uses ELS syntax: set vlans, family ethernet-switching, interface-mode.
  • Assumes JNCIA CLI skills: candidate configuration, commit and rollback.
02

How a switch learns, forwards and floods

Before VLANs, trunks or routing, you must understand the one thing every switch does all day: decide where to send a frame. Think of a post-room clerk in a large office. Every letter that arrives has a sender and a receiver desk. The clerk writes down "desk 14 is in corridor B" the first time a letter from desk 14 passes by. Next time a letter is addressed to desk 14, the clerk walks straight to corridor B. If the clerk has never heard of a desk, the letter is copied to every corridor. That is exactly the learn, forward and flood behaviour of an Ethernet switch.

The Ethernet frame in one minute

A frame is the Layer 2 envelope. It carries a destination MAC address (6 bytes), a source MAC address (6 bytes), an optional 802.1Q VLAN tag (4 bytes), a type field and the payload. A MAC address is a hardware-style identifier such as 00:50:7f:06:6d:01. A switch only reads the Layer 2 header. It does not care about IP addresses when it switches.

Switch AS1MAC table PC1 ge-0/0/1 PC2 ge-0/0/2 PC3 ge-0/0/3 PC4 ge-0/0/4 unknown or broadcast: flood to all other ports known unicast: one port only

One switch, four hosts: the MAC table decides between a single port and all ports.

The four actions

  1. Learn. For every incoming frame the switch records the source MAC, the VLAN and the ingress port in the Ethernet switching table.
  2. Forward. If the destination MAC is in the table for that VLAN, the frame leaves through that one port only.
  3. Flood. Broadcasts (destination ff:ff:ff:ff:ff:ff), multicasts without snooping and unknown unicast frames go out of every port in the same VLAN except the ingress port.
  4. Filter. If the destination is behind the same port the frame arrived on, the switch drops it.

Entries age out after a period of silence (default 300 seconds on Junos) and are removed when the port goes down. When a host moves to another port, the next frame it sends updates the entry: this is a MAC move.

Worked example. PC1 pings PC2 for the first time on AS1. PC1 first sends an ARP broadcast. AS1 learns PC1 on ge-0/0/1 and floods the broadcast to ge-0/0/2, ge-0/0/3 and ge-0/0/4. PC2 answers with a unicast ARP reply. AS1 learns PC2 on ge-0/0/2 and sends the reply only to ge-0/0/1. Every following frame between them uses one port each way. After a few pings the table holds one entry per active host.

Seeing it on the switch

In the lab Lab 1 topology (AS1 and four PCs) we ping between the hosts and then read the table. This output was captured from the simulator before any VLAN was created, so every host is in the built-in default VLAN:

lab@AS1> show ethernet-switching table

Ethernet switching table : 4 entries, 4 learned
Routing instance : default-switch
   Vlan                MAC                 MAC         Age    Logical
   name                address             flags              interface
   default             00:50:7a:06:65:01   D           -      ge-0/0/4.0
   default             00:50:7f:06:6d:01   D           -      ge-0/0/1.0
   default             00:50:80:06:6e:01   D           -      ge-0/0/2.0
   default             00:50:81:06:70:01   D           -      ge-0/0/3.0

Read it left to right: VLAN name, the learned MAC, the flag D (dynamically learned) and the logical interface. The value after the dot is the unit; on EX access ports it is almost always .0.

# useful table commands
show ethernet-switching table
show ethernet-switching table vlan-name FINANCE
show ethernet-switching table interface ge-0/0/4
clear ethernet-switching table

Clearing the table is safe. Entries are relearned from the next frame. It is a quick way to prove that a stale entry was the problem.

Common mistakes. Reading the MAC table as proof that the host is reachable. A MAC entry only says a frame from that source arrived on that port. Another mistake: expecting to see the PC's IP address here. The Ethernet switching table has no IP information at all; use show arp on a Layer 3 device for that.

Exam trap. Unknown unicast is flooded; unknown broadcast is a wrong phrase because every broadcast is flooded by definition. Also remember that learning uses the source MAC and forwarding uses the destination MAC.

The printer that "moved" every ten seconds

A branch printer lost jobs at random. On the switch the printer's MAC kept flipping between ge-0/0/5 and ge-0/0/9. A cabling check found a second, forgotten patch cable from the same wall box looping back to the switch. Frames from the printer arrived on two ports, so the table was constantly updated. Removing the extra cable stopped the flapping at once.

Lesson: a MAC address that appears on two ports in quick succession points to a loop or a duplicate address. The spanning tree module shows how the network protects itself from this.

"What does a switch do when it receives a frame for an unknown destination MAC?"

It floods the frame out of every port in the same VLAN except the ingress port. When the real owner replies, the switch learns its address from that reply and from then on forwards unicast to that single port. Mention that learning is based on the source MAC and that entries age out after 300 seconds by default.

Key takeaways

  • A switch learns the source MAC, forwards on the destination MAC, floods unknown unicast and broadcasts, and filters same-port frames.
  • The MAC table is kept per VLAN and shows flag D for dynamic entries.
  • Entries age out (300 seconds by default) and clear when the port goes down.
  • Use show ethernet-switching table and clear ethernet-switching table to inspect and reset it.
03

VLANs and access ports on ELS

Imagine a single large open-plan office where every conversation is heard by everyone. Now add glass partitions: Finance in one room, Design in another. People in the same room still talk freely, but a shout in one room is not heard in the next. A VLAN (virtual LAN) is that partition, built in software. One physical switch is divided into several separate broadcast domains. A broadcast sent in VLAN 110 is never delivered to ports in VLAN 120.

Why VLANs matter

  • Smaller broadcast domains: less ARP and broadcast noise on every host.
  • Security and policy: traffic between VLANs has to pass through a router interface where a firewall filter can be applied.
  • Flexibility: moving a desk means changing one line of configuration, not re-cabling a floor.

A VLAN is identified by a VLAN ID (also called tag), a 12-bit number from 1 to 4094. Junos gives every switch a built-in VLAN called default with ID 1.

AS1 (EX4300)two broadcast domains PC1 DESIGN PC2 DESIGN PC3 FINANCE PC4 FINANCE VLAN 110VLAN 120

Same switch, same subnet 192.168.50.0/24, but two VLANs: PC1 can reach PC2, not PC3.

Configuring VLANs on ELS

Modern EX switches such as the EX4300 use Enhanced Layer 2 Software (ELS). You define VLANs by name, then attach ports through family ethernet-switching on unit 0. The access port is for one end device: it belongs to one VLAN and sends and receives untagged frames.

# Lab 1: split the Chennai design studio
set vlans DESIGN vlan-id 110
set vlans FINANCE vlan-id 120
set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access vlan members DESIGN
set interfaces ge-0/0/2 unit 0 family ethernet-switching interface-mode access vlan members DESIGN
set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members FINANCE
set interfaces ge-0/0/4 unit 0 family ethernet-switching vlan members FINANCE

interface-mode access is the default, so lines three and four are equivalent. vlan members accepts the VLAN name or its numeric ID. Before committing, review the change. This is real output from the simulator:

lab@AS1# show | compare
[edit]
+   vlans {
+       DESIGN {
+           vlan-id 110;
+       }
+       FINANCE {
+           vlan-id 120;
+       }
+   }
[edit interfaces ge-0/0/1 unit 0 family ethernet-switching]
+   interface-mode access;
+   vlan {
+       members DESIGN;
+   }

Verifying

lab@AS1> show vlans
Routing instance        VLAN name             Tag          Interfaces
default-switch          default               1
default-switch          DESIGN                110
                                                           ge-0/0/1.0*
                                                           ge-0/0/2.0*
default-switch          FINANCE               120
                                                           ge-0/0/3.0*
                                                           ge-0/0/4.0*

The asterisk means the logical interface is up. After the move, PC3 reaches PC4 but PC1 can no longer reach PC3. The simulator shows five lines of host (192.168.50.13) not reachable, which is exactly what you want: same subnet, different VLANs, no Layer 2 path and no router between them.

lab@AS1> show ethernet-switching interface ge-0/0/1 detail
Logical Interface          : ge-0/0/1.0
  State                    : up
  Interface mode           : access
  MAC addresses learned    : 1
  VLAN membership          :
    DESIGN                110   untagged  Forwarding

When you have many identical ports use an interface range: set interfaces interface-range USERS member-range ge-0/0/1 to ge-0/0/20 and put the shared unit 0 family ethernet-switching lines under that range once.

Common mistakes. Assuming a VLAN is a subnet: it is a Layer 2 idea, and the switch will happily put the same IP subnet in two VLANs, which then cannot talk. Another: a port with family ethernet-switching but no vlan members silently joins default. And a port without family ethernet-switching does not switch at all.

Exam trap. VLAN IDs 0 and 4095 are reserved, so valid IDs are 1 to 4094. The ELS keyword for the port role is interface-mode; the legacy EX syntax used port-mode under ethernet-switching-options.

The new finance hires on the wrong floor

Two accountants were seated at desks wired to design ports. They could open the designers' shared drives. The engineer did not move any cable: he put ge-0/0/3 and ge-0/0/4 into FINANCE, ran show vlans to confirm membership and asked a designer to try a ping. It failed, as intended.

Lesson: VLAN membership is configuration. Always prove isolation with a ping that must fail.

"What is the difference between a VLAN and a subnet?"

A VLAN is a Layer 2 broadcast domain; a subnet is a Layer 3 address range. The usual design is one VLAN per subnet, but the switch does not enforce it. Hosts in different VLANs need a Layer 3 hop (an IRB or router) to communicate, even if they share an address range on paper.

Key takeaways

  • A VLAN is a separate broadcast domain with an ID from 1 to 4094.
  • ELS: define VLANs under [edit vlans], attach ports with family ethernet-switching on unit 0.
  • An access port belongs to one VLAN and carries untagged frames.
  • Without vlan members a switching port lands in default (ID 1).
  • Verify with show vlans and show ethernet-switching interface.
04

Trunks, 802.1Q tags and the native VLAN

Return to the office building. Each floor (VLAN) has its own rooms, but the whole building shares one lift shaft. Every passenger wears a coloured badge saying which floor they belong to, so the lift can drop them at the right place. A trunk is that lift shaft: a single link between two switches that carries many VLANs at once. The coloured badge is the IEEE 802.1Q tag.

The 802.1Q tag

802.1Q inserts 4 bytes between the source MAC and the type field of the frame. Inside are a 16-bit tag protocol identifier (0x8100), 3 priority bits (used by CoS), 1 drop-eligible bit and the 12-bit VLAN ID. The receiving switch reads the ID and keeps the frame inside that VLAN. Hosts never see tags on access ports: the switch adds the tag when the frame enters a trunk and removes it when the frame leaves through an access port.

PC1 SALES PC2 ENG ACC CORE trunk: VLAN 10 + VLAN 20 tagged ge-0/0/0 on both ends untagged

Access ports are untagged; the trunk carries tagged frames.

Configuring a trunk

In Lab 2 the access switch ACC already has a trunk. CORE is blank, so you build the matching end. Note that both ends must carry the same VLANs:

# on CORE
set vlans SALES vlan-id 10
set vlans ENG vlan-id 20
set interfaces ge-0/0/0 unit 0 family ethernet-switching interface-mode trunk vlan members [ SALES ENG ]

Only VLANs listed in vlan members cross the trunk. vlan members all allows every VLAN that exists. Real output of the trunk on CORE after commit:

lab@CORE> show ethernet-switching interface ge-0/0/0 detail
Logical Interface          : ge-0/0/0.0
  State                    : up
  Interface mode           : trunk
  MAC addresses learned    : 0
  VLAN membership          :
    SALES                 10    tagged    Forwarding
    ENG                   20    tagged    Forwarding

The native VLAN

Sometimes untagged frames arrive on a trunk: a management protocol, an old device, or a switch that sends its own control frames without a tag. The native VLAN tells the switch which VLAN these untagged frames belong to. On Junos a trunk has no native VLAN by default, so untagged frames arriving on it are dropped. You enable it on the physical interface:

set interfaces ge-0/0/0 native-vlan-id 99      # the numeric ID; the lab uses MGMT = 99
set interfaces ge-0/0/0 native-vlan-id MGMT

The native-vlan-id statement sits under the physical interface, not under unit 0. Frames of the native VLAN leave the trunk untagged; untagged arrivals are placed into that VLAN. The VLAN listed as native must also be in the member list of that trunk (or be covered by members all).

Both ends must agree. If ACC says native STAFF and CORE says native MGMT, an untagged frame sent by CORE in VLAN 99 arrives at ACC and is placed in VLAN 30. No log message tells you; traffic of both VLANs simply goes to the wrong place. The Lab 3 ticket is exactly this fault.

Worked example. CORE sends a frame from VLAN 99 (MGMT) across a trunk where MGMT is native. The frame leaves untagged. ACC receives an untagged frame on a trunk whose native VLAN is also 99, so it places the frame in VLAN 99 and the management ping works. For VLAN 30 the same trunk sends a frame with an 802.1Q tag 30, and ACC delivers it to VLAN 30.

SymptomUsual cause
One VLAN fails across the uplink, others workVLAN missing from vlan members on one end
Untagged or management traffic failsNative VLAN missing or different on the two ends
A PC on a port shows taggedPort set to interface-mode trunk by mistake

Common mistakes. Making a PC port a trunk: the PC sends untagged frames, and a trunk with no native VLAN drops them. Another: configuring the native VLAN on only one switch. A third: forgetting to create the VLAN on the second switch; a VLAN named in vlan members that does not exist is rejected at commit.

Exam trap. On Junos, access ports are untagged, trunk ports are tagged, and the native VLAN is optional and off by default. Do not assume it is VLAN 1 as on some other vendors.

Printers die after the weekend change

Staff and printers lost connectivity at Hyderabad on Monday. The weekend change had moved the trunk's native VLAN to STAFF on the access switch only. Printer traffic was fine at the edge, but management frames from the core arrived untagged and landed in the wrong VLAN. The engineer compared show ethernet-switching interface ge-0/0/0 detail on both ends and saw different native VLANs.

Lesson: compare both ends of every trunk before you look anywhere else.

"What is the native VLAN, and what happens if it does not match?"

It is the VLAN assigned to untagged frames on a trunk; on Junos it is not set by default. If the two ends differ, untagged frames are silently placed in different VLANs, which breaks management and any untagged traffic. Say that you verify with show ethernet-switching interface detail on both ends.

Key takeaways

  • A trunk carries many VLANs; each frame carries a 12-bit 802.1Q tag.
  • Use interface-mode trunk vlan members [ ... ] under family ethernet-switching.
  • Junos trunks have no native VLAN by default; set native-vlan-id on the physical interface.
  • Both ends must agree on member VLANs and native VLAN.
05

Routing between VLANs with IRB

VLANs are locked floors. People on the Sales floor cannot walk into Engineering. When they need to talk, they go down to the reception desk, which knows every floor and passes messages between them. On a campus network the reception desk is a Layer 3 interface. On an EX switch, that interface is called IRB: Integrated Routing and Bridging. It lives inside the switch, belongs to a VLAN, and acts as the default gateway for the hosts in that VLAN.

Why do we need it?

Two hosts in different VLANs are in different broadcast domains. The switch will never bridge a frame from VLAN 10 into VLAN 20. To connect them, a device must route at Layer 3: receive the frame in VLAN 10, look at the destination IP, and send a new frame into VLAN 20. A separate router connected with one trunk works, but a Layer 3 switch does it internally with IRB and is cheaper and faster.

CORE (Layer 3 switch) irb.1010.10.10.1/24 irb.2010.10.20.1/24 ACC (L2 only)trunk VLAN 10 + 20 PC1 .10.11 PC2 .20.12

Hosts in each VLAN use their IRB address as default gateway; CORE routes between irb.10 and irb.20.

Building it (Lab 2)

You create one irb logical unit per VLAN, give it an IP address, and tie it to the VLAN with l3-interface:

set interfaces irb unit 10 family inet address 10.10.10.1/24
set interfaces irb unit 20 family inet address 10.10.20.1/24
set vlans SALES l3-interface irb.10
set vlans ENG l3-interface irb.20

Tip: use the VLAN ID as the unit number. It makes irb.10 obviously the gateway of VLAN 10. After commit, verify:

lab@CORE> show interfaces terse irb
Interface               Admin Link Proto    Local                 Remote
irb                     up    up
irb.10                  up    up   inet     10.10.10.1/24
irb.20                  up    up   inet     10.10.20.1/24

lab@CORE> show vlans
Routing instance        VLAN name             Tag          Interfaces
default-switch          ENG                   20
                                                           ge-0/0/0.0*
                                                           (l3-interface irb.20)
default-switch          SALES                 10
                                                           ge-0/0/0.0*
                                                           (l3-interface irb.10)

lab@CORE> show route
inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
10.10.10.0/24      *[Direct/0] 00:00:00
                    >  via irb.10
10.10.10.1/32      *[Local/0] 00:00:00
                       Local via irb.10
10.10.20.0/24      *[Direct/0] 00:00:00
                    >  via irb.20
10.10.20.1/32      *[Local/0] 00:00:00
                       Local via irb.20

Notice the two kinds of routes created per IRB address: a Direct route for the subnet and a Local /32 route for the gateway address itself. Now the end-to-end test from PC1 (10.10.10.11, gateway 10.10.10.1):

PC1> ping 10.10.20.12
84 bytes from 10.10.20.12 icmp_seq=1 ttl=63 time=0.500 ms
84 bytes from 10.10.20.12 icmp_seq=2 ttl=63 time=0.600 ms

PC2 sent the reply with TTL 64 and one router (CORE) decremented it, so PC1 sees 63. A TTL one lower than the sender's initial value is the signature of a single routed hop. A frame that was only switched keeps TTL 64.

Worked example. PC1 wants 10.10.20.12. It sees that the address is outside its own /24, so it ARPs for its gateway 10.10.10.1 and sends the frame to the IRB's MAC address in VLAN 10. CORE strips the Layer 2 header, finds the Direct route 10.10.20.0/24 via irb.20, ARPs for PC2 inside VLAN 20, builds a new frame and forwards it. The IP packet is the same, the Ethernet frame is new, and TTL has dropped by one.

An IRB unit comes up only if at least one port in its VLAN is up. If show interfaces terse irb shows it down, check the VLAN's ports first. The hosts must also use the IRB address as default gateway.

Common mistakes. Forgetting l3-interface so the IRB exists but is not tied to a VLAN. Giving the hosts the wrong gateway. Putting two IRB units in the same subnet. And forgetting that the access switch ACC does not need an IRB for user traffic: it only needs one if you want to manage it, as in the Lab 3 management VLAN.

Exam trap. The keyword is l3-interface under the VLAN (ELS). In older EX syntax it was l3-interface vlan.10 with the unit named vlan. IRB on ELS is always called irb.

Sales cannot reach the engineering build server

After a new VLAN was added, sales PCs could ping their gateway but not the server in VLAN 20. The engineer ran show vlans on CORE and saw that ENG had no l3-interface line, so irb.20 was not bound. One set vlans ENG l3-interface irb.20 and a commit fixed it.

Lesson: a configured IRB address is not enough; bind it to the VLAN.

"How do you route between VLANs on an EX switch?"

Create an IRB unit per VLAN with an IP address, bind each with l3-interface under the VLAN, and use the IRB address as the hosts' gateway. The subnet appears as a Direct route and routed traffic has its TTL decremented. Mention the alternative, router on a stick, and why IRB is better.

Key takeaways

  • IRB is the switch's Layer 3 interface inside a VLAN and serves as the hosts' default gateway.
  • Create irb unit N, add an address, bind with set vlans NAME l3-interface irb.N.
  • Each IRB address creates a Direct subnet route and a Local /32 route.
  • Routed traffic has TTL decreased by one (64 becomes 63).
06

Campus VLAN design, interface ranges and extra Layer 2 features

So far you built VLANs one port at a time. Real campuses have hundreds of ports, and an engineer who types every line by hand will eventually make a mistake. This chapter shows how professionals keep Layer 2 designs tidy, and introduces the extra Layer 2 features the JNCIS-ENT blueprint mentions: voice VLANs, Q-in-Q tunnelling and MAC address handling. You will not configure them in the labs, but you must recognise them.

A sensible VLAN plan

Write the plan down before you type. A common pattern is one VLAN per function per building, with the VLAN ID and the third octet of the subnet kept the same, so that VLAN 30 is 10.30.0.0/24 and its gateway is irb.30 at 10.30.0.1. Lab 3 follows this: STAFF is VLAN 30 with 10.30.0.1/24, PRINT is VLAN 40 with 10.40.0.1/24 and MGMT is VLAN 99 with 10.99.0.1/24.

VLANNameSubnetGateway (IRB)
30STAFF10.30.0.0/24irb.30 = 10.30.0.1
40PRINT10.40.0.0/24irb.40 = 10.40.0.1
99MGMT10.99.0.0/24irb.99 = 10.99.0.1

Keep the user-facing VLANs separate from management. Management traffic (SSH, SNMP) belongs in its own VLAN, which is also a good candidate for the trunk's native VLAN so that device-to-device control traffic stays untagged and isolated from users.

Core / distribution (IRBs) Access switch A Access switch B Access switch C users, phones, printers users, phones, printers users, phones, printers

Access switches are Layer 2 only; the VLANs end at IRB gateways in the core or distribution layer.

Interface ranges and descriptions

An interface range lets you configure many ports once. Put the shared lines under the range and the range expands to each port at commit time:

set interfaces interface-range USERS member-range ge-0/0/1 to ge-0/0/20
set interfaces interface-range USERS unit 0 family ethernet-switching interface-mode access vlan members STAFF
set interfaces ge-0/0/0 description "uplink to CORE ge-0/0/0"
set vlans STAFF description "Staff laptops, building A"

Descriptions cost nothing and save hours during a fault. Read them with show interfaces descriptions. Remember that a setting directly on one port overrides the range, so exceptions are easy.

Extra Layer 2 features to recognise

Voice VLAN
An IP phone and a PC share one wall port. The port carries the PC untagged in the data VLAN and the phone tagged in a voice VLAN, so voice can be given priority. Junos learns the voice VLAN for a port from the switch-options voip configuration, often together with LLDP-MED.
Q-in-Q (802.1ad)
A service provider or an enterprise wraps customer frames in a second, outer tag so many customer VLANs travel through the network unchanged. On Junos this is enabled with dot1q-tunneling on a VLAN.
MAC limiting and static MACs
A port can be limited to a number of learned addresses, or a MAC can be pinned to a port. These are security tools and the Layer 2 security module covers them.
Storm control, port mirroring, LLDP
Protection against broadcast storms, copying traffic for analysis, and neighbour discovery. All are standard enterprise switch features.

Worked example. A 24-port access switch in a call centre: ports 1 to 20 are for agents with a PC and a phone, 21 and 22 are printers, 23 is a spare and 24 is the uplink trunk. The engineer creates one range for ports 1 to 20, one for 21 and 22, leaves 23 unconfigured (no family ethernet-switching, so it does not switch) and configures 24 as a trunk with MGMT as native. Four blocks of configuration instead of twenty-four.

Common mistakes. Leaving unused ports in the default VLAN where anyone can plug in. Better to leave them without family ethernet-switching or park them in an unused "parking" VLAN. Using VLAN 1 for user traffic and management. Mixing naming styles (Sales, SALES, sales_floor) so nobody can search the configuration.

Exam trap. Know the names: voice VLAN, Q-in-Q (dot1q-tunneling), MAC limiting. The exam asks which feature solves which problem; it does not ask you to configure a voice VLAN from memory.

The copy-paste that moved 20 phones

A technician copied a block of access-port configuration from a data switch to a voice switch. The pasted lines referenced a VLAN that did not exist on the second switch. Junos refused the commit with an error, so nothing changed; the technician created the VLAN, then committed. On a platform that applies lines one by one the phones would have dropped one at a time.

Lesson: commit check and the all-or-nothing commit protect you from half-applied changes.

"How do you keep a large campus switch configuration manageable?"

A written VLAN plan with consistent names and IDs, interface ranges for repeated access ports, descriptions on every uplink and every VLAN, management in its own VLAN, and unused ports shut down or parked. Mention show | compare before every commit.

Key takeaways

  • Plan VLAN IDs, names, subnets and gateways before configuring.
  • Use interface-range and descriptions to cut errors on large switches.
  • Keep management in its own VLAN and unused ports out of user VLANs.
  • Recognise voice VLAN, Q-in-Q and MAC limiting by name and purpose.
07

The verification toolkit: reading switching output

A doctor does not guess. She measures temperature, pulse and pressure, and each number answers one question. A network engineer does the same with show commands. In this chapter you learn which command answers which question, and how to read the columns, so that in the next chapter you can find a fault in minutes instead of hours.

One question, one command

QuestionCommand
Is the cable and port up?show interfaces terse
Which VLANs exist and which ports are in them?show vlans
What mode and which VLANs does one port carry?show ethernet-switching interface ge-0/0/0 detail
Which MAC was learned where?show ethernet-switching table
Is the gateway up and is the subnet routed?show interfaces terse irb, show route
Can I reach the neighbour end to end?ping, traceroute
What did someone change?show system commit, show configuration, show | compare rollback 1
1 Physicalinterfaces terse 2 Switchingfamily, mode 3 VLANsboth trunk ends 4 MAC tablelearned where 5 Layer 3IRB, gateway Work from the bottom up. Stop at the first layer that is wrong.

The five-step method used in every troubleshooting lab.

Step 1: the physical layer

lab@ACC> show interfaces terse
Interface               Admin Link Proto    Local                 Remote
ge-0/0/0                up    up
ge-0/0/0.0              up    up   eth-switch
ge-0/0/1                up    up
ge-0/0/1.0              up    up   eth-switch
ge-0/0/3                up    down

Admin is what the configuration says, Link is what the cable says. up down means the port is enabled but nothing is connected or the other side is down. The Proto eth-switch on unit 0 proves that family ethernet-switching is configured. A physical port with no unit 0 line does not switch.

Steps 2 and 3: switching family and VLAN membership

lab@ACC> show ethernet-switching interface
Logical         Vlan      TAG    MAC     MAC+IP  STP         Logical     Tagging
interface       members          limit   limit   state       interface flags
ge-0/0/1.0                       294912  294912                          untagged
                STAFF     30     294912  294912  Forwarding              untagged
ge-0/0/2.0                       294912  294912                          tagged
                STAFF     30     294912  294912  Forwarding              tagged

This is the single most useful switching table. For each port it shows the VLAN, the tag, the spanning-tree state and whether frames are tagged or untagged. Here ge-0/0/2 is tagged, which is correct for a trunk but wrong for a PC. It is a real excerpt of the Lab 3 fault captured from the simulator.

Use the detail form for one port when you need the mode and native VLAN. The line Interface mode : trunk, native VLAN STAFF (30) tells you the role and the native VLAN in one go.

Step 4: the MAC table as a proof

lab@ACC> show ethernet-switching table
Ethernet switching table : 2 entries, 2 learned
Routing instance : default-switch
   Vlan   MAC                 MAC    Age    Logical
   name   address             flags         interface
   SALES  00:50:7f:06:6d:01   D      -      ge-0/0/1.0
   ENG    00:50:80:06:6e:01   D      -      ge-0/0/2.0

If a host's MAC appears in the right VLAN on the right port, Layer 2 is fine up to that point. If the MAC is missing, the frames are not reaching the switch (cable, port, VLAN mismatch, or the host is silent). If it appears in the wrong VLAN, the port membership or the native VLAN is wrong.

Step 5: Layer 3

Check show interfaces terse irb and show route from the previous chapter. Then ping from the host to its gateway first, and only then to remote subnets. A host that reaches its gateway but not another VLAN points at routing, not at switching.

Change history

When something worked yesterday, ask what changed. show system commit lists commits with user and time; show | compare rollback 1 in configuration mode shows the difference between the active configuration and the previous one.

Worked example. PC2 on ACC ge-0/0/2 cannot reach its gateway. Step 1: link up. Step 2: show ethernet-switching interface shows ge-0/0/2 as tagged. A PC sends untagged frames, so a trunk with no native VLAN drops them. Fix: set interface-mode access. Verify: the MAC of PC2 now appears in the table and the gateway ping works. Five minutes and three commands.

Common mistakes. Starting at Layer 3 (pinging) when the cable is unplugged. Looking at only one end of a trunk. Trusting a configuration without checking the operational state: the configuration may be right while the port is up down. Forgetting that the asterisk in show vlans marks an up interface.

Exam trap. The exam shows output and asks what is wrong. Look for tagged versus untagged, the native VLAN line, a missing VLAN in the member list, and an IRB that is up/down.

Ten minutes instead of two hours

A new engineer spent two hours re-entering gateway settings on a PC that could not reach the network. A colleague ran show ethernet-switching interface on the access switch and saw that the port had been left as a trunk by the previous tenant of the desk. One line changed the port to access mode.

Lesson: start at the switch port, not at the PC.

"A user cannot reach the network. What do you check on the switch?"

Bottom up: link state with show interfaces terse, port mode and VLAN with show ethernet-switching interface, the MAC table to see whether the host's MAC is learned in the expected VLAN, then the IRB gateway and routes. Finish with show system commit if it used to work.

Key takeaways

  • Work bottom up: link, switching family, VLAN membership, MAC table, Layer 3.
  • show ethernet-switching interface reveals tagged versus untagged and the STP state.
  • The detail form shows the port mode and the native VLAN.
  • Use show system commit to find what changed.
08

Troubleshooting workflow: the Monday morning ticket

This chapter walks through Lab 3, the Hyderabad ticket, step by step, exactly the way you should work in the simulator and in a real network. The ticket reads: "After the weekend change, staff users on ACC cannot reach their gateway, the printer VLAN is dead and CORE cannot manage ACC over the untagged management VLAN." Three symptoms, probably more than one cause.

The design (what should be true)

  • Trunk ge-0/0/0 between CORE and ACC carries STAFF (30), PRINT (40) and MGMT (99).
  • MGMT is the native VLAN on both ends. CORE routes with irb.30, irb.40 and irb.99 (gateways 10.30.0.1, 10.40.0.1, 10.99.0.1). ACC manages itself on irb.99 = 10.99.0.2.
  • User ports are access ports: ge-0/0/1 and ge-0/0/2 are STAFF (PC1, PC2); ge-0/0/3 is PRINT (the printer PRN1).
CORE ACC trunk, native MGMT PC1 ge-0/0/1 PC2 ge-0/0/2 PRN1 ge-0/0/3

Lab 3: one trunk, three user ports, three VLANs and a management address.

Step 1: inspect the trunk on ACC

Start with the shared link, because it carries everything. Real output from the faulty ACC:

lab@ACC> show ethernet-switching interface ge-0/0/0 detail
Logical Interface          : ge-0/0/0.0
  State                    : up
  Interface mode           : trunk, native VLAN STAFF (30)
  VLAN membership          :
    STAFF                 30    untagged  Forwarding

Two faults at once. The native VLAN is STAFF instead of MGMT, and only STAFF is in the member list: PRINT and MGMT are not carried at all. Confirm with the configuration:

lab@ACC> show configuration interfaces ge-0/0/0
native-vlan-id STAFF;
unit 0 {
    family ethernet-switching {
        interface-mode trunk;
        vlan {
            members STAFF;
        }
    }
}

Step 2: look at the user ports

lab@ACC> show ethernet-switching interface
ge-0/0/2.0                       294912  294912                          tagged
                STAFF                    30      294912  294912  Forwarding                    tagged
ge-0/0/3.0                       294912  294912                          untagged
                PRINT                    40      294912  294912  Forwarding                    untagged

ge-0/0/1 (PC1) is fine, untagged in STAFF. But ge-0/0/2 (PC2) is a trunk with tagged STAFF. PC2 sends untagged frames and the port has no native VLAN, so they are dropped. The printer port ge-0/0/3 is correct, so its failure comes from the uplink: PRINT is missing from the trunk members.

Step 3: confirm symptoms before fixing

lab@CORE> ping 10.99.0.2 count 3
3 packets transmitted, 0 packets received, 100% packet loss

PRN1> ping 10.40.0.1
host (10.40.0.1) not reachable

Both match the diagnosis. It is good habit to record the failing tests so that you can repeat exactly the same test after the fix.

Step 4: fix all three faults in one commit

configure
set interfaces ge-0/0/0 native-vlan-id MGMT
set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members PRINT
set interfaces ge-0/0/2 unit 0 family ethernet-switching interface-mode access
show | compare
commit and-quit
lab@ACC# show | compare
[edit interfaces ge-0/0/0]
-   native-vlan-id STAFF;
+   native-vlan-id MGMT;
[edit interfaces ge-0/0/0 unit 0 family ethernet-switching vlan]
-   members STAFF;
+   members [ STAFF PRINT ];
[edit interfaces ge-0/0/2 unit 0 family ethernet-switching]
-   interface-mode trunk;
+   interface-mode access;

Note that the trunk's member list never contained MGMT. Junos accepts a native VLAN that is not listed in the members and still carries its untagged traffic; the verification output below shows MGMT as untagged. Read the show | compare output carefully: it is a three-line proof that you changed only what you meant to change.

Step 5: verify

lab@CORE> ping 10.99.0.2 count 3
3 packets transmitted, 3 packets received, 0% packet loss

PC1> ping 10.40.0.50
84 bytes from 10.40.0.50 icmp_seq=1 ttl=63 time=0.500 ms

lab@ACC> show ethernet-switching interface ge-0/0/0 detail
  Interface mode           : trunk, native VLAN MGMT (99)
  VLAN membership          :
    STAFF                 30    tagged    Forwarding
    PRINT                 40    tagged    Forwarding
    MGMT                  99    untagged  Forwarding

The end-to-end test, PC1 printing to PRN1 across two VLANs, works with TTL 63: one routed hop through CORE.

Worked example: the checklist. (1) Compare both ends of every trunk. (2) Check the mode of every user port. (3) Compare the VLAN list on both ends. (4) Confirm the native VLAN on both ends. (5) Only then test Layer 3. In Lab 3 the faults sat at steps 2, 3 and 4.

Common mistakes. Fixing one fault, testing, and stopping when one symptom disappears; tickets often hide several causes. Changing the CORE side to match a wrong ACC. The design said MGMT native, so the reference is the design, not the other end. Skipping show | compare.

Exam trap. A question may show two detail outputs and ask why untagged traffic fails: compare the native VLAN lines. If a VLAN works on one switch but not across the trunk, look at the member lists.

Fixing the wrong end

An engineer saw native VLAN STAFF on ACC and MGMT on CORE and changed CORE to STAFF "so they match". Management worked, but the printers and the design document were now wrong, and another switch further down, which also expected MGMT, lost contact. A reviewer compared against the design and reverted CORE with rollback 1, then fixed ACC.

Lesson: match the design, not the neighbour.

"Users on one VLAN lost connectivity after a change window. How do you approach it?"

Gather the symptoms and the design, work bottom up, compare both ends of the trunk, check port modes and member lists, look at show system commit for the change, fix against the design, and verify with the same tests that failed. Mention that you would use commit confirmed if the change could cut your own access.

Key takeaways

  • Start at the shared trunk, then the user ports, then Layer 3.
  • A tagged user port, a wrong native VLAN and a missing member VLAN are the classic three Layer 2 faults.
  • Always fix against the design and review with show | compare.
  • Re-run the failing tests after the fix.
09

Summary and exam checklist

You started with a clerk who remembers which corridor each desk is on, and ended with a campus where VLANs are floors, trunks are lift shafts and IRB is the reception desk. This chapter pulls everything into one page you can revise the night before the exam or an interview.

MAC tablelearn, flood VLANsaccess ports Trunks802.1Q, native IRBinter-VLAN Verifybottom up Next: spanning tree keeps this design loop-free

The five building blocks of Layer 2 switching on EX.

Can-do checklist

  • I can explain learn, forward, flood and filter and read show ethernet-switching table.
  • I can create VLANs with set vlans NAME vlan-id N and attach access ports on ELS.
  • I can build a trunk with interface-mode trunk vlan members [ ... ] and set the native VLAN on the physical interface.
  • I can create IRB units, bind them with l3-interface and explain the Direct and Local routes and the TTL drop.
  • I can use interface ranges and descriptions on a larger switch.
  • I can find a trunk, native VLAN or port-mode fault bottom up, fix it and prove it.

Mini glossary

Broadcast domain
The set of ports that receive a broadcast; one per VLAN.
Access port
One VLAN, untagged frames, for an end device.
Trunk port
Many VLANs, tagged frames, between switches.
802.1Q
The standard that adds a 4-byte tag with a 12-bit VLAN ID.
Native VLAN
VLAN for untagged frames on a trunk; none by default on Junos.
IRB
Integrated routing and bridging: the Layer 3 interface of a VLAN (irb.N).
ELS
Enhanced Layer 2 Software, the current EX configuration style.
MAC move
The same source MAC appears on a different port; the entry is updated.

Most tested facts

FactValue
Valid VLAN IDs1 to 4094 (12 bits)
Default VLANdefault, ID 1
MAC age-out default300 seconds
Tag size4 bytes, TPID 0x8100
Default native VLAN on a Junos trunkNone; untagged frames are dropped
Where native-vlan-id goesPhysical interface, not unit 0
IRB bindingset vlans NAME l3-interface irb.N
Routed TTLDecreases by one per Layer 3 hop

Command cheat-sheet

show interfaces terse
show vlans
show ethernet-switching table
show ethernet-switching interface ge-0/0/0 detail
show interfaces terse irb
show route
show system commit
clear ethernet-switching table

Worked example: a 60-second self test. A PC in VLAN 20 on ge-0/0/5 cannot reach 10.10.20.1. Which three checks, in which order? Answer: show interfaces terse ge-0/0/5 (link), show ethernet-switching interface ge-0/0/5 detail (access, VLAN 20, untagged), then show interfaces terse irb (is irb.20 up).

Last-minute reminders. A VLAN is not a subnet. A trunk that carries the VLAN on one end only does not carry it. Native VLAN differences cause silent faults. Always show | compare before commit.

Exam trap summary. ELS versus legacy keywords (interface-mode and l3-interface irb.N are ELS), no default native VLAN, and the fact that IRB is up only when a port in the VLAN is up.

From ticket to proof in four commands

A new branch switch was installed and the first desk could not get an address. The engineer ran show interfaces terse (link up), show ethernet-switching interface (port in default VLAN, not in USERS), fixed the VLAN membership, and confirmed with show ethernet-switching table that the PC's MAC appeared in USERS.

Lesson: a short, repeatable method beats clever guessing.

"Walk me through building a two-VLAN campus access layer on Junos."

Define the VLANs by name and ID, put user ports in access mode in the right VLAN, build a trunk to the distribution switch carrying both VLANs with an agreed native VLAN, create an IRB per VLAN on the distribution switch bound with l3-interface, point hosts to the IRB addresses and verify bottom up with show vlans, show ethernet-switching interface, the MAC table and a ping across VLANs showing TTL 63.

Key takeaways

  • MAC learning, VLANs, trunks and IRB are the four ideas behind every campus switch design.
  • On Junos a trunk has no native VLAN unless you configure one on both ends.
  • IRB gives each VLAN a gateway and routes with TTL decreased by one.
  • Verify bottom up and fix against the design.
  • Next module: Spanning Tree, which keeps redundant links from creating loops.
🎓 For educational purposes only — all devices are simulationsTerms of UsePrivacy Policy© 2026 Network Kings
CONFIG by Network Kings — an educational IT simulation platform for learning purposes only. It is not Cisco IOS, Junos, FortiOS or PAN-OS and contains no Cisco, Juniper, Fortinet or Palo Alto Networks software. Cisco, IOS, CCNA, CCNP, Juniper, JNCIA, JNCIS, JNCIP, Fortinet, FortiGate, FortiOS, NSE, Palo Alto Networks, PAN-OS and PCNSE are trademarks of their respective owners. Network Kings is not affiliated with or endorsed by Cisco Systems, Inc., Juniper Networks, Inc., Fortinet, Inc. or Palo Alto Networks, Inc.