Layer 2 Security · Topic 3 of 4
MACsec and Storm Control
Learn Junos MACsec link encryption with connectivity associations and MKA, and storm control profiles that limit broadcast, multicast and unknown unicast.
- 6 min
- MACsec is IEEE 802.1AE: Layer 2, hop by hop, encrypts everything after the MAC addresses.
- MKA manages the keys; the CAK is the shared secret and the CKN is its name. Static CAK needs identical values at both ends.
security macsec connectivity-associationdefines it;security macsec interfaceapplies it.
What it is
MACsec (IEEE 802.1AE) encrypts and authenticates Ethernet frames on a single link. It protects against eavesdropping and tampering on the wire, for example on a link that leaves a secure room. It works at Layer 2, hop by hop, so each switch decrypts and re-encrypts frames when it forwards them.
Storm control limits the amount of broadcast, unknown unicast and multicast traffic on a port. A broadcast storm, from a loop or a faulty network card, can use all the bandwidth and the CPU of every device in the VLAN. Storm control drops the excess traffic.
How it works
MACsec basics
MACsec encrypts the payload of each frame and adds a security tag (SecTAG) and an integrity check value (ICV). The source and destination MAC addresses stay in the clear, so switches can still forward the frame. The tag and ICV together add up to 32 bytes per frame.
| MACsec | IPsec | |
|---|---|---|
| Layer | 2 | 3 |
| Scope | One link, hop by hop | End to end between peers |
| Standard | IEEE 802.1AE | IETF RFCs |
| Frames protected | All Ethernet frames, including ARP | IP packets |
The keys are managed by the MACsec Key Agreement (MKA) protocol, from IEEE 802.1X. Two ends form a connectivity association (CA). The CA uses a connectivity association key (CAK), which is the shared secret, and a connectivity association key name (CKN), which identifies it. MKA uses the CAK to create and rotate the session keys that encrypt traffic.
With static CAK mode, you configure the same CKN and CAK on both ends. This is the usual mode for switch to switch links. With dynamic CAK mode, 802.1X authentication provides the key for host links.
user@switch# set security macsec connectivity-association CA1 security-mode static-cak
user@switch# set security macsec connectivity-association CA1 pre-shared-key ckn 37c9c2c45ddd012b4ab0f2d63b2d1d3ad8f6e7b4a5c1e0f9d3c2b1a0987654fe
user@switch# set security macsec connectivity-association CA1 pre-shared-key cak 228ef255aa23ff6729ee664acb66e91f
user@switch# set security macsec interface ge-0/0/24 connectivity-association CA1
The CKN and CAK are hexadecimal strings. The CAK for 128 bit encryption is 32 hexadecimal digits long. The other end must use the same values. The first line creates the association in static CAK mode, the next two lines set its keys and the last line applies it to the interface.
MACsec is supported only on certain interfaces and platforms, so a port that does not support it cannot take the configuration.
user@switch> show security macsec connections
user@switch> show security mka sessions
user@switch> show security macsec statistics
show security mka sessions shows whether the key agreement is up. If the CAK or CKN differ at the two ends, the session does not form and traffic does not pass when MACsec is required.
When a MACsec link fails after a configuration change, compare the CKN and CAK on both ends first. One wrong digit keeps the MKA session down.
Storm control
Storm control is configured with a profile applied to an interface. The profile sets the allowed level of flooded traffic, and traffic above it is dropped.
user@switch# set forwarding-options storm-control-profiles SC1 all bandwidth-percentage 30
user@switch# set interfaces ge-0/0/1 unit 0 family ethernet-switching storm-control SC1
The all option applies the limit to broadcast, unknown unicast and multicast traffic together. You can exclude a type from the check with no-broadcast, no-multicast, no-unknown-unicast or no-registered-multicast.
user@switch# set forwarding-options storm-control-profiles SC1 all no-multicast
| Statement | Effect |
|---|---|
all | Limit broadcast, unknown unicast and multicast traffic |
bandwidth-percentage N | Limit as a percentage of port bandwidth |
bandwidth-level N | Limit as a rate in kilobits per second |
no-broadcast, no-multicast, no-unknown-unicast | Leave that traffic type out of the check |
action-shutdown | Disable the port when the limit is exceeded |
On ELS EX switches, the factory default configuration enables storm control on all interfaces at 80 percent of the bandwidth, through a profile named default. Which flooded traffic types that default covers varies by platform. A profile of your own replaces it on the interfaces it is applied to.
With action-shutdown the port is disabled when the limit is exceeded, and stays down until it is brought back. Without it, only the excess is dropped and the port stays up.
Monitoring and troubleshooting storm control
- Check the committed profile with
show configuration forwarding-options storm-control-profiles. - Check that the interface has the profile with
show configuration interfaces ge-0/0/1. - Look for storm control messages in the system log with
show log messages. - If a port went down by itself, an
action-shutdownprofile may have triggered it, so look for the cause of the flood, such as a loop.
Storm control cannot tell a legitimate burst from an attack, so a limit that is too low also drops valid broadcasts such as ARP and DHCP.
Common mistakes
Treating MACsec as end to end encryption. It protects one link, and traffic is clear inside each switch.
Different keys at the two ends. The CKN and CAK must match exactly.
Expecting storm control to fix the loop. It limits the damage, but the loop must still be found and removed, for example with spanning tree.
Forgetting to apply the profile. A profile under forwarding-options does nothing until an interface refers to it.
What to remember for the exam
- MACsec is IEEE 802.1AE: Layer 2, hop by hop, encrypts everything after the MAC addresses.
- MKA manages the keys; the CAK is the shared secret and the CKN is its name. Static CAK needs identical values at both ends.
security macsec connectivity-associationdefines it;security macsec interfaceapplies it.show security mka sessionsshows the key agreement status.- Storm control limits broadcast, unknown unicast and multicast traffic with a profile applied to an interface unit.
- The ELS factory default is 80 percent of bandwidth for flooded traffic; the traffic types covered vary by platform.
action-shutdowndisables the port when the limit is exceeded.
Check yourself
What does the CKN do in MACsec?
It names the connectivity association, and both ends must hold the same CKN and CAK for MKA to form a session.
What is the difference between MACsec and IPsec scope?
MACsec protects one Layer 2 link hop by hop, while IPsec protects IP packets end to end.
Where is a storm control profile defined and where is it applied?
It is defined under
forwarding-options storm-control-profilesand applied under the interface'sfamily ethernet-switching storm-control.
Topic 3 of 4 in Layer 2 Security
Test yourself on Layer 2 Security
The full Juniper JNCIS-ENT JN0-352 question bank has 846 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.