示例:配置 PIM Make-Before-Break 联接负载平衡
了解 PIM Automatic Make-Make-Before-Break Join 负载平衡功能
当接口添加到 ECMP 路径时,PIM 自动先接后断 (MBB) 加入负载平衡功能引入了在等价多路径 (ECMP) 链路上重新分配 PIM 连接,同时将流量中断降至最低。
现有 PIM 联接负载均衡功能支持跨 ECMP 链路分发联接。如果发生链路故障,联接将在剩余的 ECMP 链路之间重新分配,并且流量将丢失。除非使用命令将现有联接负载均衡到新接口,否则 clear pim join-distribution
添加接口不会导致此连接分布发生更改。如果配置了 PIM 自动 MBB 加入负载平衡功能,则此过程将自动发生。
可以通过在[edit protocols pim join-load-balance]
层次结构级别使用automatic
语句来启用该功能。当新的邻接方可用时,可以使用语句在[edit protocols pim]
层次结构级别上配置standby-path-creation-delay seconds
创建邻接方路径(备用路径)所需的时间。如果没有此语句,则会立即创建备用路径,并在将新邻接方添加到网络后立即重新分配联接项。对于在没有流量idle-standby-path-switchover-delay seconds
的情况下要将联接移动到备用路径,将在层次结构级别上配置[edit protocols pim]
语句。如果没有此语句,则在备用路径上接收到流量之前,不会移动联接。
protocols { pim { join-load-balance { automatic; } standby-path-creation-delay seconds; idle-standby-path-switchover-delay seconds; } }
示例:配置 PIM Make-Before-Break 联接负载平衡
此示例说明如何配置 PIM 先合后断 (MBB) 联接负载平衡功能。
要求
此示例使用以下硬件和软件组件:
这三台路由器可以是 M Series 多服务边缘路由器(仅限 M120 和 M320)、MX 系列 5G 通用路由平台或 T Series 核心路由器(仅限 TX Matrix 和 TX Matrix Plus)的组合。
Junos OS 12.2 或更高版本。
在配置 MBB 功能之前,请确保您已:
已配置设备接口。
为设备上的 IPv4 和 IPv6 路由(例如 OSPF 和 OSPFv3)配置内部网关协议 (IGP)。
在任意两个路由器(例如,路由器 R1 和 R2)上使用 VLAN 配置多个 ECMP 接口(逻辑隧道)。
概述
Junos OS 提供 PIM 自动 MBB 联接负载均衡功能,可确保 PIM 联接均匀地重新分配给等价多路径 (ECMP) 路径上的所有上游 PIM 邻接方。将接口添加到 ECMP 路径时,MBB 将允许切换到流量中断最小的备用路径。
拓扑学
在此示例中,三个路由器在源和接收器之间以线性方式连接。所有三个路由器上都配置了 IGP 协议和 PIM 稀疏模式。源连接到路由器 R0,路由器 R1 和 R2 之间配置了 5 个接口。接收器连接到路由器 R2,并在路由器 R2 上配置 PIM 自动 MBB 加入负载平衡。
图 1 显示了此示例中使用的拓扑。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层 [edit]
级的 CLI 中。
路由器 R0(源)
set protocols pim interface all mode sparse set protocols pim interface all version 2 set protocols pim rp static address 10.255.12.34 set protocols pim rp static address abcd::10:255:12:34
路由器 R1 (RP)
set protocols pim interface all mode sparse set protocols pim interface all version 2 set protocols pim rp local family inet address 10.255.12.34 set protocols pim rp local family inet6 address abcd::10:255:12:34
路由器 R2(接收器)
set protocols pim interface all mode sparse set protocols pim interface all version 2 set protocols pim rp static address 10.255.12.34 set protocols pim rp static address abcd::10:255:12:34 set protocols mld interface ge-0/0/3 version 1 set protocols mld interface ge-0/0/3 static group ff05::e100:1 group-count 100 set protocols pim join load-balance automatic set protocols pim standby-path-creation-delay 5 set protocols pim idle-standby-path-switchover-delay 10
配置 PIM MBB 联接负载平衡
分步过程
下面的示例要求您在各个配置层级中进行导航。有关 CLI 导航的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要在整个设置中配置 PIM MBB 联接负载平衡,请执行以下作:
在所有三个路由器上配置 PIM 稀疏模式。
[edit protocols pim interface all] user@host# set mode sparse user@host# set version 2
将路由器 R1 配置为 RP。
[edit protocols pim rp local] user@R1# set family inet address 10.255.12.34 user@R1# set family inet6 address abcd::10:255:12:34
在非 RP 路由器(R0 和 R2)上配置 RP 静态地址。
[edit protocols pim rp ] user@host# set static address 10.255.12.34 user@host# set static address abcd::10:255:12:34
为路由器 R2 上的 ECMP 接口配置组播侦听发现 (MLD) 组。
[edit protocols mld interface ge-0/0/3] user@R2# set version 1 user@R2# set static group ff05::e100:1 group-count 100
在接收方路由器(路由器 R2)上配置 PIM MBB 联接负载平衡功能。
[edit protocols pim] user@R2# set join load-balance automatic user@R2# set standby-path-creation-delay 5 user@R2# set idle-standby-path-switchover-delay 10
结果
在配置模式下,输入 show protocols
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@R0# show protocols ospf { area 0.0.0.0 { interface lo0.0; interface ge-0/0/3.1; interface ge-0/0/3.2; interface ge-0/0/3.3; interface ge-0/0/3.4; interface ge-0/0/3.5; } } ospf3 { area 0.0.0.0 { interface lo0.0; interface ge-0/0/3.1; interface ge-0/0/3.2; interface ge-0/0/3.3; interface ge-0/0/3.4; interface ge-0/0/3.5; } } pim { rp { static { address 10.255.12.34; address abcd::10:255:12:34; } } interface all { mode sparse; version 2; } interface fxp0.0 { disable; } interface ge-0/0/3.1; interface ge-0/0/3.2; interface ge-0/0/3.3; interface ge-0/0/3.4; interface ge-0/0/3.5; }
user@R1# show protocols ospf { area 0.0.0.0 { interface lo0.0; interface ge-0/0/3.1; interface ge-0/0/3.2; interface ge-0/0/3.3; interface ge-0/0/3.4; interface ge-0/0/3.5; } } ospf3 { area 0.0.0.0 { interface lo0.0; interface ge-0/0/3.1; interface ge-0/0/3.2; interface ge-0/0/3.3; interface ge-0/0/3.4; interface ge-0/0/3.5; } } pim { rp { local { family inet { address 10.255.12.34; } family inet6 { address abcd::10:255:12:34; } } } interface all { mode sparse; version 2; } interface fxp0.0 { disable; } interface ge-0/0/3.1; interface ge-0/0/3.2; interface ge-0/0/3.3; interface ge-0/0/3.4; interface ge-0/0/3.5; }
user@R2# show protocols mld { interface ge-0/0/3.1 { version 1; static { group ff05::e100:1 { group-count 100; } } } ospf { area 0.0.0.0 { interface lo0.0; interface ge-1/0/7.1; interface ge-1/0/7.2; interface ge-1/0/7.3; interface ge-1/0/7.4; interface ge-1/0/7.5; interface ge-0/0/3.1; } } ospf3 { area 0.0.0.0 { interface lo0.0; interface ge-1/0/7.1; interface ge-1/0/7.2; interface ge-1/0/7.3; interface ge-1/0/7.4; interface ge-1/0/7.5; interface ge-0/0/3.1; } } pim { rp { static { address 10.255.12.34; address abcd::10:255:12:34; } } interface all { mode sparse; version 2; } interface fxp0.0 { disable; } interface ge-1/0/7.1; interface ge-1/0/7.2; interface ge-1/0/7.3; interface ge-1/0/7.4; interface ge-1/0/7.5; interface ge-0/0/3.1; join-load-balance { automatic; } standby-path-creation-delay 5; idle-standby-path-switchover-delay 10; }
验证
验证接口配置
目的
验证配置的接口是否正常运行。
行动
发送 100 (S,G) 连接从接收器到路由器 R2。在路由器 R2 的作模式下,运行 show pim interfaces 命令。
user@R2> show pim interfaces Stat = Status, V = Version, NbrCnt = Neighbor Count, S = Sparse, D = Dense, B = Bidirectional, DR = Designated Router, P2P = Point-to-point link, Active = Bidirectional is active, NotCap = Not Bidirectional Capable Name Stat Mode IP V State NbrCnt JoinCnt(sg/*g) DR address ge-0/0/3.1 Up S 4 2 DR,NotCap 0 0/0 70.0.0.1 ge-1/0/7.1 Up S 4 2 DR,NotCap 1 20/0 14.0.0.2 ge-1/0/7.2 Up S 4 2 DR,NotCap 1 20/0 14.0.0.6 ge-1/0/7.3 Up S 4 2 DR,NotCap 1 20/0 14.0.0.10 ge-1/0/7.4 Up S 4 2 DR,NotCap 1 20/0 14.0.0.14 ge-1/0/7.5 Up S 4 2 DR,NotCap 1 20/0 14.0.0.18
输出列出了配置为用于 PIM 协议的所有接口。该 Stat
字段表示接口的当前状态。该 DR address
字段列出了配置的 IP 地址。所有接口均可运行。如果输出未指示接口正常运行,请在继续作之前重新配置接口。
意义
所有配置的接口在网络中均正常工作。
验证 PIM
目的
验证 PIM 在配置的网络中是否正常运行。
行动
在作模式下,输入 show pim statistics 命令。
user@R2> show pim statistics PIM Message type Received Sent Rx errors V2 Hello 4253 5269 0 V2 Register 0 0 0 V2 Register Stop 0 0 0 V2 Join Prune 0 1750 0 V2 Bootstrap 0 0 0 V2 Assert 0 0 0 V2 Graft 0 0 0 V2 Graft Ack 0 0 0 V2 Candidate RP 0 0 0 V2 State Refresh 0 0 0 V2 DF Election 0 0 0 V1 Query 0 0 0 V1 Register 0 0 0 V1 Register Stop 0 0 0 V1 Join Prune 0 0 0 V1 RP Reachability 0 0 0 V1 Assert 0 0 0 V1 Graft 0 0 0 V1 Graft Ack 0 0 0 AutoRP Announce 0 0 0 AutoRP Mapping 0 0 0 AutoRP Unknown type 0 Anycast Register 0 0 0 Anycast Register Stop 0 0 0 Global Statistics Hello dropped on neighbor policy 0 Unknown type 0 V1 Unknown type 0 Unknown Version 0 Neighbor unknown 0 Bad Length 0 Bad Checksum 0 Bad Receive If 0 Rx Bad Data 0 Rx Intf disabled 0 Rx V1 Require V2 0 Rx V2 Require V1 0 Rx Register not RP 0 Rx Register no route 0 Rx Register no decap if 0 Null Register Timeout 0 RP Filtered Source 0 Rx Unknown Reg Stop 0 Rx Join/Prune no state 0 Rx Join/Prune on upstream if 0 Rx Join/Prune for invalid group 0 Rx Join/Prune messages dropped 0 Rx sparse join for dense group 0 Rx Graft/Graft Ack no state 0 Rx Graft on upstream if 0 Rx CRP not BSR 0 Rx BSR when BSR 0 Anycast Register Stop 0 0 0
该 V2 Hello
字段列出了发送和接收的 PIM hello 消息数。该 V2 Join Prune
字段列出了在达到该值之前 join-prune-timeout
发送的加入消息数。如果这两个值均不为零,则 PIM 正常运行。
意义
PIM 在网络中运行。
验证 PIM 自动 MBB 联接负载平衡功能
目的
验证 PIM 自动 MBB 加入负载均衡功能是否按配置工作。
行动
要查看 MBB 功能对路由器 R2 的影响,请执行以下作:
在禁用接口之前, show pim interfaces 请运行作模式命令。
user@R2> show pim interfaces Stat = Status, V = Version, NbrCnt = Neighbor Count, S = Sparse, D = Dense, B = Bidirectional, DR = Designated Router, P2P = Point-to-point link, Active = Bidirectional is active, NotCap = Not Bidirectional Capable Name Stat Mode IP V State NbrCnt JoinCnt(sg/*g) DR address ge-0/0/3.1 Up S 4 2 DR,NotCap 0 0/0 70.0.0.1 ge-1/0/7.1 Up S 4 2 DR,NotCap 1 20/0 14.0.0.2 ge-1/0/7.2 Up S 4 2 DR,NotCap 1 20/0 14.0.0.6 ge-1/0/7.3 Up S 4 2 DR,NotCap 1 20/0 14.0.0.10 ge-1/0/7.4 Up S 4 2 DR,NotCap 1 20/0 14.0.0.14 ge-1/0/7.5 Up S 4 2 DR,NotCap 1 20/0 14.0.0.18
该
JoinCnt(sg/*g)
字段显示 100 个连接平均分布在五个接口之间。禁用
ge-1/0/7.5
接口。[edit] user@R2# set interfaces ge-1/0/7.5 disable user@R2# commit
show pim interfaces运行命令以检查是否正在对联接进行负载平衡。
user@R2> show pim interfaces Stat = Status, V = Version, NbrCnt = Neighbor Count, S = Sparse, D = Dense, B = Bidirectional, DR = Designated Router, P2P = Point-to-point link, Active = Bidirectional is active, NotCap = Not Bidirectional Capable Name Stat Mode IP V State NbrCnt JoinCnt(sg/*g) DR address ge-0/0/3.1 Up S 4 2 DR,NotCap 0 0/0 70.0.0.1 ge-1/0/7.1 Up S 4 2 DR,NotCap 1 25/0 14.0.0.2 ge-1/0/7.2 Up S 4 2 DR,NotCap 1 25/0 14.0.0.6 ge-1/0/7.3 Up S 4 2 DR,NotCap 1 25/0 14.0.0.10 ge-1/0/7.4 Up S 4 2 DR,NotCap 1 25/0 14.0.0.14
该
JoinCnt(sg/*g)
字段显示,这 100 个连接在四个活动接口之间平均重新分配。在路由器 R2 上添加已移除的接口。
[edit] user@R2# delete interfaces ge-1/0/7.5 disable user@R2# commit
show pim interfaces运行命令以检查启用非活动接口后是否正在对连接进行负载平衡。
user@R2> show pim interfaces Stat = Status, V = Version, NbrCnt = Neighbor Count, S = Sparse, D = Dense, B = Bidirectional, DR = Designated Router, P2P = Point-to-point link, Active = Bidirectional is active, NotCap = Not Bidirectional Capable Name Stat Mode IP V State NbrCnt JoinCnt(sg/*g) DR address ge-0/0/3.1 Up S 4 2 DR,NotCap 0 0/0 70.0.0.1 ge-1/0/7.1 Up S 4 2 DR,NotCap 1 20/0 14.0.0.2 ge-1/0/7.2 Up S 4 2 DR,NotCap 1 20/0 14.0.0.6 ge-1/0/7.3 Up S 4 2 DR,NotCap 1 20/0 14.0.0.10 ge-1/0/7.4 Up S 4 2 DR,NotCap 1 20/0 14.0.0.14 ge-1/0/7.5 Up S 4 2 DR,NotCap 1 20/0 14.0.0.18
该
JoinCnt(sg/*g)
字段显示 100 个连接平均分布在五个接口之间。注意:此输出应类似于步骤 1 中的输出。
意义
PIM 自动 MBB 加入负载均衡功能按配置工作。