MACsec Explained: Ethernet Link Encryption and MKA

Updated on
11 min read

MACsec is an Ethernet link-encryption system for networks where traffic needs protection between directly connected switches, servers, routers, or other Layer 2 peers. It is often discussed alongside IEEE 802.1X, but the two solve different parts of the problem: 802.1X authenticates a peer and controls admission, while MACsec protects the Ethernet frames that follow. This guide explains the MACsec frame format, key-management process, deployment boundaries, and a small Linux test configuration.

What Is MACsec?

MACsec, defined by IEEE 802.1AE MAC Security, adds confidentiality, integrity, origin authenticity, and replay protection to Ethernet communication. It operates below IP, so applications can usually use the protected link without knowing that encryption is present. A device sends an ordinary Ethernet frame into a MACsec interface; the implementation protects it before transmission and verifies or decrypts a received frame before delivering it to the upper layer.

MACsec is a link-layer control. A protected frame is secure across the configured Ethernet hop or secure connectivity association, not automatically across every hop between the application and its destination. If traffic crosses several independent links, each link needs its own protection, or an end-to-end protocol such as TLS or IPsec must provide the broader boundary.

The IEEE 802.1X project documentation describes how the standard’s controlled and uncontrolled ports support authentication and key management. Its MACsec Key Agreement (MKA) process lets authenticated peers discover one another, elect a key server, and establish the symmetric keys used by 802.1AE.

The Problem MACsec Solves

Ethernet is commonly treated as trusted because it runs inside a building, data center, campus, or provider network. That assumption becomes weak when a link crosses a shared facility, a leased dark-fiber path, an inter-building connection, a colocation cross-connect, or a switch fabric administered by more than one team. A device with access to the path may be able to observe frames, inject traffic, or replay captured traffic even when routing and firewall policy are correct.

TLS protects a particular application session, but not every protocol or control-plane exchange. IPsec can protect traffic at the network layer, but it may require routing, tunnel, and endpoint changes. MACsec provides a transparent protection layer for supported Ethernet interfaces. It can cover IP, ARP, control traffic, and other Ethernet payloads without asking each application to implement encryption.

MACsec does not replace access control. A switch port can be physically connected and still be unauthorized, and encryption does not decide which VLANs or services a peer may reach. A useful design separates these questions:

  • Who is allowed to use the link? 802.1X, MKA authentication, or an approved pre-shared key answers this.
  • Can a listener read or modify frames on the link? MACsec confidentiality and integrity controls answer this.
  • Can the endpoint use a particular service? VLAN, routing, firewall, identity, and application policy answer this.

How MACsec Works

MACsec inserts security metadata into Ethernet transmission and calculates an integrity check value over the protected frame. When encryption is enabled, the payload is encrypted with an authenticated-encryption cipher. The receiver checks the secure channel, packet number, and integrity value before accepting the frame. Invalid or replayed frames are discarded according to the configured validation and replay policy.

The main objects form a small hierarchy:

  1. A connectivity association (CA) is the group of MACsec peers that are allowed to establish protected communication.
  2. A secure channel (SC) is a unidirectional channel identified by a secure channel identifier (SCI). The SCI combines a system’s MAC address with a port identifier.
  3. A secure association (SA) is a key and packet-number context within an SC. Multiple SAs allow a sender to change keys without stopping the link.
  4. A secure association key (SAK) is the symmetric traffic key used to protect frames.
  5. A connectivity association key (CAK) is the longer-lived secret from which MKA derives or protects the SAK. Its key name is the connectivity-association key name (CKN).

MACsec itself needs fresh packet numbers because authenticated encryption must not reuse the same key and initialization-vector combination. A sender increments the packet number for protected frames. A receiver can use a replay window to tolerate limited reordering while rejecting frames that are too old or already accepted. High-volume links may need extended packet-number cipher suites so a single association does not exhaust its packet-number space.

The Ethernet addresses remain available to switching equipment so a protected frame can traverse the intended Layer 2 path. MACsec therefore does not hide all traffic metadata from switches or observers. Depending on the mode and implementation, addresses, timing, frame size, and link activity may still reveal information even when the payload is confidential. The IEEE standard also defines options for protecting privacy-related metadata, but support must be checked across the devices at both ends.

MKA, 802.1X, and Key Rotation

MKA is the control protocol that turns peer authentication into usable MACsec keys. It runs over EAP over LAN (EAPOL) on the local link, before ordinary protected traffic is admitted. The EAP specification in RFC 3748 defines the extensible authentication framework carried by lower-layer transports; 802.1X supplies the port and key-management context in which MKA operates.

In a certificate-based enterprise design, the endpoint and switch authenticate through 802.1X and EAP-TLS. The authentication result establishes keying material and policy, and MKA uses the resulting relationship to form a connectivity association. EAP-TLS guidance in RFC 9190 specifically identifies MACsec networks as a use of EAP-TLS with 802.1X. The existing IEEE 802.1X and EAP-TLS network access control guide covers the supplicant, authenticator, RADIUS, and certificate-policy roles.

An alternative is a pre-shared CAK configured on both peers. This can be appropriate for a small, controlled link, but it makes secret distribution, rotation, and device replacement an operational responsibility. A static traffic key is not a substitute for MKA: the Linux ip macsec documentation notes that the tool is mainly for testing or use with a user-space key-management application, because keys must be regenerated and distributed rather than used indefinitely.

MKA also supports key-server selection and association rollover. A new SAK can be installed while an old one remains valid long enough for both peers to transition. Production designs should document which system supplies the CAK, how a peer is revoked, how a failed key server is handled, and whether the implementation supports hardware offload without changing the security policy.

MACsec Compared With Other Controls

Control Layer or boundary Primary protection What it does not provide
MACsec Ethernet link between configured peers Frame confidentiality, integrity, origin authenticity, and replay protection End-to-end protection across unprotected hops or application authorization
802.1X Network attachment and controlled port Peer authentication and admission policy General encryption of every frame after admission
VLANs Layer 2 broadcast domains Logical separation and traffic organization Encryption or automatic blocking of routed traffic
TLS Application transport session Application data confidentiality and integrity Protection for unrelated protocols or link metadata
IPsec Network-layer hosts, tunnels, or gateways IP packet authentication and encryption Transparent protection of non-IP Ethernet control traffic

These controls can be combined. For example, 802.1X can authenticate a switch-to-server link, MKA can establish MACsec, VLANs can preserve tenant separation, and TLS can protect an application end to end. Layering should follow a threat model rather than adding every control to every interface.

Components and Deployment Patterns

MACsec is useful on switch uplinks, storage paths, server-to-switch connections, and inter-building Ethernet where the physical path or intermediate infrastructure is not fully trusted. It can protect east-west traffic without requiring an IP tunnel, but both interfaces must support a compatible cipher suite, frame size, offload mode, and key-management method. Account for the extra SecTAG and integrity value when setting MTU and validating jumbo-frame behavior.

Provider and metro Ethernet

A customer or operator can use MACsec to protect a service across a carrier or shared transport. The provider may switch the protected frame without seeing the encrypted payload, while each customer connectivity association remains separate. Confirm whether the service preserves the required EtherTypes, maximum frame size, priority handling, and failure behavior. A link that changes path or device ownership may require MACsec termination and re-establishment at each boundary.

Static keys and manual ip macsec commands are useful for learning, interoperability tests, and controlled troubleshooting. They are poor defaults for a growing fleet because a key must be copied to every peer and rotated without accidentally leaving stale associations active. For production, use the platform’s MKA implementation or a supported network-management system, and test certificate or CAK lifecycle events before enforcing protection.

MACsec does not make an untrusted endpoint safe. If a compromised server is an authenticated peer, MACsec will faithfully protect the traffic that the server sends. Endpoint hardening, segmentation, service authorization, and monitoring remain necessary.

Getting Started on Linux

The Linux ip utility can create a MACsec device and configure transmit and receive secure associations. The following is a lab-only pattern based on the documented ip macsec syntax. Replace the example addresses and keys with values generated for a disposable test, and configure the reciprocal receive and transmit state on the second endpoint. Do not paste shared keys into shell history or use a manually managed static key as a production design.

#!/usr/bin/env bash
set -eu

IFACE=eth0
MACSEC=macsec0
PEER_MAC=c6:19:52:8f:e6:a0
CAK_LIKE_TEST_KEY=81818181818181818181818181818181

# Create a protected interface on the physical Ethernet device.
ip link add link "$IFACE" "$MACSEC" type macsec port 11 encrypt on

# Add one transmit association for a disposable interoperability test.
ip macsec add "$MACSEC" tx sa 0 pn 1 on key 01 "$CAK_LIKE_TEST_KEY"

# Describe the peer's receive secure channel and bring the interface up.
ip macsec add "$MACSEC" rx port 1234 address "$PEER_MAC"
ip link set "$MACSEC" up

# Inspect state, counters, validation mode, and offload status.
ip macsec show "$MACSEC"
ip -s link show "$MACSEC"

The command above does not complete a two-sided deployment by itself. The remote endpoint needs a matching connectivity design, its own transmit association, and the correct receive SCI and key context. A mismatch can look like an ordinary link failure even though the physical carrier is up. Start with a direct lab connection, verify each endpoint’s SCI and packet counters, then test a known-good IP address over the MACsec interface.

For production rollout, use this sequence:

  1. Confirm hardware, driver, switch, and operating-system support, including MKA and hardware offload behavior.
  2. Choose the authentication method: certificate-backed 802.1X/EAP-TLS or a managed pre-shared CAK.
  3. Establish MTU, cipher, replay-window, validation, and fail-closed or fail-open requirements.
  4. Pilot one redundant link and monitor MKA state, secure-channel counters, dropped invalid frames, replay events, and key transitions.
  5. Test peer reboot, key rollover, certificate renewal, link failover, packet reordering, and loss of the authentication service.
  6. Document recovery access that does not depend on the protected link being configured correctly.

The Linux MACsec manual page is useful for inspecting supported cipher, replay, and offload options. Vendor implementations may expose different names and defaults, so treat a successful configuration command as evidence only that the local device accepted the setting; verify the negotiated state and protected traffic counters on both ends.

Common Misconceptions

“MACsec is the same as 802.1X.”

802.1X controls a port and provides authentication and key-management functions. MACsec uses the resulting keys to protect Ethernet frames. A deployment can use 802.1X without MACsec, and MACsec needs a compatible key-management arrangement rather than merely an open switch port.

“MACsec protects traffic end to end.”

MACsec normally protects a link or connectivity association. A frame may be decrypted at an intermediate device and sent across a later unprotected link. Use TLS or an appropriately designed IPsec path when the data needs protection from the source application to the destination.

“Encryption makes VLANs and firewalls unnecessary.”

MACsec protects the link from observation and tampering; it does not decide whether a peer may access a database, management interface, or another VLAN. Routing, firewall rules, identity, endpoint controls, and application authorization still define permitted communication.

“A manually configured key is enough for production.”

A static key may prove that two interfaces interoperate, but it creates a lifecycle problem. Traffic keys need safe rotation, peers need revocation, and a replacement device must not inherit indefinite access. Use MKA through a supported control plane or a managed key service for operational deployments.

Changelog

  • Initial publication.
TBO Editorial

About the Author

TBO Editorial writes about the latest updates about products and services related to Technology, Business, Finance & Lifestyle. Do get in touch if you want to share any useful article with our community.