Protocol 11 of 81Layer 2FrameAssembly v3.3.0
Raw .mdllms-full.txt
macsecIEEE 802.1AE Media Access Control Security (MACsec)

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
Wire Stack:Ethernet IIMACsec (802.1AE) (EtherType 0x88e5)
L2 Tagging: vlan · qinq · repeatable mpls · fcsHost Family: MAC-Only or IPL3 QoS & TTL: N/A (Pure L2)L4 State: L2 Ethernet

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.

01. Application

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.

02. Application

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.

03. Application

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.

Fig. 1 · RFC Octet & Bit Schematic

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.

0 ··············· 15 · 16 ··············· 31 bit
Selected Wire Segment
MACsec (802.1AE) Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
macsec tci · an · sl · pn · sci · payload · hexpayload
Compiler Default Behavior
RFC-compliant MACsec (802.1AE) defaults (IEEE 802.1AE)
Wireshark Dissection Note · Inspecting IEEE 802.1AE SecTAG & ICV Trailers (0x88e5)

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.

macsec_quickstart.frasm6 lines
Open in 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 upper tci flags with the 2-bit Association Number (an).
  • Automatically sets the SC (Secure Channel) bit and appends the 8-byte big-endian sci whenever sci is 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.
Multi-Frame Example

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.

macsec_sak_rollover.frasm12 lines
Open in Playground
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"
}
Terminal Commands (FrameAssembly CLI v3.3.0)
# 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 / OptionAccepted ValueDefaultEffect on Packet
tci <0..255>Tag Control Information byte (0..255)0x08 (E=0, C=0) or 0x2c with SCISets SecTAG TCI flags (0x20 SC present, 0x08 E encryption, 0x04 C changed text).
an <0..3>2-bit Association Number (0..3)0Sets the active SAK Association Number in the low 2 bits of the TCI/AN byte.
sl <0..63>6-bit Short Length (0..63)0Sets Short Length in byte 3 of SecTAG (1..47 octets for short frames; 0 otherwise).
pn <number>32-bit Packet Number (>= 1)1Sets the big-endian 32-bit replay-protection Packet Number in bytes 4..7 of SecTAG.
sci <number>64-bit hex/decimal Secure Channel IDOmitted 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 tagAppends 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
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
comment "<text>"Quoted UTF-8 annotationOmittedAttaches 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)OmittedAppends 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 EtherTypeOverrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType.
fcs | badfcsEthernet CRC-32 trailer flags (choose one)Omittedfcs 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..1UntaggedWraps 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..4095Untagged (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

Rejected
sw1 -> sw2 macsec sci "00:1b:21:aa:00:01:00:01" icv 0x0102
Valid v3.3.0 Syntax
sw1 -> 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

Rejected
sw1 -> sw2 macsec an 4 pn 1
Valid v3.3.0 Syntax
sw1 -> sw2 macsec an 3 pn 1

Per IEEE 802.1AE, an occupies bits 0..1 of the TCI/AN octet and only accepts values 0, 1, 2, or 3.

Field Guide 07
Physical Hardware Labs: Blasting .pcap Captures onto Copper & Fiber