My previous JNCIS-ENT lab started clean and professional, the way labs always do. VLANs, STP, some OSPF. Then I added EVPN-VXLAN "just to see how it fits." Then MPLS L3VPN appeared because I was already in the neighborhood. Somewhere around week six, the topology had more tunnel interfaces than physical routers, I had no idea what half the config was doing anymore, and I had completely forgotten what I was supposed to be studying for. Then I had to take a month off for military service, came back, looked at the topology, and couldn't remember what any of it was supposed to be doing. So I nuked it, opened a blank PNETLab project, and started over. The exam is next week, which is fine, everything is fine.
THE LAB
Before getting into switch config, here is the full topology so you know where the pieces sit.
This is a collapsed-core enterprise topology. SW1 and SW2 are pure Layer 2 distribution switches: VLANs, trunking, LAG, STP, and L2 security. They do not perform inter-VLAN routing. That job belongs to R1 and R2, which each have dot1q subinterfaces with VRRP virtual IPs acting as the actual default gateways for VLAN10 and VLAN20. The FortiGate HA pair sits at the perimeter between the enterprise core and a simulated ISP. R4 is the branch, connected to R2 via GRE and IP-in-IP tunnels.
VLANS AND PORT ROLES
VLANs divide a single physical switch into isolated broadcast domains. Frames stay within their VLAN until something at Layer 3 explicitly routes between them, which in this topology is R1 and R2, not the switches. 802.1Q trunks carry multiple VLANs over a single link by tagging each frame with a VLAN ID, which is how the uplinks to the routers can carry both VLAN10 and VLAN20 traffic simultaneously.
Both switches carry VLAN10 and VLAN20. The host-facing ports are access, the uplinks to R1 and R2 are trunk, and the LAG between the switches is trunk for both VLANs. Simple enough.
On SW1, xe-0/0/2 connects HOST1 and lives in VLAN10. The uplink to R1 on xe-0/0/3 is an 802.1Q trunk carrying both VLANs.
set vlans v10 vlan-id 10set vlans v10 l3-interface irb.10set vlans v20 vlan-id 20set vlans v20 l3-interface irb.20set interfaces xe-0/0/2 description ACCESS-to-VLAN10set interfaces xe-0/0/2 unit 0 family ethernet-switching interface-mode accessset interfaces xe-0/0/2 unit 0 family ethernet-switching vlan members v10set interfaces xe-0/0/3 description UPLINK-to-R1set interfaces xe-0/0/3 unit 0 family ethernet-switching interface-mode trunkset interfaces xe-0/0/3 unit 0 family ethernet-switching vlan members v10set interfaces xe-0/0/3 unit 0 family ethernet-switching vlan members v20The l3-interface irb.10 and irb.20 lines are for switch management reachability in this lab; R1 and R2 still provide the actual VLAN default gateways.
THE LAG
A LAG bundles multiple physical links into a single logical interface, giving you combined bandwidth and link-level redundancy. LACP is the control protocol that negotiates and maintains the bundle: it handles member link discovery, monitors link health, and ensures both sides agree on which ports are active. Without it you're doing static LAG, which works until something goes wrong and you have no dynamic way to detect it.
ae0 is a two-link LACP LAG between SW1 and SW2, carrying both VLANs as a trunk. Before ae0 can exist, you need to tell Junos how many aggregated Ethernet devices to create. This has to commit before the ae0 interface config, or the ae0 stanzas will fail silently and leave you wondering why the interface isn't there.
set chassis aggregated-devices ethernet device-count 1Commit that alone first, then continue. With that done, the member interfaces just need a single ether-options line pointing them at ae0:
set interfaces xe-0/0/0 description LAG-to-SW2set interfaces xe-0/0/0 ether-options 802.3ad ae0set interfaces xe-0/0/1 description LAG-to-SW2set interfaces xe-0/0/1 ether-options 802.3ad ae0The ae0 interface itself runs LACP active with fast timers and trunks both VLANs:
set interfaces ae0 description LAG-to-SW2set interfaces ae0 aggregated-ether-options lacp activeset interfaces ae0 aggregated-ether-options lacp periodic fastset interfaces ae0 unit 0 family ethernet-switching interface-mode trunkset interfaces ae0 unit 0 family ethernet-switching vlan members v10set interfaces ae0 unit 0 family ethernet-switching vlan members v20Both sides are lacp active, so either switch will initiate negotiation. Fast timers mean LACP PDUs every second instead of every 30, which speeds up failure detection. Once both switches have this committed, show lacp interfaces ae0 should show both member links in Collecting-Distributing state. If you see Attached, LACP negotiation hasn't completed, so double-check that the other switch also has lacp active on ae0.
RSTP
RSTP prevents Layer 2 loops by electing a root bridge and blocking redundant paths. The root is the switch with the lowest bridge priority, and every other switch determines which of its ports is the shortest path back to the root. Ports that would create a loop get put in discarding state. RSTP is the "rapid" version of the original 802.1D STP, with faster convergence through port roles and handshakes instead of timers.
SW1 is the RSTP root for both VLANs, SW2 is the secondary. Bridge priority uses power-of-two values: 4096 (4k) for root, 8192 (8k) for secondary.
# SW1set protocols rstp bridge-priority 4k# SW2set protocols rstp bridge-priority 8kHost access ports are marked edge so they come up immediately without going through the listening/learning cycle. bpdu-block-on-edge is the matching safeguard: if an edge port receives a BPDU, it shuts down rather than letting something unexpected participate in the topology.
set protocols rstp interface xe-0/0/2 edgeset protocols rstp bpdu-block-on-edgeThe uplink on xe-0/0/3 gets no-root-port on both switches so neither can elect its own router-facing port as the root port. Routers don't run STP, so there is no legitimate path to the root bridge through xe-0/0/3, and allowing it to become a root port candidate would risk a loop if someone ever bridged router interfaces.
Both switches also get bpdu-timeout-action block on ae0: if BPDUs from the peer switch stop arriving, the port blocks rather than transitioning to forwarding. This protects against unidirectional link failures where the physical link stays up but BPDU delivery breaks.
# SW1set protocols rstp interface xe-0/0/3 no-root-portset protocols rstp interface ae0 bpdu-timeout-action block# SW2set protocols rstp interface xe-0/0/3 no-root-portset protocols rstp interface ae0 bpdu-timeout-action blockRTG ON SW2
Redundant Trunk Groups are a JNCIS-ENT exam objective. The idea: designate a primary uplink (xe-0/0/3 toward R2) and a backup (ae0 toward SW1), with a 60-second cutover timer. If the primary goes down, the RTG falls back to ae0 after the timer expires.
# SW2 — RTG config (exam reference)set interfaces xe-0/0/3 unit 0 family ethernet-switching redundant-parent rtg0set interfaces ae0 unit 0 family ethernet-switching redundant-parent rtg0set switch-options redundant-trunk-group group rtg0 interface xe-0/0/3.0 primaryset switch-options redundant-trunk-group group rtg0 preempt-cutover-timer 60Worth noting: vQFX does not support RTG and will reject this at commit. The config is correct and the exam will test the concept, but you can only verify it on physical QFX hardware. If you're following along in PNETLab, configure it for reference and move on.
L2 SECURITY
This is the part I clearly needed to spend more time on instead of building EVPN topologies. Four mechanisms: MAC limiting, DAI, storm control, and an ARP rate-limiting firewall filter.
MAC LIMITING
The switch learns MAC addresses dynamically by watching source MACs on incoming frames and recording which port they arrived on. MAC limiting caps how many entries a port can learn, which stops a host from flooding the MAC table with spoofed addresses and forcing the switch into hub-like behavior where it broadcasts everything.
Five MACs maximum on the HOST access port, drop action on anything beyond that.
set switch-options interface xe-0/0/2.0 interface-mac-limit 5set switch-options interface xe-0/0/2.0 interface-mac-limit packet-action dropDAI
Dynamic ARP Inspection validates ARP packets against a MAC-to-IP binding table. In a production network, that table gets built automatically by DHCP snooping. This lab has no DHCP server and statically addressed hosts, so the bindings are manual.
DAI is configured under the VLAN stanza, not under the interface. SW1 handles VLAN10, SW2 handles VLAN20. The uplinks and ae0 are marked trusted so switch-to-switch and switch-to-router ARP isn't inspected.
# SW1 — DAI for VLAN10set vlans v10 forwarding-options dhcp-security arp-inspectionset vlans v10 forwarding-options dhcp-security group TRUSTED-PORTS overrides trustedset vlans v10 forwarding-options dhcp-security group TRUSTED-PORTS interface xe-0/0/3.0set vlans v10 forwarding-options dhcp-security group TRUSTED-PORTS interface ae0.0set vlans v10 forwarding-options dhcp-security group HOSTS interface xe-0/0/2.0 static-ip 10.10.10.100 mac 50:80:4a:01:f1:00STORM CONTROL
A broadcast storm happens when flooded traffic gets amplified by loops or misbehaving hosts until it consumes all available bandwidth. Storm control monitors traffic rates per port and drops or shuts down the port when a threshold is exceeded, stopping the flood before it takes down the segment.
10% bandwidth limit on host ports, drop unknown unicast and multicast, shut the port down if the limit is exceeded.
set forwarding-options storm-control-profiles HOST-STORM all bandwidth-percentage 10set forwarding-options storm-control-profiles HOST-STORM all no-unknown-unicastset forwarding-options storm-control-profiles HOST-STORM all no-multicastset forwarding-options storm-control-profiles HOST-STORM action-shutdownset interfaces xe-0/0/2 unit 0 family ethernet-switching storm-control HOST-STORMARP FIREWALL FILTER
ARP is unauthenticated by design, which makes it a convenient vector for flooding and spoofing attacks even on a port where DAI is already inspecting bindings. An ARP broadcast storm can saturate CPU on both hosts and switches because ARP packets get punted to the control plane for processing rather than handled purely in hardware. The firewall filter handles this at the rate level independently of whether the ARP is valid.
Storm control handles volume, but we also want to rate-limit ARP specifically at the packet level. The LIMIT-ARP filter matches ARP ethertype, counts it, and hands it to a policer. Everything else passes.
set firewall family ethernet-switching filter LIMIT-ARP term arp-rate from ether-type arpset firewall family ethernet-switching filter LIMIT-ARP term arp-rate then count ARP-HIT-COUNTset firewall family ethernet-switching filter LIMIT-ARP term arp-rate then policer ARP-POLICERset firewall family ethernet-switching filter LIMIT-ARP term default then acceptset firewall policer ARP-POLICER if-exceeding bandwidth-limit 1mset firewall policer ARP-POLICER if-exceeding burst-size-limit 15kset firewall policer ARP-POLICER then discardThe policer allows 1 Mbps of ARP with a 15KB burst. Anything over that gets discarded. The counter on the first term is useful for verification: show firewall filter LIMIT-ARP will show you how many ARP packets have hit the filter.
The filter applies inbound on the host access port, alongside storm control:
set interfaces xe-0/0/2 unit 0 family ethernet-switching filter input LIMIT-ARPIRB AND OSPF PASSIVE
Each switch has IRB interfaces in both VLANs, but they are not default gateways. They exist so you can reach the switch management addresses (10.10.10.11/24 and 10.20.20.11/24 on SW1, .12 addresses on SW2) and so OSPF can advertise the switch loopbacks into the routing domain.
set interfaces irb unit 10 family inet address 10.10.10.11/24set interfaces irb unit 20 family inet address 10.20.20.11/24set interfaces lo0 unit 0 family inet address 10.0.0.11/32set protocols ospf area 0.0.0.0 interface irb.10 passiveset protocols ospf area 0.0.0.0 interface irb.20 passiveset protocols ospf area 0.0.0.0 interface lo0.0 passivePassive means OSPF advertises these prefixes but will not try to form adjacencies out of them. The switches participate in OSPF for reachability, not for routing.
CONCLUSION
That covers the full L2 foundation: VLANs, 802.1Q trunking, LACP LAG, RSTP with edge and protection knobs, MAC limiting, DAI with static bindings, storm control, and ARP rate-limiting. Everything verified on vQFX in PNETLab except RTG, which the virtual image politely refuses to touch. Next up is R1 and R2: dot1q subinterfaces, VRRP split active-active across VLAN10 and VLAN20, OSPF area 0, and BFD on the core P2P link.
