本文介绍了在使用 Azure ExpressRoute 时,Cisco IOS-XE、Juniper MX 系列和 Arista 路由器的接口和路由配置示例。
Important
本文中的样本仅供参考。 与供应商的销售/技术团队和网络团队合作,找到符合需要的适当配置。 Azure 不支持与此页上列出的配置相关的问题。 有关支持问题,请与设备供应商联系。
路由器接口上的 MTU 和 TCP MSS 设置
ExpressRoute 接口的最大传输单元 (MTU) 为 1500,即路由器上以太网接口的典型默认 MTU。 默认情况下,除非路由器具有不同 MTU,否则无需在路由器接口上指定值。
与 Azure VPN 网关不同,你不需要为 ExpressRoute 电路指定 TCP 最大段大小(MSS)。
本文中的路由器配置示例适用于所有类型的对等互连。 有关路由的更多详细信息,请查看 ExpressRoute 对等互连和 ExpressRoute 路由要求。
在连接到 Microsoft 的每个路由器中,每个对等互连都需要一个子接口。 通过VLAN ID或堆叠的VLAN ID对和IP地址来识别子接口。
本部分中的示例适用于任何运行 IOS-XE OS 系列的路由器。
Dot1Q 接口定义
该示例定义了一个具有单一VLAN ID的子接口。 每个对等连接的 VLAN ID 都是唯一的。 IPv4 地址的最后一个八位字节始终是奇数。
interface GigabitEthernet<Interface_Number>.<Number>
encapsulation dot1Q <VLAN_ID>
ip address <IPv4_Address><Subnet_Mask>
QinQ 接口定义
本示例定义了一个具有两个 VLAN ID 的子接口。 如果使用外部 VLAN ID(s-tag),则其在所有对等连接中都保持不变。 对于每个对等连接,内部 VLAN ID(c-tag)都是唯一的。 IPv4 地址的最后一个八位字节始终是奇数。
interface GigabitEthernet<Interface_Number>.<Number>
encapsulation dot1Q <s-tag> second-dot1Q <c-tag>
ip address <IPv4_Address><Subnet_Mask>
本节的示例适用于任何Arista路由器。
Dot1Q 接口定义
该示例定义了一个具有单一VLAN ID的子接口。 在每个对等互连中,VLAN ID 是唯一的。 IPv4 地址的最后一个八位字节始终是奇数。
interface Ethernet<Interface_Number>.<Number>
encapsulation dot1Q vlan <VLAN_ID>
ip address <IPv4_Address>/<Subnet_Mask_Length>
QinQ 接口定义
本示例定义了一个具有两个 VLAN ID 的子接口。 如果使用外层 VLAN ID(s-tag),则其在所有对等互连之间均保持相同。 对于每个对等互连,内部 VLAN ID(c-tag)都是唯一的。 IPv4 地址的最后一个八位字节始终是奇数。
interface Ethernet<Interface_Number>.<Number>
encapsulation dot1Q vlan <s-tag> inner <c-tag>
ip address <IPv4_Address>/<Subnet_Mask_Length>
本部分中的示例适用于所有 Juniper MX 系列路由器。
Dot1Q 接口定义
该示例定义了一个具有单一VLAN ID的子接口。 每个对等连接的 VLAN ID 都是唯一的。 IPv4 地址的最后一个八位字节始终是奇数。
interfaces {
vlan-tagging;
<Interface_Number> {
unit <Number> {
vlan-id <VLAN_ID>;
family inet {
address <IPv4_Address/Subnet_Mask>;
}
}
}
}
QinQ 接口定义
本示例定义了一个具有两个 VLAN ID 的子接口。 如果使用外层 VLAN ID(s-tag),则它在所有对等连接中都保持不变。 内部 VLAN ID(c-tag)在每个对等互连中都是唯一的。 IPv4 地址的最后一个八位字节始终是奇数。
interfaces {
<Interface_Number> {
flexible-vlan-tagging;
unit <Number> {
vlan-tags outer <S-tag> inner <C-tag>;
family inet {
address <IPv4_Address/Subnet_Mask>;
}
}
}
}
设置 eBGP 会话
必须为每个对等互连设置与 Azure 的 BGP 会话。 使用以下示例设置 BGP 会话。 如果你用于子接口的IPv4地址是a.b.c.d,那么BGP邻居(Microsoft)的IP地址是a.b.c.d+1。 BGP 邻居的 IPv4 地址的最后一个八位字节始终是偶数。
router bgp <Customer_ASN>
bgp log-neighbor-changes
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
neighbor <IP#2_used_by_Azure> activate
exit-address-family
!
router bgp <Customer_ASN>
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
neighbor <IP#2_used_by_Azure> activate
!
routing-options {
autonomous-system <Customer_ASN>;
}
protocols {
bgp {
group <Group_Name> {
peer-as 12076;
neighbor <IP#2_used_by_Azure>;
}
}
}
设置要通过 BGP 会话播发的前缀
请使用以下样例将您的路由器配置为将某些前缀公布到 Azure。
router bgp <Customer_ASN>
bgp log-neighbor-changes
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
network <Prefix_to_be_advertised> mask <Subnet_mask>
neighbor <IP#2_used_by_Azure> activate
exit-address-family
!
router bgp <Customer_ASN>
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
network <Prefix_to_be_advertised>/<Subnet_mask_length>
neighbor <IP#2_used_by_Azure> activate
!
policy-options {
policy-statement <Policy_Name> {
term 1 {
from protocol OSPF;
route-filter;
<Prefix_to_be_advertised/Subnet_Mask> exact;
then {
accept;
}
}
}
}
protocols {
bgp {
group <Group_Name> {
export <Policy_Name>;
peer-as 12076;
neighbor <IP#2_used_by_Azure>;
}
}
}
路径图
使用路由映射和前缀列表来筛选已传播到网络中的前缀。 请参考以下示例,并确保你已设置合适的前缀列表。
router bgp <Customer_ASN>
bgp log-neighbor-changes
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
network <Prefix_to_be_advertised> mask <Subnet_mask>
neighbor <IP#2_used_by_Azure> activate
neighbor <IP#2_used_by_Azure> route-map <MS_Prefixes_Inbound> in
exit-address-family
!
route-map <MS_Prefixes_Inbound> permit 10
match ip address prefix-list <MS_Prefixes>
!
router bgp <Customer_ASN>
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
network <Prefix_to_be_advertised>/<Subnet_mask_length>
neighbor <IP#2_used_by_Azure> activate
neighbor <IP#2_used_by_Azure> route-map <MS_Prefixes_Inbound> in
!
route-map <MS_Prefixes_Inbound> permit 10
match ip address prefix-list <MS_Prefixes>
!
policy-options {
prefix-list MS_Prefixes {
<IP_Prefix_1/Subnet_Mask>;
<IP_Prefix_2/Subnet_Mask>;
}
policy-statement <MS_Prefixes_Inbound> {
term 1 {
from {
prefix-list MS_Prefixes;
}
then {
accept;
}
}
}
}
protocols {
bgp {
group <Group_Name> {
export <Policy_Name>;
import <MS_Prefixes_Inbound>;
peer-as 12076;
neighbor <IP#2_used_by_Azure>;
}
}
}
将在两个位置配置 BFD:一个在接口级别配置,另一个在 BGP 级别配置。 本例使用QinQ接口。
interface GigabitEthernet<Interface_Number>.<Number>
bfd interval 300 min_rx 300 multiplier 3
encapsulation dot1Q <s-tag> second-dot1Q <c-tag>
ip address <IPv4_Address><Subnet_Mask>
router bgp <Customer_ASN>
bgp log-neighbor-changes
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
neighbor <IP#2_used_by_Azure> activate
neighbor <IP#2_used_by_Azure> fall-over bfd
exit-address-family
!
将在两个位置配置 BFD:一个在接口级别配置,另一个在 BGP 级别配置。 本例使用QinQ接口。
interface Ethernet<Interface_Number>.<Number>
bfd interval 300 min-rx 300 multiplier 3
encapsulation dot1Q vlan <s-tag> inner <c-tag>
ip address <IPv4_Address>/<Subnet_Mask_Length>
router bgp <Customer_ASN>
neighbor <IP#2_used_by_Azure> remote-as 12076
!
address-family ipv4
network <Prefix_to_be_advertised>/<Subnet_mask_length>
neighbor <IP#2_used_by_Azure> activate
neighbor <IP#2_used_by_Azure> bfd
!
仅在协议 BGP 部分下配置 BFD。
protocols {
bgp {
group <Group_Name> {
peer-as 12076;
neighbor <IP#2_used_by_Azure>;
bfd-liveness-detection {
minimum-interval 300;
multiplier 3;
}
}
}
}
对于 MACSec 配置,连接关联密钥 (CAK) 和连接关联密钥名称 (CKN) 必须通过 PowerShell 命令与已配置的值进行匹配。
本文未包含Cisco IOS-XE的MACSec示例。 请参阅Cisco关于 IOS-XE 路由器MACSec配置的文档。
mac security
profile <Profile_Name>
cipher <Cipher_Name E.g. aes256-gcm>
key <Connectivity_Association_Key_Name> 7 <Connectivity_Association_Key>
key derivation padding append
sci
!
!
interface Ethernet<Interface_Number>
mac security profile <Profile_Name>
security {
macsec {
connectivity-association <Connectivity_Association_Name> {
cipher-suite gcm-aes-xpn-128;
security-mode static-cak;
pre-shared-key {
ckn <Connectivity_Association_Key_Name>;
cak <Connectivity_Association_Key>; ## SECRET-DATA
}
}
interfaces {
<Interface_Number> {
connectivity-association <Connectivity_Association_Name>;
}
}
}
}
后续步骤