Layer 2 security is crucial for protecting the foundational communication layer of a network from various threats, such as loops, spoofing, and broadcast storms.
Layer 2 networks are vulnerable to specific types of attacks because they rely on direct communication between devices without the stronger security controls found in higher layers.
Threats to Layer 2 Networks:
Goal of Layer 2 Security: Protect the network by preventing unauthorized devices from influencing switch behavior, validating the integrity of network traffic, and controlling excessive traffic.
Port Security prevents unauthorized devices from using a switch port. This is critical for controlling access in sensitive or high-security environments.
Although features like PortFast, BPDU Guard, and Root Guard originated in the Cisco world, Junos provides equivalent mechanisms with different command structures. In the JN0-351 exam, questions will often describe behavior rather than using the Cisco term directly.
For example:
| Cisco Term | Junos Equivalent | Behavior-Based Description (exam-style) |
|---|---|---|
| PortFast | edge |
Marks port as connected to an end device, bypasses STP delay |
| BPDU Guard | bpdu-block-on-edge |
Disables port if BPDU is received unexpectedly |
| Root Guard | no-root-port |
Prevents a port from becoming a root port in STP topology |
Sample Junos Configuration:
set protocols rstp interface ge-0/0/1 edge
set protocols rstp interface ge-0/0/1 bpdu-block-on-edge
Exam Tip: You are more likely to see descriptions like “disables an access port upon receiving a BPDU” rather than the term “BPDU Guard.” Understanding function is more important than terminology.
Layer 2 security mechanisms often have default behaviors that differ from their full potential, and Junos exam questions may test your understanding of what needs to be explicitly configured.
Take Dynamic ARP Inspection (DAI) for example:
DAI uses a binding table to validate ARP packets.
By default, Junos DAI only verifies dynamic DHCP bindings.
If a host uses a static IP, it must have a manually configured static binding, or its packets may be dropped.
This can lead to questions like:
“DAI will drop packets from a valid host under which condition?”
Correct answer: When the host uses a static IP and no static binding is present.
This behavior highlights the difference between simply enabling a feature and ensuring its supporting configurations are in place.
Features like DAI and IP Source Guard both depend on DHCP Snooping to generate and maintain the binding table of MAC, IP, and interface mappings.
| Feature | DHCP Snooping Required | Why it’s needed |
|---|---|---|
| Dynamic ARP Inspection (DAI) | Yes | Validates ARP replies against DHCP-learned entries |
| IP Source Guard | Yes | Filters based on IP-MAC-port mapping from DHCP info |
| MAC Limiting | No | Operates independently of DHCP; can use static rules |
Configuration Example:
set ethernet-switching-options secure-access-port interface ge-0/0/3 dynamic-arp-inspection
set ethernet-switching-options secure-access-port interface ge-0/0/3 ip-source-guard
set forwarding-options dhcp-security group TRUSTED interface ge-0/0/3
Exam Tip:
DAI and IP Source Guard will not function without DHCP Snooping, even if configured. Be prepared for exam questions that test this dependency explicitly.
MACsec (Media Access Control Security) is a Layer 2 encryption standard that secures Ethernet traffic between directly connected devices. However, on Juniper platforms, MACsec has strict hardware support requirements.
Key points about MACsec in Junos:
It is not enabled by default and requires both software and hardware support.
Only specific platforms like the QFX5200/QFX10000 and certain EX-series switches support it.
It is limited to point-to-point links and cannot be used in broadcast/multi-access topologies.
| Feature | MACsec in Junos |
|---|---|
| Encryption Layer | Layer 2 (Data Link) |
| Topology Support | Only point-to-point |
| Hardware Required | Yes – limited to specific interfaces/devices |
| Configuration | Uses security family and MKA or PSK keys |
Exam Tip:
Expect phrasing like:
“Which condition must be met to enable MACsec in Junos?”
Correct answer: The platform must support it and MACsec-capable interfaces must be used.
| Concept | Exam-Relevant Insight |
|---|---|
| BPDU-based protection | Know behavior (e.g., disabling port upon BPDU receipt), not just the term |
| DAI default logic | Checks only dynamic bindings unless static entries are configured |
| Feature dependencies | DAI and IP Source Guard require DHCP Snooping |
| MACsec availability | Hardware-dependent; not supported on all platforms; limited to P2P links |
What is the purpose of DHCP snooping in a Layer 2 network?
DHCP snooping prevents rogue DHCP servers from distributing incorrect IP addresses.
DHCP snooping classifies switch ports as trusted or untrusted. Only trusted ports are allowed to send DHCP server responses. If an unauthorized device attempts to act as a DHCP server, the switch drops the packets.
This protects networks from attacks where a rogue DHCP server provides incorrect gateway or DNS settings, redirecting traffic. DHCP snooping also builds a binding table that records IP-to-MAC mappings, which can be used by other security features such as IP source guard.
Demand Score: 74
Exam Relevance Score: 85
What is MAC flooding and how can a switch defend against it?
MAC flooding is an attack that overwhelms the switch’s MAC table, forcing it to flood frames.
In a MAC flooding attack, the attacker sends thousands of frames with different source MAC addresses. The switch fills its forwarding table and begins broadcasting traffic to all ports.
This can allow an attacker to capture traffic that should not normally reach their port. Switches defend against this using port security, MAC limits, or storm control, which restrict the number of learned MAC addresses per interface.
Demand Score: 70
Exam Relevance Score: 80
Why would a network administrator enable Dynamic ARP Inspection?
To prevent ARP spoofing attacks.
ARP spoofing occurs when a malicious device sends forged ARP messages to associate its MAC address with another device’s IP address, often the default gateway.
Dynamic ARP Inspection (DAI) validates ARP packets using the DHCP snooping binding table. If the ARP message does not match the expected IP-to-MAC mapping, the switch drops it.
This protects networks from man-in-the-middle attacks, where attackers intercept or modify traffic.
Demand Score: 69
Exam Relevance Score: 78