Configuring Key Generation
Context
- After MACsec is enabled, the switches on both ends use the SAK to encrypt and decrypt data packets. The SAK is generated and issued by the key server, which is selected between the two switches according to their priorities. The priorities are manually set on switches.
- The key server calculates an SAK using a certain algorithm based on a manually specified CAK.
MACsec uses the AES-CMAC algorithm to encrypt data packets. The AES-CMAC algorithm includes GCM-AES-128 and GCM-AES-XPN-128. By default, the GCM-AES-128 encryption algorithm is used. To improve the security of data encryption or without the need of rapid SAK swapping, you can configure the GCM-AES-XPN-128 encryption algorithm.
Procedure
- Run system-view
The system view is displayed.
- Run interface interface-type interface-number
The interface view is displayed.
An interface can work in Layer 2 or Layer 3 mode.
- (Optional) Run mka keyserver priority priority
The priority for MKA key server selection is set.
The default priority of a MACsec-enabled interface is 16.
A smaller value indicates a higher priority. The interface with a higher priority is selected as the key server. If the two interfaces have the same priority, the interface with a smaller Secure Channel Identifier (SCI) is selected as the key server. An SCI consists of an interface MAC address and the last two bytes of an interface index.
- Run mka cak-mode static ckn ckn cak cak
The static CKN and CAK are configured.
By default, no static CKN or CAK is configured.
CKN is the name of a CAK. To ensure successful establishment of an MKA session, the CKNs and CAKs on both ends must be identical.
- Run macsec cipher-suite { gcm-aes-128 | gcm-aes-xpn-128 }
The encryption algorithm is configured for data packets.
By default, the encryption algorithm for data packets is set to gcm-aes-128.
- Run commit
The configuration is committed.