EVPN 2 类和 5 类路由与 EVPN-VXLAN 共存
了解当 EVPN-VXLAN 交换矩阵中的设备学习并通告这两种路由时,如何优先选择 EVPN 2 类路由或 EVPN 5 类路由。
默认情况下,EVPN-VXLAN 边缘路由桥接交换矩阵中的设备会导入并通告 EVPN 2 类 MAC+IP 路由。您还可以将设备配置为导入和播发 EVPN 5 类 IP 前缀路由。设备会将任一类型的路由视为唯一路由,即使它与同一目标主机对应。每个唯一的 IP 主机路由都在数据包转发引擎 (PFE) 中使用专用的下一跃点。因此,同时启用这两种类型的路由会给 PFE 的下一跃点资源带来压力。此外,在某些情况下,如果设备使用一种路由而不是另一种路由,流量通常会更高效地流动。
从 Junos OS 21.2R1 版开始,当设备在同一目标的路由实例中同时具有两种类型的路由时,它将使用首选项算法来选择要存储的首选路由。
好处
-
支持在边缘路由桥接结构中实现更高的扩展,因为优先级算法降低了 PFE 中的下一跃点资源要求。
-
通过为以太网分段中的本地学习(类型 2)主机 IP 路由选择更有效的路径来提高桥接性能。
-
支持使用 EVPN 5 类路由进行更高扩展,同时使用 2 类路由在交换矩阵中启用 ARP 抑制和代理 ARP。2 类路由携带代理 ARP 工作所需的客户边缘 (CE) 设备 MAC 地址信息。
EVPN 2 类和 5 类共存偏好算法
在 EVPN-VXLAN 交换矩阵中,设备默认使用 2 类路由。您必须显式允许设备在虚拟路由和转发 (VRF) 实例中导入和播发 EVPN 5 类路由。要启用 Type 5 路由和共存偏好算法,请在[edit routing-instances name protocols evpn]
层次结构级别配置ip-prefix-routes
语句。
启用 5 类路由后,设备可以从 2 类 MAC + IP 路由中学习 IP 主机地址,而对于该路由,设备也有相同前缀的 5 类路由。在这种情况下,设备使用共存偏好算法仅选择两条路由中的一条作为首选路由进行存储。
首选项算法的工作原理如下:
-
对于设备没有 5 类路由的任何目标,设备使用 2 类路由。
-
如果设备具有与本地 ESI 2 类路由匹配前缀的 5 类路由,则会安装 2 类路由。
-
否则,设备将优先选择所有其他目标的 5 类路由。
对于数据中心内部或之间以及 VLAN(桥接域)内部或之间的流量,EVPN-VXLAN 设备通常更喜欢使用 5 类路由。类型 5 路由非常适合进行 VXLAN 叠加路由。但是,在某些情况下,设备可以使用 Type 2 路由更有效地转发数据包。例如,当设备学习只需在本地桥接的目标的 2 类 MAC+IP 路由时。优先级算法考虑了这种情况。
由于配置更新,设备不会使用先通后断 (MBB) 操作来调整首选路由。在这种情况下更改路由优先级时,设备会先删除非首选路由,然后添加新的首选路由。可能导致首选项更改的配置更改示例包括:
- 如果未启用 5 类路由,则启用 5 类路由。
- 在本地配置 ESI 时,在这种情况下,设备将优先选择 MAC+IP 类型 2 路由。
类型 5 路由选项和策略选项
在 EVPN-VXLAN 配置中,启用 Type 5 路由时,将以下播发模式选项与语 ip-prefix-routes
句一起使用:
advertise direct-nexthop
—使用此选项,设备会将 VRF 的所有非主机路由作为 5 类播发进行播发。advertise gateway-address
—使用此选项,设备仅播发扩展 EVPN 实例和桥接域的 IRB 接口的前缀。
您还可以在 EVPN-VXLAN Type 5 路由配置中包含策略选项,以优化设备实际导入或播发的路由。
例如,您可以定义:
-
导出所有本地路由和 EVPN 路由的策略,如下所示:
set policy-options policy-statement type5_export_policy term 1 from protocol local set policy-options policy-statement type5_export_policy term 1 then accept set policy-options policy-statement type5_export_policy term 2 from protocol evpn set policy-options policy-statement type5_export_policy term 2 from route-filter 0.0.0.0/0 prefix-length-range /32-/32 set policy-options policy-statement type5_export_policy term 2 then accept set policy-options policy-statement type5_export_policy term 3 from protocol evpn set policy-options policy-statement type5_export_policy term 3 from route-filter 00:00:00:00:00:00:00:00/0 prefix-length-range /128-/128 set policy-options policy-statement type5_export_policy term 3 then accept
-
仅播发特定主机地址或前缀的路由的策略,如下所示:
set policy-options policy-statement type5_policy term 1 from protocol local set policy-options policy-statement type5_policy term 1 from route-filter 10.0.2.0/24 orlonger set policy-options policy-statement type5_policy term 1 then accept set policy-options policy-statement type5_policy term 2 from protocol local set policy-options policy-statement type5_policy term 2 from route-filter 2001::192:101:1:100/48 orlonger set policy-options policy-statement type5_policy term 2 then accept
-
过滤且不导入特定主机地址或前缀的路由的策略,如下所示:
set policy-options policy-statement type5_import_policy term 1 from protocol bgp set policy-options policy-statement type5_import_policy term 1 from route-filter 10.0.2.0/24 orlonger set policy-options policy-statement type5_import_policy term 1 then reject set policy-options policy-statement type5_import_policy term 2 from protocol bgp set policy-options policy-statement type5_import_policy term 2 from route-filter 2001::192:101:1:100/48 orlonger set policy-options policy-statement type5_import_policy term 2 then reject
在配置中 ip-prefix-routes
包括所需的策略选项。例如:
set routing-instances vrf1 protocols evpn ip-prefix-routes advertise direct-nexthop set routing-instances vrf1 protocols evpn ip-prefix-routes encapsulation vxlan set routing-instances vrf1 protocols evpn ip-prefix-routes vni 100 set routing-instances vrf1 protocols evpn ip-prefix-routes import type5_import_policy set routing-instances vrf1 protocols evpn ip-prefix-routes export type5_export_policy set routing-instances vrf1 instance-type vrf set routing-instances vrf1 interface irb.1 set routing-instances vrf1 interface irb.2 set routing-instances vrf1 route-distinguisher 192.168.0.1:100 set routing-instances vrf1 vrf-target target:100:200
用于验证首选路由类型的 CLI 命令
您可以使用本节中的 CLI 命令查看首选路由类型。
显示以太网交换 mac-ip-table
当交换机“跳过”添加学习的 2 类路由时,show ethernet-switching mac-ip-table CLI 命令会显示 MAC IP 标志列中的值RTS
。此值表示设备首选具有匹配前缀的 5 类路由。命令在输出顶部显示值RTS
的定义Dest Route Skipped
。
默认情况下,命令会显示所有 VLAN(桥接域)的结果。您还可以指定特定的 VLAN(桥接域)。默认情况下,命令显示 default-switch 实例的信息。如果设备有多个路由实例,您还可以使用其他命令行选项来显示特定路由实例的结果。
以下示例输出显示了默认交换机实例的 MAC+IP 表信息,其中设备为某些目标首选了 5 类路由:
user@device> show ethernet-switching mac-ip-table MAC IP flags (S - Static, D - Dynamic, L - Local , R - Remote, Lp - Local Proxy, Rp - Remote Proxy, K - Kernel, RT - Dest Route, (N)AD - (Not) Advt to remote, RE - Re-ARP/ND, RO - Router, OV - Override, Ur - Unresolved, RTS - Dest Route Skipped, RGw - Remote Gateway) Routing instance : default-switch Bridging domain : v1 IP MAC Flags Logical Active address address Interface source 10.1.1.254 10:10:10:00:00:01 S,K irb.1 2001:db8::a:1:1:fffe 20:20:20:00:00:01 S,K,RTS irb.1 10.1.1.2 c8:e7:f0:4b:d1:00 DR,K,RTS vtep.32769 192.168.22.22 2001:db8::a:1:1:2 c8:e7:f0:4b:d1:00 DR,K,RTS vtep.32769 192.168.22.22 fe80::cae7:f000:14b:d100 c8:e7:f0:4b:d1:00 DR,K,RT vtep.32769 192.168.22.22 10.1.1.1 dc:38:e1:e0:30:c0 S,K irb.1 2001:db8::a:1:1:1 dc:38:e1:e0:30:c0 S,K irb.1 fe80::de38:e100:1e0:30c0 dc:38:e1:e0:30:c0 S,K irb.1 MAC IP flags (S - Static, D - Dynamic, L - Local , R - Remote, Lp - Local Proxy, Rp - Remote Proxy, K - Kernel, RT - Dest Route, (N)AD - (Not) Advt to remote, RE - Re-ARP/ND, RO - Router, OV - Override, Ur - Unresolved, RTS - Dest Route Skipped, RGw - Remote Gateway) Routing instance : default-switch Bridging domain : v2 IP MAC Flags Logical Active address address Interface source 10.1.2.254 10:10:10:00:00:02 S,K,RTS irb.2 2001:db8::a:1:2:fffe 20:20:20:00:00:02 S,K,RTS irb.2 10.1.2.2 c8:e7:f0:4b:d1:00 DR,K,RTS vtep.32769 192.168.22.22 2001:db8::a:1:2:2 c8:e7:f0:4b:d1:00 DR,K,RTS vtep.32769 192.168.22.22 fe80::cae7:f000:24b:d100 c8:e7:f0:4b:d1:00 DR,K,RT vtep.32769 192.168.22.22 10.1.2.1 dc:38:e1:e0:30:c0 S,K irb.2 2001:db8::a:1:2:1 dc:38:e1:e0:30:c0 S,K irb.2 fe80::de38:e100:2e0:30c0 dc:38:e1:e0:30:c0 S,K irb.2
使用选项extensive
时,show ethernet-switching mac-ip-table
命令会在行中MAC IP flags
包含值dest_route_skipped
。以下命令显示 MAC 地址 c8:e7:f0:4b:d1:00 的 MAC+IP 表信息:
user@device> show ethernet-switching mac-ip-table extensive c8:e7:f0:4b:d1:00 IP address: 10.1.1.2 MAC address: c8:e7:f0:4b:d1:00 Routing instance: default-switch Bridging domain: v1 Logical interface: vtep.32769 IP MAC Flags Logical Active address address Interface source 192.168.22.22 MAC-IP local mask: 0x0000000000000000 MAC-IP remote mask: 0x0000000000000000 MAC-IP remote-proxy mask: 0x0000000000000000 MAC-IP RPD flags: 0x08000081 MAC-IP flags: remote,kernel,dest_route_skipped IP address: 2001:db8::a:1:1:2 MAC address: c8:e7:f0:4b:d1:00 Routing instance: default-switch Bridging domain: v1 Logical interface: vtep.32769 IP MAC Flags Logical Active address address Interface source 192.168.22.22 MAC-IP local mask: 0x0000000000000000 MAC-IP remote mask: 0x0000000000000000 MAC-IP remote-proxy mask: 0x0000000000000000 MAC-IP RPD flags: 0x08000101 MAC-IP flags: remote,kernel,dest_route_skipped IP address: fe80::cae7:f000:14b:d100 MAC address: c8:e7:f0:4b:d1:00 Routing instance: default-switch Bridging domain: v1 Logical interface: vtep.32769 IP MAC Flags Logical Active address address Interface source 192.168.22.22 MAC-IP local mask: 0x0000000000000000 MAC-IP remote mask: 0x0000000000000000 MAC-IP remote-proxy mask: 0x0000000000000000 MAC-IP RPD flags: 0x08000101 MAC-IP flags: remote,kernel,dest_route IP address: 10.1.2.2 MAC address: c8:e7:f0:4b:d1:00 Routing instance: default-switch Bridging domain: v2 Logical interface: vtep.32769 IP MAC Flags Logical Active address address Interface source 192.168.22.22 MAC-IP local mask: 0x0000000000000000 MAC-IP remote mask: 0x0000000000000000 MAC-IP remote-proxy mask: 0x0000000000000000 MAC-IP RPD flags: 0x08000081 MAC-IP flags: remote,kernel,dest_route_skipped IP address: 2001:db8::a:1:2:2 MAC address: c8:e7:f0:4b:d1:00 Routing instance: default-switch Bridging domain: v2 Logical interface: vtep.32769 IP MAC Flags Logical Active address address Interface source 192.168.22.22 MAC-IP local mask: 0x0000000000000000 MAC-IP remote mask: 0x0000000000000000 MAC-IP remote-proxy mask: 0x0000000000000000 MAC-IP RPD flags: 0x08000101 MAC-IP flags: remote,kernel,dest_route_skipped IP address: fe80::cae7:f000:24b:d100 MAC address: c8:e7:f0:4b:d1:00 Routing instance: default-switch Bridging domain: v2 Logical interface: vtep.32769 IP MAC Flags Logical Active address address Interface source 192.168.22.22 MAC-IP local mask: 0x0000000000000000 MAC-IP remote mask: 0x0000000000000000 MAC-IP remote-proxy mask: 0x0000000000000000 MAC-IP RPD flags: 0x08000101 MAC-IP flags: remote,kernel,dest_route
show route forwarding-table
show route forwarding-table CLI 命令显示设备何时对目标使用本地 5 类路由,而不是学习的 2 类路由。在这种情况下,当您包含该extensive
选项时,输出将包含字段中Flags
的关键字VxLAN Local
。此标志表示路由是 5 类路由。
例如:
user@device> show route forwarding-table destination 10.1.1.2 table vrf1 extensive Routing table: vrf1.inet [Index 8] Internet: Destination: 10.1.1.2/32 Route type: user Route reference: 0 Route interface-index: 0 Multicast RPF nh index: 0 P2mpidx: 0 Flags: sent to PFE, prefix load balance , VxLAN Local Nexthop: Next-hop type: composite Index: 1799 Reference: 3 Next-hop type: indirect Index: 524291 Reference: 2 Nexthop: 10.0.0.2 Next-hop type: unicast Index: 1796 Reference: 3 Next-hop interface: xe-0/0/11.0
显示路由表
带有 extensive 选项的 show route table CLI 命令在 Type 5 路由的State
输出字段中包含关键字VxlanLocalRT
。
下面是一个使用语法 show route destination-prefix table table-name extensive
的示例。此命令显示设备在路由实例 vrf1 的路由表中为目标 IP 前缀 10.1.1.2 安装了 5 类路由:
user@device> show route 10.1.1.2 table vrf1.inet.0 extensive vrf1.inet.0: 14 destinations, 18 routes (14 active, 0 holddown, 0 hidden) 10.1.1.2/32 (1 entry, 1 announced) TSI: KRT in-kernel 10.1.1.2/32 -> {composite(1799)} *EVPN Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0x6d06abc Next-hop reference count: 6 Next hop type: Router, Next hop index: 1796 Next hop: 10.0.0.2 via xe-0/0/11.0, selected Label element ptr: 0x83f82d8 Label parent element ptr: 0x0 Label element references: 1 Label element child references: 0 Label element lsp id: 0 Session Id: 0x0 Protocol next hop: 192.168.22.22 Composite next hop: 0x66fc1b0 1799 INH Session ID: 0x0 VXLAN tunnel rewrite: MTU: 0, Flags: 0x0 Encap table ID: 0, Decap table ID: 8 Encap VNI: 100, Decap VNI: 100 Source VTEP: 192.168.11.11, Destination VTEP: 192.168.22.22 SMAC: dc:38:e1:e0:30:c0, DMAC: c8:e7:f0:4b:d1:00 Indirect next hop: 0x6df0e84 524291 INH Session ID: 0x0 State: <Active Int Ext VxlanLocalRT> Age: 5:10:00 Metric2: 1 Validation State: unverified Task: vrf1-EVPN-L3-context Announcement bits (1): 2-KRT AS path: I Communities: target:100:200 encapsulation:vxlan(0x8) router-mac:c8:e7:f0:4b:d1:00 Thread: junos-main Composite next hops: 1 Protocol next hop: 192.168.22.22 Metric: 1 Composite next hop: 0x66fc1b0 1799 INH Session ID: 0x0 VXLAN tunnel rewrite: MTU: 0, Flags: 0x0 Encap table ID: 0, Decap table ID: 8 Encap VNI: 100, Decap VNI: 100 Source VTEP: 192.168.11.11, Destination VTEP: 192.168.22.22 SMAC: dc:38:e1:e0:30:c0, DMAC: c8:e7:f0:4b:d1:00 Indirect next hop: 0x6df0e84 524291 INH Session ID: 0x0 Indirect path forwarding next hops: 1 Next hop type: Router Next hop: 10.0.0.2 via xe-0/0/11.0 Session Id: 0x0 192.168.22.22/32 Originating RIB: inet.3 Metric: 1 Node path count: 1 Forwarding nexthops: 1 Next hop type: Router Next hop: 10.0.0.2 via xe-0/0/11.0 Session Id: 0x0