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.
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.