Home > Media Access Control Security (MACsec) Tutorial

Media Access Control Security (MACsec) Tutorial

We often think Ethernet links with wired cable connection are safe. But in fact when the frames go from one device to another, that connection is not encrypted so they can be intercepted, sniffed, modified or replayed through rogue devices if the attackers gain access to the devices’ room. Therefore MACsec comes into play to mitigate these threats. MACsec works similarly to how WPA2/WPA3 protects wireless traffic, but for wired links. MACsec protects traffic between directly connected devices such as switches, routers, servers, and access points. 

Media Access Control Security (MACsec) is an IEEE standard 802.1AE that provides Layer 2 hop-by-hop encryption. This means the traffic is encrypted only on the wire between two MACsec peers and is unencrypted as it is processed within the devices. If someone gains access to the physical network, MACsec ensures the data on the wire is encrypted and cannot be read or altered.

MACsec.jpg

What are benefits of MACsec?

MACsec provides encryption, data integrity and authentication.

+ For encryption, MACsec uses the Galois/Counter Mode – Advanced Encryption Standard (GCM‑AES) algorithm to encrypt data. MACsec provides high-speed data encryption with minimal impact on network performance. Unlike software-based encryption methods that rely on the CPU, MACsec performs encryption and decryption directly in dedicated hardware components such as ASICs or PHY chips. This hardware-based processing enables bi-directional line-rate, or near line-rate, encryption, allowing traffic to be secured at very high speeds without introducing significant latency or reducing throughput. This is called line-rate encryption.

+ For data integrity, MACsec generates a Message Authentication Code using the Integrity Check Value (ICV). The ICV is used to validate the encrypted MACsec frame to help ensure that data cannot be modified in transit.

+ For authentication, it uses 802.1x EAPOL-EAP to provide access control and generation of Master Secret Key. In the absence of 802.1x, a pre-shared key also can be used as the master key.

Line-rate encryption refers to the practice of encrypting data at the maximum speed or data rate allowed by the communication channel or network infrastructure, without compromising security or performance. In other words, it is a type of encryption that can encrypt and decrypt data as fast as the data can be transmitted over the communication channel or network.

MACsec frame structure

A MACsec packet is formed with an Ethernet frame by adding a Security TAG (SecTAG) and an Integrity Check Value (ICV) as shown in the figure below:

MACsec_frame_structure.jpg

The source and destination MAC addresses are not encrypted but they are included in the ICV calculation using the SAK. Therefore, only authenticated devices can change the ICV.

When a device, such as an switch receives the frame, it validates the source and destination MAC addresses, SecTag and encrypted payload against the ICV. If they match, the frame is processed, and the payload is decrypted. If they do not match, it assume the frame has been tampered and will be dropped.

How MACsec works?

MACsec establishes a link between the two devices to exchange pre-shared keys through the MACsec Key Agreement (MKA) process. The key can be configured manually, or can be generated dynamically, depending on the security mode used to enable MACsec. Once the MKA process is complete, the devices exchange keys to provide the Security Association Keys (SAK) which is then used to encrypt the whole layer-2 ethernet frame.

Note: MKA protocol installed on a device relies on an IEEE 802.1X Extensible Authentication Protocol (EAP) framework to establish communication.

Basic Process
1. Devices authenticate each other.
2. Encryption keys are exchanged.
3. Ethernet frames are encrypted before transmission.
4. Receiving device decrypts the frames.

What are MACsec requirements?

Requires MACsec-supported devices in all the path.

Configuration

//Configure Pre-Shared Key
key chain mka-keys macsec
   key SecretKey
      cryptographic-algorithm aes-256-cmac
      key-string Digitaltut
!
//Configure MKA Policy
mka policy mkapolicy1
   macsec-cipher-suite gcm-aes-128
!
//Enable MACsec on an interface
int g1/0/1
 macsec network-link
 mka policy mkapolicy1
 mka pre-shared-key key-chain mka-keys
!

 

Comments
  1. No comments yet.
  1. No trackbacks yet.