macsec — IEEE 802.1AE Line-Rate Hop-by-Hop SecTAG & ICV Frames
- Default Port / Protocol
- EtherType 0x88e5
- Host Endpoint Rule
- MAC-Only or IP
- Wireshark Display Filter
- macsec
- Standards & Specs
- IEEE 802.1AE, IEEE 802.1AEbw
What It Does on the Wire
Encrypting dark-fiber metro trunks and campus switch uplinks at Layer 2 (0x88e5): macsec packs the exact SecTAG (tci, an, pn, optional 8-byte sci) plus 16-byte AES-GCM icv trailer.
IEEE 802.1AE Media Access Control Security (macsec) provides line-rate hop-by-hop Layer 2 encryption and replay protection across dark fiber interconnects, metro WAN handoffs, and high-security campus access ports (EtherType 0x88e5). Every MACsec frame prepends an 8-byte or 16-byte Security Tag (SecTAG) carrying Tag Control Information (tci), Association Number (an), Short Length (sl), 32-bit Packet Number (pn), and optional 64-bit Secure Channel Identifier (sci), followed by ciphertext and a 16-byte Integrity Check Value (icv).
FrameAssembly builds deterministic 0x88e5 SecTAG headers and AES-GCM-style ICV trailers over MAC-only or IP switch endpoints, enabling replay-window, key-rollover (an 0..3), and MTU overhead verification without hardware MACsec PHYs.
Dark-Fiber WAN Interconnect MTU & SecTAG Overhead Audits
Verify 24-byte/32-byte SecTAG + ICV frame growth alongside outer vlan or qinq carrier tags on packet brokers and optical taps.
SAK Key Rollover (an 0 -> an 1) & Replay Protection Tests
Emit sequential or out-of-window pn Packet Numbers and alternating Association Numbers (an) paired with eapol key MKA frames.
Wireshark macsec Dissector & Hardware Bypass Validation
Generate both SCI-present (tci 0x2c, 16-byte SecTAG) and compact (tci 0x08, 8-byte SecTAG) frames with custom 128-bit icv digests.
RFC Wire Header Layout (macsec)
Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.
Filter with macsec in Wireshark to expand the 8- or 16-byte SecTAG (TCI/AN, Short Length, Packet Number, optional 64-bit SCI) and verify the 16-byte AES-GCM ICV trailer.
Minimal Quickstart (macsec_quickstart.frasm)
Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.
host dc_west { mac 00:1b:21:aa:00:01 }
host dc_east { mac 00:1b:21:bb:00:02 }
compile {
dc_west -> dc_east macsec tci 0x2c an 0 pn 1 sci 0x001b21aa00010001 icv "0102030405060708090a0b0c0d0e0f10"
}Handled Automatically on the Wire
- Sets Ethernet II EtherType to
0x88e5(IEEE 802.1AE MACsec) and bit-packs uppertciflags with the 2-bit Association Number (an). - Automatically sets the
SC(Secure Channel) bit and appends the 8-byte big-endiansciwheneversciis specified (emitting a 16-byte SecTAG vs. 8-byte compact SecTAG). - Appends the 16-byte Integrity Check Value (
icv) trailer after the protected payload bytes.
MKA Key Establishment Followed by MACsec SAK Rollover Across a Metro Trunk
Simulates an 802.1X MKA (eapol key) exchange between two data-center border switches followed by encrypted macsec frames rolling cleanly from Association Number 0 to Association Number 1.
host border_a { mac 00:1c:73:a0:00:01 }
host border_b { mac 00:1c:73:b0:00:02 }
compile {
// 1. MKA (MACsec Key Agreement) EAPOL-Key peer keepalive
border_a -> border_b eapol key version 3 wait 2ms
// 2. Encrypted MACsec frames on SAK Association Number 0 (with 8-byte SCI)
border_a -> border_b macsec tci 0x2c an 0 pn 100 sci 0x001c73a000010001 payload "ciphertext-block-100" icv "a0a1a2a3a4a5a6a7a8a9aaabacadaeaf" wait 1ms
border_a <- border_b macsec tci 0x2c an 0 pn 200 sci 0x001c73b000020001 payload "ciphertext-block-200" icv "b0b1b2b3b4b5b6b7b8b9babbbcbdbebf" wait 2ms
// 3. Hitless SAK key rollover onto Association Number 1 (pn resets to 1)
border_a -> border_b macsec tci 0x2c an 1 pn 1 sci 0x001c73a000010001 payload "ciphertext-new-sak" icv "c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show macsec_sak_rollover.frasm
# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly macsec_sak_rollover.frasm macsec_sak_rollover.pcap
frameassembly macsec_sak_rollover.frasm macsec_sak_rollover.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse macsec_sak_rollover.pcap macsec_sak_rollover_edited.frasm
# 4. Verify dissected protocol fields in tshark
tshark -r macsec_sak_rollover.pcap -Y "macsec"All macsec Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after macsec:
src_host -> dst_host macsec [tci <0..255>] [an <0..3>] [sl <0..63>] [pn <number>] [sci <number>] [icv "<hex>"]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| tci <0..255> | Tag Control Information byte (0..255) | 0x08 (E=0, C=0) or 0x2c with SCI | Sets SecTAG TCI flags (0x20 SC present, 0x08 E encryption, 0x04 C changed text). |
| an <0..3> | 2-bit Association Number (0..3) | 0 | Sets the active SAK Association Number in the low 2 bits of the TCI/AN byte. |
| sl <0..63> | 6-bit Short Length (0..63) | 0 | Sets Short Length in byte 3 of SecTAG (1..47 octets for short frames; 0 otherwise). |
| pn <number> | 32-bit Packet Number (>= 1) | 1 | Sets the big-endian 32-bit replay-protection Packet Number in bytes 4..7 of SecTAG. |
| sci <number> | 64-bit hex/decimal Secure Channel ID | Omitted unless set (6-byte MAC + 2-byte port) | Appends the 8-byte Secure Channel Identifier (0x001b21aa00010001) to SecTAG. |
| icv "<hex>" | 16-byte hex string (32 hex digits) | 16-byte deterministic tag | Appends the 128-bit AES-GCM Integrity Check Value trailer at the end of the frame. |
Cross-Layer Wrappers Valid with macsec
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
8 options
Cross-Layer Wrappers Valid with macsec
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| comment "<text>" | Quoted UTF-8 annotation | Omitted | Attaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | ethertype <0..65535> | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | Host MAC / RFC multicast MAC / auto EtherType | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| fcs | badfcs | Ethernet CRC-32 trailer flags (choose one) | Omitted | fcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | Unlabeled (auto bos=0 on outer labels, bos=1 on bottom) | Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads. |
Gotchas & Quick Fixes
Pass sci as a 64-Bit Hex Literal (0x...) and icv as a Quoted Hex String
sw1 -> sw2 macsec sci "00:1b:21:aa:00:01:00:01" icv 0x0102sw1 -> sw2 macsec sci 0x001b21aa00010001 icv "0102030405060708090a0b0c0d0e0f10"sci takes a Whole number (0x001b21aa00010001), while icv takes a quoted hex byte string ("0102...0f10").
Association Number an Is Bounded to 0..3
sw1 -> sw2 macsec an 4 pn 1sw1 -> sw2 macsec an 3 pn 1Per IEEE 802.1AE, an occupies bits 0..1 of the TCI/AN octet and only accepts values 0, 1, 2, or 3.
Companion Guides & Neighboring Protocols
.pcap Captures onto Copper & Fiber