Skip to content
induslevel.com
Menu
  • Home
Menu
brass colored metal padlock with chain

How to Configure MACSEC On Three Nodes CentOS VMs Network

Posted on October 27, 2022October 27, 2022 by Waqar Azeem

On Ethernet networks, point-to-point security is provided by Media Access Control security (MACsec).MACsec is defined by IEEE standard 802.1AE. End-to-end network security can be achieved by combining MACsec with other security protocols like IP Security (IPsec) and Secure Sockets Layer (SSL). We will go through configuring the setup.

Execute the following command on any host

Create a 16-byte hexadecimal CAK.

CAK=$(dd if=/dev/urandom count=16 bs=1 2> /dev/null | hexdump -e '1/2 "%04x"')
echo $CAK

Output

0123456789abcdef0123456789abcdef

Create a 32-byte hexadecimal CKN.

CKN$(dd if=/dev/urandom count=32 bs=1 2> /dev/null | hexdump -e '1/2 "%04x"')
echo $CKN

Output

0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

Execute the following single command on all hosts you want to connect over a MACsec network

nmcli connection add type macsec con-name macsec0 ifname macsec0 connection.autoconnect yes macsec.parent enp192 macsec.mode psk macsec.mka-cak 0123456789abcdef0123456789abcdef macsec.mka-ckn 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

Configure the IPv4 settings on host 1

nmcli connection modify macsec0 ipv4.method manual ipv4.addresses '192.168.7.44/24' ipv4.gateway '192.168.7.1' ipv4.dns '8.8.8.8'
nmcli connection up macsec0

Configure the IPv4 settings on host 2

nmcli connection modify macsec0 ipv4.method manual ipv4.addresses '192.168.7.45/24' ipv4.gateway '192.168.7.1' ipv4.dns '8.8.8.8'
nmcli connection up macsec0

Configure the IPv4 settings on host 3

nmcli connection modify macsec0 ipv4.method manual ipv4.addresses '192.168.7.46/24' ipv4.gateway '192.168.7.1' ipv4.dns '8.8.8.8'
nmcli connection up macsec0

To view the status

ip macsec show

To test the traffic encryption, I have captured the traffic on the hypervisor level

Listed the vswitch port on which macsec enabled and non-mac sec devices are configured

net-stats -l

Output

PortNum Type SubType SwitchName MACAddress ClientName
100663448 5 9 vSwitch1 00:0c:29:17:e7:89 haproxy-server01-wazeem
100663458 5 9 vSwitch1 00:0c:29:b2:e4:1b macsec2
100663459 5 9 vSwitch1 00:0c:29:19:fa:59 macsec3
100663460 5 9 vSwitch1 00:0c:29:26:a3:fc macsec1

Captured tcpdump from a machine without macsec enabled

pktcap-uw --switchport 100663448 -o /vmfs/volumes/OSDATA-612963ab-b693a7b2-799b-0010e0cd0f5a/unsecure.pcap

Captured tcpdump from a machine with macsec enabled

pktcap-uw --switchport 100663460 -o /vmfs/volumes/OSDATA-612963ab-b693a7b2-799b-0010e0cd0f5a/secure.pcap

Data is visible on hypervisor level without macsec

Whereas data is not readable on hypervisor level with macsec enabled

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • More
  • Click to print (Opens in new window) Print
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to email a link to a friend (Opens in new window) Email

Related Articles

Share your thoughtsCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Easiest Way to Setup WordPress and OpenConnect VPN Server using Ansible
  • How to use port 443 for SSH and OpenConnect VPN on Linux using HAProxy
  • How to Backup ZFS Snapshots to AWS Glacier
  • How to Install and Setup OpenConnect VPN Server on CentOS 7
  • How to Compile Kitty SSH Client from Source Code

Recent Comments

  1. Waqar Azeem on How to Install and Setup Kubernetes Cluster with Flannel CNI in CentOS 7
  2. Owais Khaleeq on How to Install and Setup Kubernetes Cluster with Flannel CNI in CentOS 7
  3. Muhammad Rizwan Latif on How To Setup 3-Node DynaTrace Managed Cluster on Centos/Redhat 7
  4. Waqar Azeem on How To Setup 3-Node DynaTrace Managed Cluster on Centos/Redhat 7
  5. Tahir on How to Install Simple DHCP Server in Centos 7

Archives

  • August 2024
  • February 2024
  • January 2024
  • July 2023
  • October 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021

Categories

  • Uncategorized
© 2025 INDUS LEVEL | Powered by Minimalist Blog WordPress Theme
 

Loading Comments...