MACsec (MAC Security, IEEE 802.1AE) is an IEEE standard, first published in 2006 and supported in the Linux kernel since 4.6 (2016), that encrypts and authenticates Ethernet frames at layer 2 — hop by hop between directly connected devices. Its operating layer is what distinguishes it from IPsec (layer 3) and TLS (layer 4): MACsec wraps Ethernet frames, not IP packets or TCP streams, so it can protect every byte that traverses a link segment regardless of what protocol it carries. ARP replies, DHCP offers, LLDP frames, routing protocol adjacencies, and layer-2 broadcast traffic are all encrypted and authenticated alongside application data — something neither IPsec nor TLS can accomplish because both require an IP header to already be present and unenforced. The topology implication of this is that MACsec is link-local and hop-by-hop: it encrypts between two directly adjacent Ethernet peers (a host and a switch, or two switches), decrypts at each hop for forwarding decisions, and re-encrypts toward the next hop. It cannot stretch across a routed boundary; for that, IPsec is the right tool.
MACsec achieves encryption by inserting a SecTAG (Security Tag) header between the Ethernet source address and the EtherType field of a standard Ethernet frame, and appending an ICV (Integrity Check Value) trailer. The SecTAG carries the SCI (Secure Channel Identifier, derived from the sender’s MAC address and a port ID), the association number identifying the active Secure Association, and a packet number for replay protection. The payload between the SecTAG and ICV is encrypted with AES-GCM-128 (or AES-GCM-256 per the 802.1AEbn amendment), and the ICV cryptographically binds the cleartext Ethernet header, SecTAG, and encrypted payload together — ensuring that neither the addressing information nor the encrypted content can be tampered with without detection. There is no encrypt-only mode: integrity and origin authentication are fundamental to the design. The overhead is a fixed 32 bytes per frame (16-byte SecTAG + 16-byte ICV), so on a standard 1500-byte MTU link the effective payload is 1468 bytes; jumbo frames are strongly recommended for MACsec deployments carrying VXLAN or other encapsulated overlay traffic. Key management is out of scope for 802.1AE itself and is handled by MKA (MACsec Key Agreement, IEEE 802.1X-2010), which establishes Connectivity Associations, derives Secure Association Keys using a two-message exchange, and periodically rotates them. On Linux, MKA is implemented in wpa_supplicant; keys can also be provisioned statically via ip macsec for point-to-point links.
MACsec fits into the network security stack as the encryption layer that closes the gap neither IPsec nor TLS addresses: unencrypted layer-2 control plane traffic and the physical link between a host and its first-hop switch. Its primary deployment contexts are: data centre switch-to-switch links, where it protects east-west traffic on bare-metal Ethernet segments between top-of-rack switches without the CPU overhead of IPsec; host-to-switch access ports, where it provides mutual authentication and encryption before the host is granted network access, typically combined with 802.1X port authentication (the 802.1X EAP session derives the Connectivity Association Key that seeds MKA, giving the two protocols a natural integration); and WAN handoff links, where carrier Ethernet circuits — MPLS hand-offs, metro Ethernet — are encrypted at the Ethernet layer without requiring IPsec concentrators. In Linux virtual network contexts, MACsec can be applied over VXLAN tunnels between hypervisors, encrypting the overlay traffic at the virtual Ethernet level inside the VM rather than relying on the hypervisor’s infrastructure-level encryption — giving tenants cryptographic control over their own traffic independent of the cloud operator. The PQC transition will affect MACsec at the MKA/EAP layer, since the Connectivity Association Key derivation depends on the EAP method’s key material; EAP-TLS with PQC certificates propagates quantum-safe keys into MKA automatically once the TLS and PKI stack is migrated.
