配置 MACsec
我们可以将 MACsec 配置为保护将设备与支持 MACsec 的 MIC 连接在一起的点对点以太网链路。您希望使用 MACsec 保护的每个点到点以太网链路都必须独立配置。我们可以使用静态连接关联密钥 (CAK) 安全模式在设备到设备链路上启用 MACsec。
您可以在端口模式下配置不同的接口速率,例如 40G、100G 和 10G,并在 pic 模式下配置特定的接口速率,例如 100G、40G 和 10G。在 pic 模式下,您只能配置一种类型的接口速度。
定制时间
要自定义时间,请禁用 NTP 并设置日期。
在运行 Junos OS 的设备上配置 MACsec
在运行 Junos OS 的设备上配置 MACsec:
使用 ICMP 流量配置静态 MACsec
要使用设备 R0 和设备 R1 之间的 ICMP 流量配置静态 MACsec:
在 R0 中:
在 R1 中:
通过配置连接关联密钥名称 (CKN) 和连接关联密钥 (CAK) 来创建预共享密钥
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 pre-shared-key ckn 2345678922334455667788992223334445556667778889992222333344445555 security-administrator@hostname:fips# set security macsec connectivity-association CA1 pre-shared-key cak 23456789223344556677889922233344 security-administrator@hostname:fips# set security macsec connectivity-association CA1 offset 30
设置追踪选项值。
[edit] security-administrator@hostname:fips# set security macsec traceoptions file MACsec.log security-administrator@hostname:fips# set security macsec traceoptions file size 4000000000 security-administrator@hostname:fips# set security macsec traceoptions flag all
将追踪分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions file mka_xe size 1g security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions flag all
将 MACsec 安全模式配置为连接关联的静态 cak。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 security-mode static-cak
设置 MKA 传输间隔。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka transmit-interval 3000
启用 MKA 安全。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka should-secure security-administrator@hostname:fips# set security macsec connectivity-association CA1 include-sci
将连接关联分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name connectivity-association CA1 security-administrator@hostname:fips# set interfaces interface-name unit 0 family inet address 10.1.1.2/24
使用 ICMP 流量使用密钥链配置 MACsec
将两个 macsec 端点设备同步到 NTP,因为对于密钥启动时间触发,两个设备的时间都应该相同。要使用设备 R0 和设备 R1 之间的 ICMP 流量使用密钥链配置 MACsec:
在 R0 中:
要为 ICMP 流量配置带有密钥链的 MACsec:
在 R1 中:
为身份验证密钥链分配容差值。
[edit] security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 tolerance 20
创建要使用的密钥密码。这是一串由十六进制数字组成的,最长 64 个字符。如果字符串用引号括起来,则密码可以包含空格。密钥链的密钥数据用作 CAK。
[edit] security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 0 key-name 2345678922334455667788992223334445556667778889992222333344445551 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 0 start-time 2018-03-20.20:35 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 1 key-name 2345678922334455667788992223334445556667778889992222333344445552 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 1 start-time 2018-03-20.20:37 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 2 key-name 2345678922334455667788992223334445556667778889992222333344445553 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 2 start-time 2018-03-20.20:39 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 3 key-name 2345678922334455667788992223334445556667778889992222333344445554 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 3 start-time 2018-03-20.20:41 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 4 key-name 2345678922334455667788992223334445556667778889992222333344445555 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 4 start-time 2018-03-20.20:43 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 5 key-name 2345678922334455667788992223334445556667778889992222333344445556 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 5 start-time 2018-03-20.20:45 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 6 key-name 2345678922334455667788992223334445556667778889992222333344445557 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 6 start-time 2018-03-20.20:47 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 7 key-name 2345678922334455667788992223334445556667778889992222333344445558 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 7 start-time 2018-03-20.20:49
prompt
使用命令输入密钥值。例如,密钥值是 2345678922334455667788992223334123456789223344556677889922233341。[edit] security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 0 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 1 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 2 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 3 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 4 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 5 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 6 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 7 secret New cak (secret): Retype new cak (secret):
将预共享密钥链名称与连接关联相关联。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 pre-shared-key-chain macsec-kc1 security-administrator@hostname:fips# set security macsec connectivity-association CA1 offset 50 security-administrator@hostname:fips# set security macsec connectivity-association CA1 cipher-suite gcm-aes-256
-
注意:
- 您可以使用非 XPN 密码
AES-GCM-128
,AES-GCM-256
并且仅用于 10G/xe 接口 macsec 配置。 - 您可以使用 XPN 密码
AES-GCM-XPN-128
以及AES-GCM-XPN-256
40G 和 100G 速率 macsec 配置。您还可以使用 XPN 密码AES-GCM-XPN-128
,AES-GCM-XPN-256
并用于 10G/xe 接口 macsec 配置(如果支持)。
- 您可以使用非 XPN 密码
设置追踪选项值。
[edit] security-administrator@hostname:fips# set security macsec traceoptions file MACsec.log security-administrator@hostname:fips# set security macsec traceoptions file size 4000000000 security-administrator@hostname:fips# set security macsec traceoptions flag all
将追踪分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions file mka_xe size 1g security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions flag all
将 MACsec 安全模式配置为连接关联的静态 cak。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 security-mode static-cak
设置 MKA 密钥服务器优先级。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka key-server-priority 1
设置 MKA 传输间隔。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka transmit-interval 3000
启用 MKA 安全。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 include-sci
将连接关联分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name connectivity-association CA1 security-administrator@hostname:fips# set interfaces interface-name unit 0 family inet address 10.1.1.2/24
为第 2 层流量配置静态 MACsec
要为设备 R0 和设备 R1 之间的第 2 层流量配置静态 MACsec:
在 R0 中:
在 R1 中:
创建要使用的密钥密码。这是一串由十六进制数字组成的,最长 64 个字符。如果字符串用引号括起来,则密码可以包含空格。密钥链的密钥数据用作 CAK。
[edit] security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 0 secret New cak (secret): Retype new cak (secret):
例如,密钥值是 2345678922334455667788992223334123456789223344556677889922233341。
将预共享密钥链名称与连接关联相关联。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 pre-shared-key-chain macsec-kc1 security-administrator@hostname:fips# set security macsec connectivity-association CA1 offset 50 security-administrator@hostname:fips# set security macsec connectivity-association CA1 cipher-suite gcm-aes-256
设置追踪选项值。
[edit] security-administrator@hostname:fips# set security macsec traceoptions file MACsec.log security-administrator@hostname:fips# set security macsec traceoptions file size 4000000000 security-administrator@hostname:fips# set security macsec traceoptions flag all
将追踪分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions file mka_xe size 1g security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions flag all
将 MACsec 安全模式配置为连接关联的静态 cak。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 security-mode static-cak
设置 MKA 密钥服务器优先级。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka key-server-priority 1
设置 MKA 传输间隔。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka transmit-interval 3000
启用 MKA 安全。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 include-sci
将连接关联分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name connectivity-association CA1
配置 VLAN 标记。
[edit] security-administrator@hostname:fips# set interfaces interface-name1 flexible-vlan-tagging security-administrator@hostname:fips# set interfaces interface-name1 encapsulation flexible-ethernet-services security-administrator@hostname:fips# set interfaces interface-name1 unit 100 encapsulation vlan-bridge security-administrator@hostname:fips# set interfaces interface-name1 unit 100 vlan-id 100 security-administrator@hostname:fips# set interfaces interface-name2 flexible-vlan-tagging security-administrator@hostname:fips# set interfaces interface-name2 encapsulation flexible-ethernet-services security-administrator@hostname:fips# set interfaces interface-name2 unit 100 encapsulation vlan-bridge security-administrator@hostname:fips# set interfaces interface-name2 unit 100 vlan-id 100
配置网桥域。
[edit] security-administrator@hostname:fips# set bridge-domains BD-110 domain-type bridge security-administrator@hostname:fips# set bridge-domains BD-110 vlan-id 100 security-administrator@hostname:fips# set bridge-domains BD-110 interface interface-name1 100 security-administrator@hostname:fips# set bridge-domains BD-110 interface interface-name2 100
使用密钥链为 2 层流量配置 MACsec
将两个 macsec 端点设备同步到 NTP,因为对于密钥启动时间触发,两个设备的时间都应该相同。要为设备 R0 和设备 R1 之间的 ICMP 流量配置 MACsec:
在 R0 中:
在 R1 中:
为身份验证密钥链分配容差值。
[edit] security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 tolerance 20
创建要使用的密钥密码。这是一串由十六进制数字组成的,最长 64 个字符。如果字符串用引号括起来,则密码可以包含空格。密钥链的密钥数据用作 CAK。
[edit] security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 0 key-name 2345678922334455667788992223334445556667778889992222333344445551 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 0 start-time 2018-03-20.20:35 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 1 key-name 2345678922334455667788992223334445556667778889992222333344445552 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 1 start-time 2018-03-20.20:37 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 2 key-name 2345678922334455667788992223334445556667778889992222333344445553 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 2 start-time 2018-03-20.20:39 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 3 key-name 2345678922334455667788992223334445556667778889992222333344445554 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 3 start-time 2018-03-20.20:41 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 4 key-name 2345678922334455667788992223334445556667778889992222333344445555 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 4 start-time 2018-03-20.20:43 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 5 key-name 2345678922334455667788992223334445556667778889992222333344445556 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 5 start-time 2018-03-20.20:45 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 6 key-name 2345678922334455667788992223334445556667778889992222333344445557 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 6 start-time 2018-03-20.20:47 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 7 key-name 2345678922334455667788992223334445556667778889992222333344445558 security-administrator@hostname:fips# set security authentication-key-chains key-chain macsec-kc1 key 7 start-time 2018-03-20.20:49
prompt
使用命令输入密钥值。例如,密钥值是 2345678922334455667788992223334123456789223344556677889922233341。[edit] security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 0 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 1 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 2 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 3 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 4 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 5 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 6 secret New cak (secret): Retype new cak (secret): security-administrator@hostname:fips# prompt security authentication-key-chains key-chain macsec-kc1 key 7 secret New cak (secret): Retype new cak (secret):
将预共享密钥链名称与连接关联相关联。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 pre-shared-key-chain macsec-kc1 security-administrator@hostname:fips# set security macsec connectivity-association CA1 cipher-suite gcm-aes-256
设置追踪选项值。
[edit] security-administrator@hostname:fips# set security macsec traceoptions file MACsec.log security-administrator@hostname:fips# set security macsec traceoptions file size 4000000000 security-administrator@hostname:fips# set security macsec traceoptions flag all
将追踪分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions file mka_xe size 1g security-administrator@hostname:fips# set security macsec interfaces interface-name traceoptions flag all
将 MACsec 安全模式配置为连接关联的静态 cak。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 security-mode static-cak
设置 MKA 密钥服务器优先级。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka key-server-priority 1
设置 MKA 传输间隔。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 mka transmit-interval 3000
启用 MKA 安全。
[edit] security-administrator@hostname:fips# set security macsec connectivity-association CA1 include-sci
将连接关联分配给接口。
[edit] security-administrator@hostname:fips# set security macsec interfaces interface-name connectivity-association CA1
配置 VLAN 标记。
[edit] security-administrator@hostname:fips# set interfaces interface-name1 flexible-vlan-tagging security-administrator@hostname:fips# set interfaces interface-name1 encapsulation flexible-ethernet-services security-administrator@hostname:fips# set interfaces interface-name1 unit 100 encapsulation vlan-bridge security-administrator@hostname:fips# set interfaces interface-name1 unit 100 vlan-id 100 security-administrator@hostname:fips# set interfaces interface-name2 flexible-vlan-tagging security-administrator@hostname:fips# set interfaces interface-name2 encapsulation flexible-ethernet-services security-administrator@hostname:fips# set interfaces interface-name2 unit 100 encapsulation vlan-bridge security-administrator@hostname:fips# set interfaces interface-name2 unit 100 vlan-id 100
配置网桥域。
[edit] security-administrator@hostname:fips# set bridge-domains BD-110 domain-type bridge security-administrator@hostname:fips# set bridge-domains BD-110 vlan-id 100 security-administrator@hostname:fips# set bridge-domains BD-110 interface interface-name1 100 security-administrator@hostname:fips# set bridge-domains BD-110 interface interface-name2 100