第 3 层 VPN 中的负载平衡
VPN 每数据包负载均衡
默认情况下,当活动路由存在多个到同一目标的等价路径时,Junos OS 软件会使用散列算法选择要在转转发表中安装的下一跃点地址之一。每当目标的下一跃点集发生变化时,都会重复此选择过程(使用相同的哈希算法),以使用相同的哈希算法选择最佳的下一跃点地址。
或者,您也可以将 Junos OS 软件配置为在 PE 设备之间的多个有效路径上传播 VPN 流量。此功能称为按数据包负载平衡。仅当有多个有效路径可用时,才能实现 VPN 流量负载平衡。您可以对 Junos OS 进行配置,以便对于活动路由,将目标的所有下一跃点地址都安装在转转发表中。除了增加 VPN 设备之间可发送的流量外,您还可以配置按数据包的负载平衡,以优化跨多个路径的流量。
通过在路由的各种元素(如 MPLS 标签或目标地址)上运行散列算法,流量分布在多个有效路径中。下表描述了如何在入口路由器以及中转和出口路由器上的路由上运行负载平衡散列算法。散列算法使用的路由元素因 VPN 应用程序而异。如果 Junos OS 遇到设置为 1 的 S 位(指示堆栈的底部),则不会进一步应用散列算法。
应用 |
入口 逻辑接口 |
MPLS 标签 |
源和目标 MAC 地址 |
重新排序和流分离风险 |
禁用控制字 |
IP(源/目标地址和端口、协议) |
|---|---|---|---|---|---|---|
配置了 CCC 的第 2 层 VPN 和第 2 层电路 |
是的 |
是的 |
不 |
是(如果数据是可变的,例如 ATM) |
是的 |
不适用 |
配置了 TCC 的第 2 层 VPN 和第 2 层电路 |
是的 |
是的 |
不 |
是(如果数据是可变的,例如 ATM) |
是的 |
不适用 |
第 3 层 VPN 和 IPv4 或 IPv6 RIB |
是的 |
不 |
不 |
不 |
不 |
是的 |
VPLS |
是的 |
不 |
是的 |
不 |
不 |
是的 |
应用 |
入口逻辑接口 |
MPLS 标签(最多 3 个,S 位设置为 1) |
重新排序和流分离风险 |
IP(源/目标地址和端口、协议) |
|---|---|---|---|---|
配置了 CCC 的第 2 层 VPN 和第 2 层电路 |
是的 |
是的 |
不 |
不 |
配置了 TCC 的第 2 层 VPN 和第 2 层电路 |
是的 |
是的 |
不 |
是的 |
第 3 层 VPN 和 IPv4 或 IPv6 RIB |
是的 |
是的 |
不 |
是的 |
VPLS |
是的 |
对于已知的单播流量为是 对于广播流量、单播未知流量和组播流量“否” |
不 |
不 |
3 层 VPN 的负载平衡和 IP 标头过滤
您现在可以同时启用跨内部和外部 BGP 路径的流量负载平衡和基于 IP 报头的流量过滤。这样,您就可以在出口 PE 路由器上为同时在内部和外部 BGP 路径上进行负载均衡的流量配置过滤器和监管器。此功能仅适用于 M120 路由器、M320 路由器、MX 系列路由器和 T Series 路由器。
要在第 3 层 VPN 路由实例上启用这些功能,请在[edit routing-instances routing-instance-name routing-options multipath]层次结构级别添加语句,vrf-table-label在层次结构级别添加vpn-unequal-cost equal-external-internal语句[edit routing-instances routing-instance-name]。
如果发出 show route detail 命令,则可以发现路由是否进行了负载均衡(等于外部-内部)及其接口索引是什么。
如果您还配置了快速重新路由,请注意以下行为:
如果 IBGP 路径出现故障,则可以将其替换为活动的 EBGP 路径或活动的 IBGP 路径。
如果 EBGP 路径出现故障,则只能由另一个活动的 EBGP 路径替换。这可以防止将面向核心的接口流量转发到 IBGP 目标。
您可以同时在[edit routing-options forwarding-options chained-composite-next-hop ingress]层次结构级别包含vpn-unequal-cost equal-external-internal语句和l3vpn语句。但是,如果执行此作,EBGP 将不起作用。这意味着,当同时存在具有链式下一跃点的路径和具有非链式下一跃点的路径作为 EBGP 等价多路径 (ECMP) 的候选路径时,使用链式下一跃点的路径将被排除在外。在典型情况下,排除的路径是内部路径。
3 层 VPN 负载平衡概述
负载平衡功能允许设备沿多条路径划分传入和传出流量,以减少网络拥塞。负载均衡提高了各种网络路径的利用率,提供了更有效的网络带宽。
当使用多个协议时,设备使用 路由优先级 值(也称为 管理距离 值)来选择路由。使用单一路由协议时,路由器会选择到目的地的成本(或指标)最低的路径。如果设备接收并安装多个路径,具有相同的路由优先级和到目标的成本,则必须配置负载平衡。
在不同自治系统中的设备之间同时安装了内部和外部 BGP 路径的网络中,默认情况下,BGP 仅选择一条最佳路径,并且不执行负载平衡。具有内部和外部 BGP 路径的第 3 层 VPN 使用该 multipath 语句实现与协议无关的负载平衡。在路由实例中包含语 multipath 句时,将与协议无关的负载平衡应用于该路由实例的默认路由表。通过使用该 vpn-unequal-cost 语句,将协议无关的负载平衡应用于 VPN 路由。通过使用该 equal-external-internal 语句,可将协议无关的负载平衡应用于内部和外部 BGP 路径,并可与 IP 标头过滤(通过 vrf-table-label 语句启用)一起配置。
示例:对第 3 层 VPN 流量进行负载平衡,同时使用 IP 标头过滤
我们的内容测试团队已经验证并更新了此示例。
此示例说明如何在第 3 层 VPN(具有内部和外部 BGP 路径)中配置负载平衡,同时使用 IP 标头过滤。
要求
此示例需要以下硬件和软件组件:
-
M Series 多服务边缘路由器(仅限 M120 和 M320)、MX 系列 5G 通用路由平台、T Series 核心路由器或 PTX 系列传输路由器。
-
Junos OS 12.1 或更高版本
-
在适用于 MX 系列路由器的 Junos OS 20.1R1 版上重新验证
-
概述
以下示例说明如何在第 3 层 VPN 中配置负载平衡,同时使用 IP 标头过滤。
此示例演示了负载平衡和 IP 标头过滤如何协同工作。IP 报头过滤的测试超出了此示例的范围。
Junos OS BGP 提供多路径功能,允许在相同或不同自治系统 (AS) 中的对等方之间负载平衡。此示例在[edit routing-instances instance-name routing-options multipath vpn-unequal-cost]层次结构级别使用equal-external-internal语句来执行负载平衡。语vrf-table-label句在[edit routing-instances instance-name]层次结构级别进行配置,以启用 IP 报头过滤。
[edit]
routing-instances {
instance-name {
vrf-table-label;
routing-options {
multipath {
vpn-unequal-cost {
equal-external-internal;
}
}
}
}
}
这些语句仅在路由实例的上下文中可用。
在此示例中,设备 CE1 位于 AS1 中并连接到设备 PE1。设备 PE1、PE2、PE3 和 P 在 AS2 中。设备 CE2 连接到设备 PE2 和 PE3,并在 AS3 中。设备 CE3 连接到设备 PE3 并位于 AS4 中。BGP 和 MPLS 是通过网络配置的。OSPF 是此网络中使用的内部网关协议 (IGP)。
设备 PE1、PE2 和 PE3 的配置包括equal-external-internal层[edit routing-instances instance-name routing-options multipath vpn-unequal-cost]级语句,用于在网络中启用负载平衡。当在 PE 设备的[edit routing-instances instance-name]层次结构级别配置语句时vrf-table-label,将启用 IP 报头过滤。
图 1 显示了此示例中使用的拓扑。
拓扑学
的第 3 层 VPN 负载平衡
此示例中使用的 IP 地址列表如 表 3 所示,以供快速参考。
| 装置 |
如 |
设备 ID |
接口 |
接口 IP 地址 |
|---|---|---|---|---|
| CE1 |
65001 |
192.0.2.1/32 |
ge-0/0/0.0 |
10.1.1.1/30 |
| PE1型 |
65000 |
192.0.2.2/32 |
ge-0/0/2.0 |
10.1.1.2/30 |
| ge-0/0/0.0 |
10.1.2.5/30 |
|||
| ge-0/0/1.0 |
10.1.3.9/30 |
|||
| PE2 |
65000 |
192.0.2.3/32 |
ge-0/0/0.0 |
10.1.2.6/30 |
| ge-0/0/1.0 |
10.1.4.13/30 |
|||
| ge-0/0/2.0 |
10.1.6.21/30 |
|||
| 聚乙烯3 |
65000 |
192.0.2.4/32 |
ge-0/0/1.0 |
10.1.3.10/30 |
| ge-0/0/0.0 |
10.1.5.18/30 |
|||
| ge-0/0/2.0 |
10.1.7.25/30 |
|||
| ge-0/0/3.0 |
10.1.8.29/30 |
|||
| P |
65000 |
192.0.2.5/32 |
ge-0/0/1.0 |
10.1.4.14/30 |
| ge-0/0/0.0 |
10.1.5.17/30 |
|||
| CE2 认证 |
65002 |
192.0.2.6/32 |
ge-0/0/1.0 |
10.1.6.22/30 |
| ge-0/0/2.0 |
10.1.7.26/30 |
|||
| CE3 认证 |
65003 |
192.0.2.7/32 |
ge-0/0/3.0 |
10.1.8.30/30 |
此示例使用逻辑系统(逻辑路由器)进行了测试。因此,示例中的所有物理接口都是相同的,并且配置是在不同的逻辑接口上完成的。在非测试网络中,您将使用单独的物理路由器和单独的物理接口与其他设备进行连接。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层 [edit] 级的 CLI 中。
Device CE1
set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.1/30
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/0 unit 0 description toPE1
set interfaces lo0 unit 0 family inet address 192.0.2.1/32
set routing-options router-id 192.0.2.1
set routing-options autonomous-system 65001
set protocols bgp group toPE1 type external
set protocols bgp group toPE1 export send-direct
set protocols bgp group toPE1 peer-as 65000
set protocols bgp group toPE1 neighbor 10.1.1.2
set policy-options policy-statement send-direct from protocol direct
set policy-options policy-statement send-direct then accept
Device PE1
set interfaces ge-0/0/2 unit 0 family inet address 10.1.1.2/30
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces ge-0/0/2 unit 0 description toCE1
set interfaces ge-0/0/0 unit 0 family inet address 10.1.2.5/30
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/0 unit 0 description toPE2
set interfaces ge-0/0/1 unit 0 family inet address 10.1.3.9/30
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 description toPE3
set interfaces lo0 unit 0 family inet address 192.0.2.2/32
set protocols mpls interface all
set protocols ldp interface all
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 metric 10
set protocols bgp group toInternal type internal
set protocols bgp group toInternal family inet-vpn unicast
set protocols bgp group toInternal local-address 192.0.2.2
set protocols bgp group toInternal neighbor 192.0.2.3
set protocols bgp group toInternal neighbor 192.0.2.4
set routing-options router-id 192.0.2.2
set routing-options autonomous-system 65000
set routing-options forwarding-table export lb
set routing-instances toCE1 instance-type vrf
set routing-instances toCE1 interface ge-0/0/2.0
set routing-instances toCE1 route-distinguisher 65000:1
set routing-instances toCE1 vrf-target target:65000:1
set routing-instances toCE1 vrf-table-label
set routing-instances toCE1 protocols bgp group toCE1 type external
set routing-instances toCE1 protocols bgp group toCE1 peer-as 65001
set routing-instances toCE1 protocols bgp group toCE1 neighbor 10.1.1.1
set routing-instances toCE1 routing-options multipath vpn-unequal-cost equal-external-internal
set policy-options policy-statement lb then load-balance per-packet
Device PE2
set interfaces ge-0/0/0 unit 0 family inet address 10.1.2.6/30
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/0 unit 0 description toPE1
set interfaces ge-0/0/1 unit 0 family inet address 10.1.4.13/30
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 description toP
set interfaces ge-0/0/2 unit 0 family inet address 10.1.6.21/30
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces ge-0/0/2 unit 0 description toCE2
set interfaces lo0 unit 0 family inet address 192.0.2.3/32
set protocols mpls interface all
set protocols ldp interface all
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 metric 5
set protocols bgp group toInternal type internal
set protocols bgp group toInternal family inet-vpn unicast
set protocols bgp group toInternal local-address 192.0.2.3
set protocols bgp group toInternal neighbor 192.0.2.2
set protocols bgp group toInternal neighbor 192.0.2.4
set routing-options router-id 192.0.2.3
set routing-options autonomous-system 65000
set routing-options forwarding-table export lb
set routing-instances toCE2 instance-type vrf
set routing-instances toCE2 interface ge-0/0/2.0
set routing-instances toCE2 route-distinguisher 65000:1
set routing-instances toCE2 vrf-target target:65000:1
set routing-instances toCE2 vrf-table-label
set routing-instances toCE2 protocols bgp group toCE2 type external
set routing-instances toCE2 protocols bgp group toCE2 peer-as 65002
set routing-instances toCE2 protocols bgp group toCE2 neighbor 10.1.6.22
set routing-instances toCE2 routing-options multipath vpn-unequal-cost equal-external-internal
set policy-options policy-statement lb then load-balance per-packet
Device PE3
set interfaces ge-0/0/1 unit 0 family inet address 10.1.3.10/30
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 description toPE1
set interfaces ge-0/0/0 unit 0 family inet address 10.1.5.18/30
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/0 unit 0 description toP
set interfaces ge-0/0/2 unit 0 family inet address 10.1.7.25/30
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces ge-0/0/2 unit 0 description toCE2
set interfaces ge-0/0/3 unit 0 family inet address 10.1.8.29/30
set interfaces ge-0/0/3 unit 0 family mpls
set interfaces ge-0/0/3 unit 0 description toCE3
set interfaces lo0 unit 0 family inet address 192.0.2.4/32
set protocols mpls interface all
set protocols ldp interface all
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 metric 10
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 5
set protocols bgp group toInternal type internal
set protocols bgp group toInternal local-address 192.0.2.4
set protocols bgp group toInternal family inet-vpn unicast
set protocols bgp group toInternal family route-target
set protocols bgp group toInternal neighbor 192.0.2.2
set protocols bgp group toInternal neighbor 192.0.2.3
set routing-options router-id 192.0.2.4
set routing-options autonomous-system 65000
set routing-options forwarding-table export lb
set routing-instances toCE2_3 instance-type vrf
set routing-instances toCE2_3 interface ge-0/0/2.0
set routing-instances toCE2_3 interface ge-0/0/3.0
set routing-instances toCE2_3 route-distinguisher 65000:1
set routing-instances toCE2_3 vrf-target target:65000:1
set routing-instances toCE2_3 vrf-table-label
set routing-instances toCE2_3 protocols bgp group toCE2 type external
set routing-instances toCE2_3 protocols bgp group toCE2 peer-as 65002
set routing-instances toCE2_3 protocols bgp group toCE2 neighbor 10.1.7.26
set routing-instances toCE2_3 protocols bgp group toCE3 type external
set routing-instances toCE2_3 protocols bgp group toCE3 peer-as 65003
set routing-instances toCE2_3 protocols bgp group toCE3 neighbor 10.1.8.30
set routing-instances toCE2_3 routing-options multipath vpn-unequal-cost equal-external-internal
set policy-options policy-statement lb then load-balance per-packet
Device P
set interfaces ge-0/0/1 unit 0 family inet address 10.1.4.14/30
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 description toPE2
set interfaces ge-0/0/0 unit 0 family inet address 10.1.5.17/30
set interfaces ge-0/0/0 unit 0 family mpls
set interfaces ge-0/0/0 unit 0 description toPE3
set interfaces lo0 unit 0 family inet address 192.0.2.5/32
set protocols mpls interface all
set protocols ldp interface all
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 metric 5
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 5
set routing-options router-id 192.0.2.5
set routing-options autonomous-system 65000
Device CE2
set interfaces ge-0/0/1 unit 0 family inet address 10.1.6.22/30
set interfaces ge-0/0/1 unit 0 family mpls
set interfaces ge-0/0/1 unit 0 description toPE2
set interfaces ge-0/0/2 unit 0 family inet address 10.1.7.26/30
set interfaces ge-0/0/2 unit 0 family mpls
set interfaces ge-0/0/2 unit 0 description toPE3
set interfaces lo0 unit 0 family inet address 192.0.2.6/32
set routing-options router-id 192.0.2.6
set routing-options autonomous-system 65002
set protocols bgp group toPE2PE3 type external
set protocols bgp group toPE2PE3 export send-direct
set protocols bgp group toPE2PE3 peer-as 65000
set protocols bgp group toPE2PE3 neighbor 10.1.6.21
set protocols bgp group toPE2PE3 neighbor 10.1.7.25
set policy-options policy-statement send-direct from protocol direct
set policy-options policy-statement send-direct then accept
Device CE3
set interfaces ge-0/0/3 unit 0 family inet address 10.1.8.30/30
set interfaces ge-0/0/3 unit 0 family mpls
set interfaces ge-0/0/3 unit 0 description toPE3
set interfaces lo0 unit 0 family inet address 192.0.2.7/32
set routing-options router-id 192.0.2.7
set routing-options autonomous-system 65003
set protocols bgp group toPE3 type external
set protocols bgp group toPE3 export send-direct
set protocols bgp group toPE3 peer-as 65000
set protocols bgp group toPE3 neighbor 10.1.8.29
set policy-options policy-statement send-direct from protocol direct
set policy-options policy-statement send-direct then accept
分步过程
下面的示例要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要在 VPN 设置中配置不等价负载平衡:
-
在设备 CE1 上配置路由器 ID,并将设备分配给其自治系统。
[edit routing-options] user@CE1# set router-id 192.0.2.1 user@CE1# set autonomous-system 65001同样地,配置所有其他设备。
-
为通过整个网络的流量配置 BGP 组。
-
为 MPLS 网络的来往流量(CE 设备)配置 BGP 组。
[edit protocols bgp group toPE1] user@CE1# set type external user@CE1# set peer-as 65000 user@CE1# set neighbor 10.1.1.2 -
通过相应地修改
peer-as和neighbor语句,在设备 CE2 和 CE3 上配置类似的 BGP 组(to AS 65000toPE3和 )。 -
为通过 MPLS 网络的流量(PE 设备)配置 BGP 组。
[edit protocols bgp group toInternal] user@PE1# set type internal user@PE1# set family inet-vpn unicast user@PE1# set local-address 192.0.2.2 user@PE1# set neighbor 192.0.2.3 user@PE1# set neighbor 192.0.2.4 -
通过相应地修改
local-address和neighbor语句,在设备 PE2 和 PE3 上配置相同的 BGP 组 (toInternal)。
-
-
配置用于导出进出 MPLS 网络的路由的路由策略(
send-direct策略)和跨 MPLS 网络负载平衡流量网络的策略(lb策略)。-
配置策略 (
send-direct),用于将路由从路由表导出到设备 CE1 上的 BGP。[edit policy-options policy-statement send-direct] user@CE1# set from protocol direct user@CE1# set then accept[edit protocols bgp group toPE1] user@CE1# set export send-direct同样,在设备 CE2 和 CE3 上配置
send-direct策略。 -
配置策略 (
lb),用于将路由从路由表导出到设备 PE1 上的转转发表。该
lb策略配置按数据包的负载平衡,以确保目标的所有下一跃点地址都安装在转转发表中。[edit policy-options policy-statement lb] user@PE1# set then load-balance per-packet[edit routing-options] user@PE1# set forwarding-table export lb同样,在设备 PE2 和 PE3 上配置
lb策略。
-
-
配置以下内容:
-
在 PE 设备上配置路由实例,以便通过自治系统导出路由。
-
在
[edit routing-instances instance-name routing-options multipath vpn-unequal-cost]层次结构级别包含equal-external-internal语句,以便在网络中启用负载平衡。 -
在退出出口设备(设备 CE3)之前,
[edit routing-instances instance-name]在层次结构级别包含vrf-table-label该语句以过滤流量。
Device PE1
[edit routing-instances toCE1] user@PE1# set instance-type vrf user@PE1# set interface ge-0/0/2.0 user@PE1# set route-distinguisher 65000:1 user@PE1# set vrf-target target:65000:1 user@PE1# set vrf-table-label user@PE1# set protocols bgp group toCE1 type external user@PE1# set protocols bgp group toCE1 peer-as 65001 user@PE1# set protocols bgp group toCE1 neighbor 10.1.1.1 user@PE1# set routing-options multipath vpn-unequal-cost equal-external-internalDevice PE2
[edit routing-instances toCE1] user@PE2# set instance-type vrf user@PE2# set interface ge-0/0/2.0 user@PE2# set route-distinguisher 65000:1 user@PE2# set vrf-target target:65000:1 user@PE2# set vrf-table-label user@PE2# set protocols bgp group toCE2 type external user@PE2# set protocols bgp group toCE2 peer-as 65002 user@PE2# set protocols bgp group toCE2 neighbor 10.1.6.22 user@PE2# set routing-options multipath vpn-unequal-cost equal-external-internalDevice PE3
[edit routing-instances toCE2_3] user@PE3# set instance-type vrf user@PE3# set interface ge-0/0/2.0 user@PE3# set interface ge-0/0/3.0 user@PE3# set route-distinguisher 65000:1 user@PE3# set vrf-target target:65000:1 user@PE3# set vrf-table-label user@PE3# set protocols bgp group toCE2 type external user@PE3# set protocols bgp group toCE2 peer-as 65002 user@PE3# set protocols bgp group toCE2 neighbor 10.1.7.26 user@PE3# set protocols bgp group toCE3 type external user@PE3# set protocols bgp group toCE3 peer-as 65003 user@PE3# set protocols bgp group toCE3 neighbor 10.1.8.30 user@PE3# set routing-options multipath vpn-unequal-cost equal-external-internal -
结果
在配置模式下,输入 show configuration 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。以下是 PE3 输出中的片段 show configuration 。
user@PE3#
show configuration
interfaces {
ge-0/0/0 {
unit 0 {
description toP;
family inet {
address 10.1.5.18/30;
}
family mpls;
}
}
ge-0/0/1 {
unit 0 {
description toPE1;
family inet {
address 10.1.3.10/30;
}
family mpls;
}
}
ge-0/0/2 {
unit 0 {
description toCE2;
family inet {
address 10.1.7.25/30;
}
family mpls;
}
}
ge-0/0/3 {
unit 0 {
description toCE3;
family inet {
address 10.1.8.29/30;
}
family mpls;
}
}
lo0 {
unit 0 {
family inet {
address 192.0.2.4/32;
}
}
}
}
policy-options {
policy-statement lb {
then {
load-balance per-packet;
}
}
}
routing-instances {
toCE2_3 {
routing-options {
multipath {
vpn-unequal-cost equal-external-internal;
}
}
protocols {
bgp {
group toCE2 {
type external;
peer-as 65002;
neighbor 10.1.7.26;
}
group toCE3 {
type external;
peer-as 65003;
neighbor 10.1.8.30;
}
}
}
instance-type vrf;
interface ge-0/0/2.0;
interface ge-0/0/3.0;
route-distinguisher 65000:1;
vrf-target target:65000:1;
vrf-table-label;
}
}
routing-options {
forwarding-table {
export lb;
}
router-id 192.0.2.4;
autonomous-system 65000;
}
protocols {
ospf {
area 0.0.0.0 {
interface lo0.0 {
passive;
}
interface ge-0/0/1.0 {
metric 10;
}
interface ge-0/0/0.0 {
metric 5;
}
}
}
bgp {
group toInternal {
type internal;
local-address 192.0.2.4;
family inet-vpn {
unicast;
}
family route-target;
neighbor 192.0.2.2;
neighbor 192.0.2.3;
}
}
ldp {
interface all;
}
mpls {
interface all;
}
}
如果完成设备配置,请从配置模式输入 commit 。
验证
确认配置工作正常。
验证 BGP
目的
验证 BGP 是否正常工作。
行动
在作模式下,运行 show route protocol bgp 命令。
user@PE3> show route protocol bgp
inet.0: 19 destinations, 19 routes (19 active, 0 holddown, 0 hidden)
inet.3: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
toCE2_3.inet.0: 9 destinations, 14 routes (9 active, 0 holddown, 0 hidden)
@ = Routing Use Only, # = Forwarding Use Only
+ = Active Route, - = Last Active, * = Both
10.1.1.0/30 *[BGP/170] 6d 19:24:16, localpref 100, from 192.0.2.2
AS path: I, validation-state: unverified
> to 10.1.3.9 via ge-0/0/1.0, Push 16
10.1.6.20/30 *[BGP/170] 6d 19:24:12, localpref 100, from 192.0.2.3
AS path: I, validation-state: unverified
> to 10.1.5.17 via ge-0/0/0.0, Push 16, Push 299808(top)
[BGP/170] 6d 17:53:50, localpref 100
AS path: 65002 I, validation-state: unverified
> to 10.1.7.26 via ge-0/0/2.0
10.1.7.24/30 [BGP/170] 6d 17:53:50, localpref 100
AS path: 65002 I, validation-state: unverified
> to 10.1.7.26 via ge-0/0/2.0
10.1.8.28/30 [BGP/170] 6d 17:55:03, localpref 100
AS path: 65003 I, validation-state: unverified
> to 10.1.8.30 via ge-0/0/3.0
192.0.2.1/32 *[BGP/170] 6d 19:24:16, localpref 100, from 192.0.2.2
AS path: 65001 I, validation-state: unverified
> to 10.1.3.9 via ge-0/0/1.0, Push 16
192.0.2.6/32 @[BGP/170] 6d 17:53:50, localpref 100
AS path: 65002 I, validation-state: unverified
> to 10.1.7.26 via ge-0/0/2.0
[BGP/170] 6d 17:53:50, localpref 100, from 192.0.2.3
AS path: 65002 I, validation-state: unverified
> to 10.1.5.17 via ge-0/0/0.0, Push 16, Push 299808(top)
192.0.2.7/32 *[BGP/170] 6d 17:55:03, localpref 100
AS path: 65003 I, validation-state: unverified
> to 10.1.8.30 via ge-0/0/3.0
mpls.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
bgp.l3vpn.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
65000:1:10.1.1.0/30
*[BGP/170] 6d 19:24:16, localpref 100, from 192.0.2.2
AS path: I, validation-state: unverified
> to 10.1.3.9 via ge-0/0/1.0, Push 16
65000:1:10.1.6.20/30
*[BGP/170] 6d 19:24:12, localpref 100, from 192.0.2.3
AS path: I, validation-state: unverified
> to 10.1.5.17 via ge-0/0/0.0, Push 16, Push 299808(top)
65000:1:192.0.2.1/32
*[BGP/170] 6d 19:24:16, localpref 100, from 192.0.2.2
AS path: 65001 I, validation-state: unverified
> to 10.1.3.9 via ge-0/0/1.0, Push 16
65000:1:192.0.2.6/32
*[BGP/170] 6d 17:53:50, localpref 100, from 192.0.2.3
AS path: 65002 I, validation-state: unverified
> to 10.1.5.17 via ge-0/0/0.0, Push 16, Push 299808(top)
inet6.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
toCE2_3.inet6.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
bgp.rtarget.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
输出列出了安装在路由表中的 BGP 路由。以 192.0.2.1/32、 10.1.1.0/30开头的输出行, 65000:1:192.0.2.1/32 显示到设备 CE1(位于 AS 65001 中)的 BGP 路由。以 192.0.2.6/32、 65000:1:192.0.2.6/32开头的输出行显示 65000:1:10.1.6.20/30 到 AS 65002 中设备 CE2 的 BGP 路由。开头 192.0.2.7/32 的输出行显示到设备 CE3 的 BGP 路由,该路由位于 AS 65003 中。
意义
BGP 在网络中正常工作。
验证负载平衡
目的
通过检查来验证是否在两个方向上都进行了转发:
-
如果路由的转转发表中安装了两个下一跃点。
-
如果路由的转转发表中安装了外部 BGP 路由。
行动
在作模式下,运行 show route forwarding-table 和 show route forwarding-table destination <destination IP> 命令。
user@PE3> show route forwarding-table
Routing table: default.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 1 rjct 36 2
0.0.0.0/32 perm 0 dscd 34 1
10.1.2.4/30 user 0 ulst 1048576 2
10.1.5.17 ucst 625 12 ge-0/0/0.0
10.1.3.9 ucst 617 8 ge-0/0/1.0
10.1.3.8/30 intf 0 rslv 604 1 ge-0/0/1.0
10.1.3.8/32 dest 0 10.1.3.8 recv 602 1 ge-0/0/1.0
10.1.3.9/32 dest 0 0:50:56:93:63:e7 ucst 617 8 ge-0/0/1.0
10.1.3.10/32 intf 0 10.1.3.10 locl 603 2
10.1.3.10/32 dest 0 10.1.3.10 locl 603 2
10.1.3.11/32 dest 0 10.1.3.11 bcst 601 1 ge-0/0/1.0
10.1.4.12/30 user 0 10.1.5.17 ucst 625 12 ge-0/0/0.0
10.1.5.16/30 intf 0 rslv 600 1 ge-0/0/0.0
10.1.5.16/32 dest 0 10.1.5.16 recv 598 1 ge-0/0/0.0
10.1.5.17/32 dest 0 0:50:56:93:f8:ff ucst 625 12 ge-0/0/0.0
10.1.5.18/32 intf 0 10.1.5.18 locl 599 2
10.1.5.18/32 dest 0 10.1.5.18 locl 599 2
10.1.5.19/32 dest 0 10.1.5.19 bcst 597 1 ge-0/0/0.0
192.0.2.2/32 user 1 10.1.3.9 ucst 617 8 ge-0/0/1.0
192.0.2.3/32 user 1 10.1.5.17 ucst 625 12 ge-0/0/0.0
192.0.2.4/32 intf 0 192.0.2.4 locl 607 1
192.0.2.5/32 user 1 10.1.5.17 ucst 625 12 ge-0/0/0.0
224.0.0.0/4 perm 1 mdsc 35 1
224.0.0.1/32 perm 0 224.0.0.1 mcst 31 5
224.0.0.2/32 user 1 224.0.0.2 mcst 31 5
224.0.0.5/32 user 1 224.0.0.5 mcst 31 5
255.255.255.255/32 perm 0 bcst 32 1
Routing table: __master.anon__.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 0 rjct 524 1
0.0.0.0/32 perm 0 dscd 522 1
224.0.0.0/4 perm 0 mdsc 523 1
224.0.0.1/32 perm 0 224.0.0.1 mcst 526 1
255.255.255.255/32 perm 0 bcst 527 1
Routing table: toCE2_3.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 0 rjct 566 1
0.0.0.0/32 perm 0 dscd 564 1
10.1.1.0/30 user 0 indr 1048574 3
10.1.3.9 Push 16 623 2 ge-0/0/1.0
10.1.6.20/30 user 0 indr 1048575 3
10.1.5.17 Push 16, Push 299808(top) 629 2 ge-0/0/0.0
10.1.7.24/30 intf 0 rslv 616 1 ge-0/0/2.0
10.1.7.24/32 dest 0 10.1.7.24 recv 614 1 ge-0/0/2.0
10.1.7.25/32 intf 0 10.1.7.25 locl 615 2
10.1.7.25/32 dest 0 10.1.7.25 locl 615 2
10.1.7.26/32 dest 1 0:50:56:93:86:18 ucst 618 4 ge-0/0/2.0
10.1.7.27/32 dest 0 10.1.7.27 bcst 613 1 ge-0/0/2.0
10.1.8.28/30 intf 0 rslv 612 1 ge-0/0/3.0
10.1.8.28/32 dest 0 10.1.8.28 recv 610 1 ge-0/0/3.0
10.1.8.29/32 intf 0 10.1.8.29 locl 611 2
10.1.8.29/32 dest 0 10.1.8.29 locl 611 2
10.1.8.30/32 dest 1 0:50:56:93:bb:ed ucst 622 4 ge-0/0/3.0
10.1.8.31/32 dest 0 10.1.8.31 bcst 609 1 ge-0/0/3.0
192.0.2.1/32 user 0 indr 1048574 3
10.1.3.9 Push 16 623 2 ge-0/0/1.0
192.0.2.6/32 user 0 ulst 1048577 2
10.1.7.26 ucst 618 4 ge-0/0/2.0
indr 1048575 3
10.1.5.17 Push 16, Push 299808(top) 629 2 ge-0/0/0.0
192.0.2.7/32 user 0 10.1.8.30 ucst 622 4 ge-0/0/3.0
224.0.0.0/4 perm 0 mdsc 565 1
224.0.0.1/32 perm 0 224.0.0.1 mcst 568 1
255.255.255.255/32 perm 0 bcst 569 1
...
default.inet在路由表(即转转发表)中,开头10.1.2.4/30的输出行显示,对于到同一 AS 中设备 PE2 的路由,表中安装了两个下一跃点: 10.1.3.9 和 10.1.5.17。
toCE2_3.inet在路由表(即外部路由表)中,以 开头192.0.2.6/32的输出行显示,对于到 AS 65002 中设备 CE2 的路由,表中安装了内部下一跃点10.1.5.17和外部下一跃点。10.1.7.26这表示内部和外部 BGP 路由在网络中均可运行。
user@PE3> show route forwarding-table destination 10.1.2.6
Routing table: default.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
10.1.2.4/30 user 0 ulst 1048576 2
10.1.5.17 ucst 625 12 ge-0/0/0.0
10.1.3.9 ucst 617 8 ge-0/0/1.0
Routing table: __pfe_private__.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 0 dscd 513 2
Routing table: __master.anon__.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 0 rjct 524 1
Routing table: __juniper_services__.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 0 dscd 546 2
Routing table: toCE2_3.inet
Internet:
Destination Type RtRef Next hop Type Index NhRef Netif
default perm 0 rjct 630 1
开头 10.1.2.4/30 的输出行显示,对于在同一 AS 中从设备 PE3 到设备 PE2 的路由,表中安装了两个下一跃点: 10.1.3.9 通过 ge-0/0/1.0 接口和 10.1.5.17 通过 ge-2/1/10.18 接口。
意义
路由的多个下一跃点(包括外部 BGP 路由)安装在转发表中。
在第 3 层 VPN 中配置与协议无关的负载平衡
第 3 层 VPN 的协议无关负载平衡允许使用活动路由和备用路径的转发下一跃点来实现负载平衡。与协议无关的负载平衡可与第 3 层 VPN 协同工作。它独立于分配的路由识别符,支持 VPN 路由的负载平衡。启用与协议无关的负载平衡后,到其他 PE 路由器的路由和到直接连接的 CE 路由器的路由均会实现负载平衡。
为给定路由创建负载平衡信息时,活动路径将标记为 Routing Use Only 在命令输出中 show route table 。
以下部分介绍如何配置与协议无关的负载平衡,以及此配置如何影响路由策略:
为第 3 层 VPN 配置负载平衡
IPv4 和 IPv6 对第 3 层 VPN 的协议无关负载平衡配置略有不同:
IPv4 — 您只需在
[edit routing-instances routing-instance-name routing-options]层次结构级别或[edit routing-instances routing-instance-name routing-options rib routing-table-name]层次结构级别配置multipath语句。IPv6 — 您需要在
[edit routing-instances routing-instance-name routing-options]层次结构级别和[edit routing-instances routing-instance-name routing-options rib routing-table-name]层次结构级别同时配置multipath语句。
您不能在配置 l3vpn 语句的同时配置multipath语句和子语句。
要为第 3 层 VPN 配置与协议无关的负载平衡,请添加 multipath 以下语句:
multipath { vpn-unequal-cost equal-external-internal; }
在以下层级包含 multipath 该语句时,将把与协议无关的负载平衡应用于该路由实例 (routing-instance-name.inet.0) 的默认路由表:
[edit routing-instances routing-instance-name routing-options][edit logical-systems logical-system-name routing-instances routing-instance-name routing-options]
[edit logical-systems]层次结构级别不适用于 ACX 系列路由器。
在以下层级包含 multipath 语句时,将协议无关的负载平衡应用于指定的路由表:
[edit routing-instances routing-instance-name routing-options rib routing-table-name][edit logical-systems logical-system-name routing-instances routing-instance-name routing-options rib routing-table-name]
[edit logical-systems]层次结构级别不适用于 ACX 系列路由器。
语 vpn-unequal-cost 句可选:
如果包含该协议,则会将协议无关的负载平衡应用于在路由选择方面等于 IGP 指标之前相等的 VPN 路由。
如果不包括该协议,则会将协议无关的负载平衡应用于在路由选择的路由器标识符之前相等的 VPN 路由。
该 vpn-unequal-cost 语句不适用于 ACX 系列路由器。
语 equal-external-internal 句也是可选的。如果包含该协议,则会将协议无关的负载平衡应用于内部和外部 BGP 路径。您可以将此功能与出口 IP 标头过滤(通过语句启用) vrf-table-label 一起配置。有关更多信息,请参阅第 3 层 VPN 的负载平衡和 IP 报头过滤。
您可以同时在[edit routing-options forwarding-options chained-composite-next-hop ingress]层次结构级别包含vpn-unequal-cost equal-external-internal语句和l3vpn语句。但是,如果执行此作,EBGP 将不起作用。这意味着,当同时存在具有链式下一跃点的路径和具有非链式下一跃点的路径作为 EBGP 等价多路径 (ECMP) 的候选路径时,使用链式下一跃点的路径将被排除在外。在典型情况下,排除的路径是内部路径。
配置负载平衡和路由策略
如果通过包含 multipath 语句为第 3 层 VPN 启用与协议无关的负载平衡,并且还在路由策略配置中包含该 load-balance per-packet 语句,则数据包不会进行负载均衡。
例如,PE 路由器配置了以下 VRF 路由实例:
[edit routing-instances]
load-balance-example {
instance-type vrf;
interface fe-0/1/1.0;
interface fe-0/1/1.1;
route-distinguisher 2222:2;
vrf-target target:2222:2;
routing-options {
multipath;
}
protocols {
bgp {
group group-example {
import import-policy;
family inet {
unicast;
}
export export-policy;
peer-as 4444;
local-as 3333;
multipath;
as-override;
neighbor 10.12.33.22;
}
}
}
}
PE 路由器还配置了以下策略语句:
[edit policy-options policy-statement export-policy]
from protocol bgp;
then {
load-balance per-packet;
}
在 VRF 路由实例配置中包含该 multipath 语句时,路径将不再标记为 BGP 路径,而是标记为多路径路径。来自 PE 路由器的数据包未进行负载均衡。
为确保 VPN 负载均衡按预期运行,请勿在策略语句配置中包含该 from protocol 语句。策略语句应按如下方式配置:
[edit policy-options policy-statement export-policy]
then {
load-balance per-packet;
}
有关如何配置按数据包负载平衡的更多信息,请参阅 路由策略、防火墙过滤器和流量监管器用户指南。
示例:在新一代组播 VPN 上配置 PIM 加入负载平衡
此示例说明如何在运行下一代组播 VPN (MVPN) 的提供商边缘 (PE) 路由器上具有不相等的内部网关协议 (IGP) 指标和协议无关组播 (PIM) 加入负载平衡,为外部和内部虚拟专用网络 (VPN) 路由配置多路径路由。当不存在外部 BGP (EBGP) 路径时,此功能允许客户 PIM (C-PIM) 加入消息在可用的内部 BGP (IBGP) 上行路径之间进行负载平衡,并且当源或集合点 (RP) 存在外部和内部 BGP (EIBGP) 路径时,在可用的 EBGP 上行路径之间进行负载平衡。
要求
此示例使用以下硬件和软件组件:
三台路由器,可以是 M Series、MX 系列或 T Series 路由器的组合。
在所有设备上运行 Junos OS 12.1 版。
开始之前:
配置设备接口。
在所有 PE 路由器上配置以下路由协议:
OSPF
MPLS 的比较
自民党
PIM
边界网关协议
配置组播 VPN。
概述和拓扑
Junos OS 12.1 及更高版本支持多路径配置以及 PIM 加入负载平衡。当只有 IBGP 路径存在时,C-PIM 加入消息可以在所有可用的 IBGP 路径之间进行负载均衡,当 EIBGP 路径存在到源(或 RP)时,可以在所有可用的上游 EBGP 路径之间进行负载平衡。与 Draft-Rosen MVPN 不同,下一代 MVPN 不利用不相等的 EIBGP 路径发送 C-PIM 加入消息。此功能适用于 IPv4 C-PIM 加入消息。
默认情况下,只有一个活动 IBGP 路径用于为只有指向源(或 RP)的 IBGP 路径的 PE 路由器发送 C-PIM 加入消息。当存在 EIBGP 上游路径时,仅使用一个活动 EBGP 路径来发送加入消息。
在新一代 MVPN 中,C-PIM 加入消息将转换为(或编码为)BGP 客户组播(C 组播)MVPN 路由,并与 BGP MCAST-VPN 地址族一起向发送方 PE 路由器播发。PE 路由器在通过其 PE 路由器到客户边缘 (CE) 路由器接口接收到 C-PIM 加入消息后,发起 C 组播 MVPN 路由。两种类型的 C 组播 MVPN 路由包括:
共享树加入路由(C-*、C-G)
由接收方 PE 路由器发起。
当 PE 路由器通过其 PE-CE 路由器接口接收共享树 C-PIM 加入消息时发出。
源树加入路由(C-S、C-G)
由接收方 PE 路由器发起。
在 PE 路由器收到源树 C-PIM 加入消息(C-S、C-G)时发出,或由已具有共享树加入路由并接收到源活动自动发现路由的 PE 路由器发出。
下一代 MVPN 中的上游路径是使用 Internet 草案 draft-ietf-l3vpn-2547bis-mcast Multicast in MPLS/BGP IP VPNs中指定的 Bytewise-XOR 哈希算法选择的。散列算法的执行方式如下:
候选集中的 PE 路由器从 0 开始,按从低到高 IP 地址的顺序编号。
在 C 根(源)和 C-G(组)地址上执行所有字节的逐字节独占或。
结果取模 n数,其中 n 为候选集中的 PE 路由器数量。结果为 N。
N 表示步骤 1 中编号的上游 PE 路由器 IP 地址。
在负载平衡期间,如果具有一条或多条通往源(或 RP)的上游 IBGP 路径的 PE 路由器发现一条通往同一源(或 RP)的新 IBGP 路径,则由于候选 PE 路由器集的更改,分布在先前现有 IBGP 路径中的 C-PIM 加入消息将被重新分配。
在此示例中,PE1、PE2 和 PE3 是配置了多路径 PIM 加入负载平衡功能的 PE 路由器。路由器 PE1 有两条 EBGP 路径和一条 IBGP 上行路径,PE2 有一条 EBGP 路径和一条 IBGP 上行路径,PE3 有两条通往源的 IBGP 上行路径。路由器 CE4 是连接到 PE3 的客户边缘 (CE) 路由器。Source 和 Receiver 是免费的 BSD 主机。
在具有指向源(或 RP)的 EIBGP 路径的 PE 路由器(如 PE1 和 PE2)上,按如下方式执行 PIM 加入负载平衡:
C-PIM 加入消息仅使用 EBGP 路径发送。IBGP 路径不用于传播联接消息。
在 图 2 中,PE1 路由器将连接消息在两条 EBGP 路径之间分发到 CE1 路由器,PE2 使用 EBGP 路径向 CE1 发送连接消息。
如果 PE 路由器丢失了一条或多条通向源(或 RP)的 EBGP 路径,则会根据散列机制选择组播隧道接口上的 RPF 邻接方。
发现第一个 EBGP 路径时,只有新的加入消息会在可用的 EBGP 路径之间实现负载均衡,而组播隧道接口上的现有加入消息不会重新分配。
如果从 PE2 路由器到 CE1 路由器的 EBGP 路径出现问题,PE2 将使用 IBGP 路径向 PE1 发送加入消息。当到 CE1 的 EBGP 路径恢复时,只有到达 PE2 的新加入消息才使用恢复的 EBGP 路径,而已经在 IBGP 路径上发送的加入消息不会重新分发。
在只有通向源(或 RP)的 IBGP 路径的 PE 路由器(如 PE3 路由器)上,按如下方式执行 PIM 加入负载平衡:
来自 CE 路由器的 C-PIM 加入消息仅在 IBGP 路径之间作为 BGP C 组播数据消息进行负载平衡。
在 图 2 中,假设 CE4 主机有兴趣接收来自源的流量,并且 CE4 为不同的组(组 1 [C-S,C-G1] 和组 2 [C-S,C-G2])发起源加入消息,则源加入消息将到达 PE3 路由器。
路由器 PE3 随后使用字节 XOR 散列算法选择上游 PE 路由器,以发送每个组的 C 组播数据。该算法首先对上游 PE 路由器进行编号,从 0 开始从低到高 IP 地址。
假设路由器 PE1 路由器编号为 0 ,路由器 PE2 为 1,且组 1 和组 2 加入消息的哈希结果分别为 0 和 1,则 PE3 路由器选择 PE1 作为上游 PE 路由器发送第 1 组加入消息,选择 PE2 作为上游 PE 路由器向源发送第 2 组加入消息。
不同组 [C-*,C-G] 的共享加入消息也以类似的方式处理以到达目标。
上的 PIM 加入负载平衡
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层 [edit] 级的 CLI 中,然后从配置模式进入 commit 。
PE1型
set routing-instances vpn1 instance-type vrf set routing-instances vpn1 interface ge-3/0/1.0 set routing-instances vpn1 interface ge-3/3/2.0 set routing-instances vpn1 interface lo0.1 set routing-instances vpn1 route-distinguisher 1:1 set routing-instances vpn1 provider-tunnel rsvp-te label-switched-path-template default-template set routing-instances vpn1 vrf-target target:1:1 set routing-instances vpn1 vrf-table-label set routing-instances vpn1 routing-options multipath vpn-unequal-cost equal-external-internal set routing-instances vpn1 protocols bgp export direct set routing-instances vpn1 protocols bgp group bgp type external set routing-instances vpn1 protocols bgp group bgp local-address 10.40.10.1 set routing-instances vpn1 protocols bgp group bgp family inet unicast set routing-instances vpn1 protocols bgp group bgp neighbor 10.40.10.2 peer-as 3 set routing-instances vpn1 protocols bgp group bgp1 type external set routing-instances vpn1 protocols bgp group bgp1 local-address 10.10.10.1 set routing-instances vpn1 protocols bgp group bgp1 family inet unicast set routing-instances vpn1 protocols bgp group bgp1 neighbor 10.10.10.2 peer-as 3 set routing-instances vpn1 protocols pim rp static address 10.255.10.119 set routing-instances vpn1 protocols pim interface all set routing-instances vpn1 protocols pim join-load-balance set routing-instances vpn1 protocols mvpn mvpn-mode rpt-spt set routing-instances vpn1 protocols mvpn mvpn-join-load-balance bytewise-xor-hash
PE2
set routing-instances vpn1 instance-type vrf set routing-instances vpn1 interface ge-1/0/9.0 set routing-instances vpn1 interface lo0.1 set routing-instances vpn1 route-distinguisher 2:2 set routing-instances vpn1 provider-tunnel rsvp-te label-switched-path-template default-template set routing-instances vpn1 vrf-target target:1:1 set routing-instances vpn1 vrf-table-label set routing-instances vpn1 routing-options multipath vpn-unequal-cost equal-external-internal set routing-instances vpn1 protocols bgp export direct set routing-instances vpn1 protocols bgp group bgp local-address 10.50.10.2 set routing-instances vpn1 protocols bgp group bgp family inet unicast set routing-instances vpn1 protocols bgp group bgp neighbor 10.50.10.1 peer-as 3 set routing-instances vpn1 protocols pim rp static address 10.255.10.119 set routing-instances vpn1 protocols pim interface all set routing-instances vpn1 protocols mvpn mvpn-mode rpt-spt set routing-instances vpn1 protocols mvpn mvpn-join-load-balance bytewise-xor-hash
聚乙烯3
set routing-instances vpn1 instance-type vrf set routing-instances vpn1 interface ge-0/0/8.0 set routing-instances vpn1 interface lo0.1 set routing-instances vpn1 route-distinguisher 3:3 set routing-instances vpn1 provider-tunnel rsvp-te label-switched-path-template default-template set routing-instances vpn1 vrf-target target:1:1 set routing-instances vpn1 vrf-table-label set routing-instances vpn1 routing-options multipath vpn-unequal-cost equal-external-internal set routing-instances vpn1 routing-options autonomous-system 1 set routing-instances vpn1 protocols bgp export direct set routing-instances vpn1 protocols bgp group bgp type external set routing-instances vpn1 protocols bgp group bgp local-address 10.80.10.1 set routing-instances vpn1 protocols bgp group bgp family inet unicast set routing-instances vpn1 protocols bgp group bgp neighbor 10.80.10.2 peer-as 2 set routing-instances vpn1 protocols pim rp static address 10.255.10.119 set routing-instances vpn1 protocols pim interface all set routing-instances vpn1 protocols mvpn mvpn-mode rpt-spt set routing-instances vpn1 protocols mvpn mvpn-join-load-balance bytewise-xor-hash
程序
分步过程
下面的示例要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅 在配置模式下使用 CLI 编辑器。要配置 PE1 路由器,请执行以下作:
修改每台路由器的相应接口名称、地址和任何其他参数后,对 MVPN 域中的每台瞻博网络路由器重复此过程。
配置 VPN 路由转发 (VRF) 路由实例。
[edit routing-instances vpn1] user@PE1# set instance-type vrf user@PE1# set interface ge-3/0/1.0 user@PE1# set interface ge-3/3/2.0 user@PE1# set interface lo0.1 user@PE1# set route-distinguisher 1:1 user@PE1# set provider-tunnel rsvp-te label-switched-path-template default-template user@PE1# set vrf-target target:1:1 user@PE1# set vrf-table-label为 VRF 实例启用与协议无关的负载平衡。
[edit routing-instances vpn1] user@PE1# set routing-options multipath vpn-unequal-cost equal-external-internal配置 BGP 组和邻居以启用 PE 到 CE 路由。
[edit routing-instances vpn1 protocols] user@PE1# set bgp export direct user@PE1# set bgp group bgp type external user@PE1# set bgp group bgp local-address 10.40.10.1 user@PE1# set bgp group bgp family inet unicast user@PE1# set bgp group bgp neighbor 10.40.10.2 peer-as 3 user@PE1# set bgp group bgp1 type external user@PE1# set bgp group bgp1 local-address 10.10.10.1 user@PE1# set bgp group bgp1 family inet unicast user@PE1# set bgp group bgp1 neighbor 10.10.10.2 peer-as 3配置 PIM 以启用 PE 到 CE 组播路由。
[edit routing-instances vpn1 protocols] user@PE1# set pim rp static address 10.255.10.119在所有网络接口上启用 PIM。
[edit routing-instances vpn1 protocols] user@PE1# set pim interface all为 VRF 实例启用 PIM 加入负载平衡。
[edit routing-instances vpn1 protocols] user@PE1# set pim join-load-balance将 C-PIM 联接消息的模式配置为使用集合点树,并在知道来源后切换到最短路径树。
[edit routing-instances vpn1 protocols] user@PE1# set mvpn mvpn-mode rpt-spt将 VRF 实例配置为使用 Bytewise-XOR 哈希算法。
[edit routing-instances vpn1 protocols] user@PE1# set mvpn mvpn-join-load-balance bytewise-xor-hash
结果
在配置模式下,输入 show routing-instances 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@PE1# show routing-instances
routing-instances {
vpn1 {
instance-type vrf;
interface ge-3/0/1.0;
interface ge-3/3/2.0;
interface lo0.1;
route-distinguisher 1:1;
provider-tunnel {
rsvp-te {
label-switched-path-template {
default-template;
}
}
}
vrf-target target:1:1;
vrf-table-label;
routing-options {
multipath {
vpn-unequal-cost equal-external-internal;
}
}
protocols {
bgp {
export direct;
group bgp {
type external;
local-address 10.40.10.1;
family inet {
unicast;
}
neighbor 10.40.10.2 {
peer-as 3;
}
}
group bgp1 {
type external;
local-address 10.10.10.1;
family inet {
unicast;
}
neighbor 10.10.10.2 {
peer-as 3;
}
}
}
pim {
rp {
static {
address 10.255.10.119;
}
}
interface all;
join-load-balance;
}
mvpn {
mvpn-mode {
rpt-spt;
}
mvpn-join-load-balance {
bytewise-xor-hash;
}
}
}
}
如果完成设备配置,请从配置模式进入 提交 。
验证
确认配置工作正常。
验证不同加入消息组的 MVPN C 组播路由信息
目的
验证 PE3 路由器上接收的不同加入消息组的 MVPN C 组播路由信息。
行动
在作模式下,运行 show mvpn c-multicast 命令。
user@PE3>
MVPN instance:
Legend for provider tunnel
I-P-tnl -- inclusive provider tunnel S-P-tnl -- selective provider tunnel
Legend for c-multicast routes properties (Pr)
DS -- derived from (*, c-g) RM -- remote VPN route
Family : INET
Instance : vpn1
MVPN Mode : RPT-SPT
C-mcast IPv4 (S:G) Ptnl St
0.0.0.0/0:203.0.113.1/24 RSVP-TE P2MP:10.255.10.2, 5834,10.255.10.2
192.0.2.2/24:203.0.113.1/24 RSVP-TE P2MP:10.255.10.2, 5834,10.255.10.2
0.0.0.0/0:203.0.113.2/24 RSVP-TE P2MP:10.255.10.14, 47575,10.255.10.14
192.0.2.2/24:203.0.113.2/24 RSVP-TE P2MP:10.255.10.14, 47575,10.255.10.14
意义
输出显示 PE3 路由器如何对不同组的 C 组播数据进行负载均衡。
对于源加入消息 (S,G):
192.0.2.2/24:203.0.113.1/24 (S,G1) 朝向 PE1 路由器(10.255.10.2 是路由器 PE1 的环路地址)。
192.0.2.2/24:203.0.113.2/24 (S,G2) 朝向 PE2 路由器(10.255.10.14 是路由器 PE2 的环路地址)。
对于共享加入消息 (*,G):
0.0.0.0/0:203.0.113.1/24 (*,G1) 朝向 PE1 路由器(10.255.10.2 是路由器 PE1 的环路地址)。
0.0.0.0/0:203.0.113.2/24 (*,G2) 朝向 PE2 路由器(10.255.10.14 是路由器 PE2 的环路地址)。