在本页
BGP 会话的负载平衡
了解 BGP 多路径
BGP 多路径允许您将多个内部 BGP 路径和多个外部 BGP 路径安装到转发表。选择多个路径可以使 BGP 跨多个链路实现流量负载均衡。
如果 BGP 路径选择过程在比较 IGP 成本与下一跃点之后执行关联中断,则路径被视为 BGP 等价路径(用于转发)。默认情况下,多路径选择过程中会考虑具有相同相邻 AS、由支持多路径的 BGP 邻接方获知的所有路径。
BGP 通常为每个前缀只选择一个最佳路径,并将该路由安装在转发表表中。启用 BGP 多路径后,设备会选择多个等价 BGP 路径以到达给定目标,并且所有这些路径均安装在转发表中。BGP 仅将活动路径播发至其邻接方,除非正在使用 add-path。
Junos OS BGP 多路径功能支持以下应用程序:
跨属于不同自治系统 (AS) 的两个路由设备之间的多个链路实现负载平衡
跨公共子网或多个子网将负载平衡到属于同一对等 AS 的不同路由设备
在属于不同外部联合对等方的两个路由设备之间的多个链路上进行负载平衡
在公共子网或多个子网之间实现负载平衡到属于外部联合对等方的不同路由设备
在进行负载平衡的常见场景中,客户多宿主到接入点 (POP) 中的多个路由器或交换机。默认行为是仅通过一个可用链路发送所有流量。负载平衡会使流量使用两个或多个链路。
BGP 多路径不适用于共享相同 MED-plus-IGP 成本,但 IGP 成本不同的路径。多路径路径选择基于 IGP 成本指标,即使两个路径的成本 MED-plus-IGP 成本相同。
从 Junos OS 18.1R1 BGP 多路径版本开始,在层次结构级别上 [edit protocols bgp]
受全局支持。您可以选择性地禁用某些 BGP 组和邻接方上的多路径。[edit protocols bgp group group-name multipath]
包含在disable
层次结构级别,以禁用组或特定 BGP 邻接方的多路径选项。
从 Junos OS 18.1R1 版开始,您可以将多路径计算推迟到接收所有 BGP 路由。启用多路径后,每次添加新路由或现有路由发生变化时,BGP 都会将路由插入多路径队列。通过 BGP add-path 功能接收多个路径时,BGP 可能会多次计算一个多路径路由。多路径计算会降低 RIB(也称为路由表)的学习速率。为了加速 RIB 学习,多路径计算可以推迟到接收 BGP 路由之前,也可以根据您的要求降低多路径构建作业的优先级,直到解决 BGP 路由。推迟在层次结构级别执行多路径计算配置defer-initial-multipath-build
[edit protocols bgp]
。或者,您可以使用层级的配置语句[edit protocols bgp]
来降低 BGP 多路径构建作业的优先级multipath-build-priority
,以加速 RIB 学习。
另请参阅
示例:均衡 BGP 流量负载
此示例说明如何配置 BGP 以选择多个等价外部 BGP (EBGP) 或内部 BGP (IBGP) 路径作为活动路径。
要求
开始之前:
配置设备接口。
配置内部网关协议 (IGP)。
配置 BGP。
配置将路由(如直接路由或 IGP 路由)从路由表导出到 BGP 的路由策略。
概述
以下步骤说明如何配置按数据包的负载平衡:
通过在层次结构级别包含一个或多个
policy-statement
语句[edit policy-options]
来定义负载平衡路由策略,将操作load-balance per-packet
定义为:policy-statement policy-name { from { match-conditions; route-filter destination-prefix match-type <actions>; prefix-list name; } then { load-balance per-packet; } }
将策略应用于从路由表导出到转发表中的路由。为此,请包括
forwarding-table
和export
语句:forwarding-table { export policy-name; }
您不能将导出策略应用于 VRF 路由实例。
在分配与要播发的路由对应的标签时,指定该路由的所有下一跃点(如果存在多个跃点)。
配置 MPLS 的转发选项散列密钥,以包括 IP 有效负载。
在某些平台上,您可以使用语句来增加负载平衡 chassis maximum-ecmp
的路径数量。使用此语句,您可以将等价负载平衡路径的最大数量更改为 32、64、128、256 或 512(最大数量因平台而异 — 请参阅 最大 ecmp。) 从 Junos OS 19.1R1 版开始,您可以指定 QFX10000 交换机上的最大等价路径数为 128 个。从 Junos OS 19.2R1 版开始,您可以指定 QFX10000 交换机上最多 512 个等价路径。请参阅 了解多达 512 个等价路径以及可选一致的负载平衡的配置。
在此示例中,设备 R1 位于 AS 64500 中,并连接到位于 AS 64501 中的设备 R2 和设备 R3。此示例显示了设备 R1 上的配置。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 CLI 中 [edit]
。
set protocols bgp group external type external set protocols bgp group external peer-as 64501 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.1 set protocols bgp group external neighbor 10.0.0.2 set policy-options policy-statement loadbal from route-filter 10.0.0.0/16 orlonger set policy-options policy-statement loadbal then load-balance per-packet set routing-options forwarding-table export loadbal set routing-options autonomous-system 64500
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话:
配置 BGP 组。
[edit protocols bgp group external] user@R1# set type external user@R1# set peer-as 64501 user@R1# set neighbor 10.0.1.1 user@R1# set neighbor 10.0.0.2
允许 BGP 组使用多个路径。
注:要禁用默认检查,要求 BGP 多路径接受的路径必须具有相同的相邻自治系统 (AS),请包括以下
multiple-as
选项。[edit protocols bgp group external] user@R1# set multipath
配置负载平衡策略。
[edit policy-options policy-statement loadbal] user@R1# set from route-filter 10.0.0.0/16 orlonger user@R1# set then load-balance per-packet
应用负载平衡策略。
[edit routing-options] user@R1# set forwarding-table export loadbal
配置本地自治系统 (AS) 编号。
[edit routing-options] user@R1# set autonomous-system 64500
结果
在配置模式下,输入 、 show policy-options
和show routing-options
命令,show protocols
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit]
user@R1# show protocols
bgp {
group external {
type external;
peer-as 64501;
multipath;
neighbor 10.0.1.1;
neighbor 10.0.0.2;
}
}
[edit]
user@R1# show policy-options
policy-statement loadbal {
from {
route-filter 10.0.0.0/16 orlonger;
}
then {
load-balance per-packet;
}
}
[edit]
user@R1# show routing-options
autonomous-system 64500;
forwarding-table {
export loadbal;
}
完成设备配置后,请从配置模式进入 commit
。
验证
确认配置工作正常:
验证路由
目的
验证是否已从相邻 AS 中的两个路由器中学习路由。
行动
在操作模式下,运行 show route
命令。
user@R1> show route 10.0.2.0 inet.0: 12 destinations, 15 routes (12 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.2.0/30 *[BGP/170] 03:12:32, localpref 100 AS path: 64501 I to 10.0.1.1 via ge-1/2/0.0 > to 10.0.0.2 via ge-1/2/1.0 [BGP/170] 03:12:32, localpref 100 AS path: 64501 I > to 10.0.1.1 via ge-1/2/0.0
user@R1> show route 10.0.2.0 detail inet.0: 12 destinations, 15 routes (12 active, 0 holddown, 0 hidden) 10.0.2.0/30 (2 entries, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 262142 Next-hop reference count: 3 Source: 10.0.0.2 Next hop: 10.0.1.1 via ge-1/2/0.0 Next hop: 10.0.0.2 via ge-1/2/1.0, selected State: <Active Ext> Local AS: 64500 Peer AS: 64501 Age: 3:18:30 Task: BGP_64501.10.0.0.2+55402 Announcement bits (1): 2-KRT AS path: 64501 I Accepted Multipath Localpref: 100 Router ID: 192.168.2.1 BGP Preference: 170/-101 Next hop type: Router, Next hop index: 602 Next-hop reference count: 5 Source: 10.0.1.1 Next hop: 10.0.1.1 via ge-1/2/0.0, selected State: <NotBest Ext> Inactive reason: Not Best in its group - Active preferred Local AS: 64500 Peer AS: 64501 Age: 3:18:30 Task: BGP_64501.10.0.1.1+53135 AS path: 64501 I Accepted Localpref: 100 Router ID: 192.168.3.1
含义
活动路径(以星号 (*)表示)有两个下一跃点:10.0.1.1 和 10.0.0.2 到 10.0.2.0 目标。10.0.1.1 下一跃点将从非活动路径复制到活动路径。
命令 show route detail
输出将一个网关指定为 selected
。此输出在负载平衡环境中可能会造成混淆。除了在 Junos OS 未执行按数据包负载均衡时决定将哪个网关安装在内核中之外,所选的网关还用于许多目的。例如,命令在 ping mpls
发送数据包时会使用所选的网关。在某些情况下,组播协议使用选定的网关来确定上游接口。因此,即使 Junos OS 通过转发表策略执行按数据包负载均衡,仍需要出于其他目的而选择的网关信息。显示所选网关以用于故障排除非常有用。此外,可以使用转发表策略来覆盖内核中安装的内容(例如,通过使用 install-nexthop
操作)。在这种情况下,安装在转发表中的下一跃点网关可能是命令中显示的 show route
总网关的子集。
验证转发
目的
验证是否已在转发表中安装了两个下一跃点。
行动
在操作模式下,运行 show route forwarding-table
命令。
user@R1> show route forwarding-table destination 10.0.2.0 Routing table: default.inet Internet: Destination Type RtRef Next hop Type Index NhRef Netif 10.0.2.0/30 user 0 ulst 262142 2 10.0.1.1 ucst 602 5 ge-1/2/0.0 10.0.0.2 ucst 522 6 ge-1/2/1.0
通过可选的一致负载平衡了解多达 512 条等价路径的配置
您可以为外部 BGP 对等方配置等价多路径 (ECMP) 功能,为外部 BGP 对等方配置最多 512 个路径。配置多达 512 个 ECMP 下一跃点后,您就可以增加与指定路由设备的直接 BGP 对等连接的数量,从而改善延迟并优化数据流。您可以选择在 ECMP 配置中包含一致的负载平衡。一致的负载平衡可确保在 ECMP 成员(即路径)发生故障时,仅流经故障成员的流量重新分配给其他活动 ECMP 成员。一致的负载平衡还可以确保,如果添加 ECMP 成员,流从现有 EMCP 成员到新 ECMP 成员的重新分配是最少的。
配置 256 到 512 个等价路径的准则和限制,可选择使用一致的负载平衡
该功能仅适用于单跃点外部 BGP 对等方。(此功能不适用于 MPLS 路由。)
设备的路由进程 (RPD) 必须支持 64 位模式;不支持 32 位 RPD。
该功能仅适用于单播流量。
流量分布可能并不在所有组成员之间 — 这取决于流量模式以及硬件中散列流集表的组织。当将成员添加到组或从组中删除成员时,一致的散列 可以最大程度地减少 流到目标链路的重新映射。
如果使用其中一个选项
hash-mode
、 、inet
inet6
或layer2
,进行配置set forwarding-options enhanced-hash-key
,则某些流可能会更改目标链路,因为新的散列参数可能会为流生成新的散列索引,从而产生新的目标链路。为了达到最佳的散列精度,此功能使用 级联 拓扑为超过 128 个下一跃点的配置实施下一跃点结构。因此,散列准确性要低于 128 的 ECMP 下一跃点配置,后者不需要级联拓扑。
受影响的 ECMP 路径上的现有流和通过受影响 ECMP 路径的新流可能会在本地路由修复期间切换路径,流量倾斜可能明显。但是,在后续全局路由修复期间,会纠正任何此类倾斜。
增加
maximum-ecmp
值时,在路由前缀的 下一个下一 跃点更改事件期间,一致性散列将丢失。如果向现有 ECMP 组添加新路径,则未受影响的路径上的某些流可能会移动到新添加的路径。
快速重新路由 (FRR) 可能无法使用一致的散列。
无法实现类似于 ECMP 的完美流量分配。与其他路径相比,“桶”更多的路径具有更多的流量流量,而不是具有较少桶的路径( 桶 是负载平衡表分布列表中映射到 ECMP 成员索引的条目)。
在网络拓扑更改事件期间,在某些情况下,网络前缀的一致散列会丢失,因为这些前缀指向新的 ECMP 下一跃点,该跃点并不具有前缀上一个 ECMP 下一跃点的所有属性。
如果多个网络前缀指向同一 ECMP 下一跃点,并且通过
consistent-hash
语句启用了一个或多个这些前缀,则指向同一 ECMP 下一跃点 的所有 网络前缀都会显示一致的散列行为。仅在基于等价 BGP 路由的 ECMP 组上支持一致散列。配置了其他具有优先于 BGP 路由的协议或静态路由时,不支持一致的散列。
当配置与以下功能的配置相结合时,一致的散列可能有限制,因为这些功能的隧道终止或流量工程不使用散列来选择路径 — GRE 隧道;BUM 流量;EVPN-VXLAN;和 MPLS TE、自动带带宽
配置多达 512 个 ECMP 下一跃点和(可选)配置一致的负载平衡的说明
准备好配置多达 512 个下一跃点时,请使用以下配置说明:
配置最大 ECMP 下一跃点数,例如,配置 512 个 ECMP 下一跃点:
[edit] user@host# set chassis maximum-ecmp 512
创建路由策略并启用按数据包负载均衡,从而在系统上启用全局 ECMP:
[edit] user@host# set routing-options forwarding-table export load-balancing-policy user@host# set policy-options policy-statement load-balancing-policy then load-balance per-packet
通过创建单独的路由策略,将传入的路由匹配到一个或多个目标前缀,对选定前缀启用弹性,例如:
[edit] user@host# set policy-options policy-statement c-hash from route-filter 20.0.0.0/24 orlonger user@host# set policy-options policy-statement c-hash then load-balance consistent-hash
将 eBGP 导入策略(例如,“c-hash”)应用于外部对等方 BGP 组:
[edit] user@host# set protocols bgp import c-hash
有关配置等价路径的详细信息,请参阅 示例:负载平衡 BGP 流量,这一点显示在本文档前面。
(可选)有关配置一致负载平衡(也称为一致散列)的详细信息,请参阅 为 ECMP 组配置一致负载平衡
另请参阅
示例:配置单跳 EBGP 对等方以接受远程下一跃点
此示例说明如何配置单跃点外部 BGP (EBGP) 对等方以接受不共享公共子网的远程下一跃点。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
概述
在某些情况下,有必要配置单跳 EBGP 对等方以接受不共享公共子网的远程下一跃点。默认行为适用于从单跳 EBGP 对等方接收的任何下一跃点地址,该对等方无法识别为共享要丢弃的公共子网。让单跳 EBGP 对等方接受它未直接连接的远程下一跃点的能力也防止您将单跳 EBGP 邻接方配置为多跳会话。在这种情况下,配置多跳会话时,通过此 EBGP 对等方获得的所有下一跃点路由都会被标记为间接,即使它们共享一个公共子网也是如此。这种情况会破坏通过包含下一跃点地址的路由递归解析的路由的多路径功能。配置该 accept-remote-nexthop
语句允许单跳 EBGP 对等方接受远程下一跃点,从而恢复通过这些下一跃点地址解析的路由的多路径功能。您可以在 BGP 的全局、组和邻接方层次结构级别上配置此语句。逻辑系统和 VPN 路由和转发 (VRF) 路由实例类型也支持该语句。远程下一跃点和 EBGP 对等方都必须支持 RFC 2918 中的 BGP 路由刷新,即 BGP-4 中的路由刷新。如果远程对等方不支持 BGP 路由刷新,则会话将重置。
启用单跃点 EBGP 对等方以接受远程下一跃点时,还必须在指定远程下一跃点地址的 EBGP 对等方上配置导入路由策略。
此示例包括一个导入路由策略, agg_route
使单跳外部 BGP 对等方(设备 R1)接受到 1.1.230.0/23 网络的路由的远程下一跃点 1.10.10。在 [edit protocols bgp]
层次结构级别,示例包含 import agg_route
将策略应用于外部 BGP 对等方的语句,还包括 accept-remote-nexthop
使单跳 EBGP 对等方能够接受远程下一跃点的语句。
图 2 显示了示例拓扑。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 CLI 中 [edit]
。
设备 R0
set interfaces fe-1/2/0 unit 0 family inet address 10.1.0.1/30 set interfaces fe-1/2/1 unit 0 family inet address 10.1.1.1/30 set interfaces lo0 unit 0 family inet address 10.255.14.179/32 set protocols bgp group ext type external set protocols bgp group ext export test_route set protocols bgp group ext export agg_route set protocols bgp group ext peer-as 65000 set protocols bgp group ext multipath set protocols bgp group ext neighbor 10.1.0.2 set protocols bgp group ext neighbor 10.1.1.2 set policy-options policy-statement agg_route term 1 from protocol static set policy-options policy-statement agg_route term 1 from route-filter 10.1.230.0/23 exact set policy-options policy-statement agg_route term 1 then accept set policy-options policy-statement test_route term 1 from protocol static set policy-options policy-statement test_route term 1 from route-filter 10.1.10.10/32 exact set policy-options policy-statement test_route term 1 then accept set routing-options static route 10.1.10.10/32 reject set routing-options static route 10.1.230.0/23 reject set routing-options autonomous-system 65500
设备 R1
set interfaces fe-1/2/0 unit 0 family inet address 10.1.0.2/30 set interfaces fe-1/2/1 unit 0 family inet address 10.1.1.2/30 set interfaces fe-1/2/2 unit 0 family inet address 10.12.0.1/30 set interfaces lo0 unit 2 family inet address 10.255.71.24/32 set protocols bgp accept-remote-nexthop set protocols bgp group ext type external set protocols bgp group ext import agg_route set protocols bgp group ext peer-as 65500 set protocols bgp group ext multipath set protocols bgp group ext neighbor 10.1.0.1 set protocols bgp group ext neighbor 10.1.1.1 set protocols bgp group int type internal set protocols bgp group int local-address 10.255.71.24 set protocols bgp group int neighbor 10.255.14.177 set protocols ospf area 0.0.0.0 interface fe-1/2/1.4 set protocols ospf area 0.0.0.0 interface 10.255.71.24 set policy-options policy-statement agg_route term 1 from protocol bgp set policy-options policy-statement agg_route term 1 from route-filter 10.1.230.0/23 exact set policy-options policy-statement agg_route term 1 then next-hop 10.1.10.10 set policy-options policy-statement agg_route term 1 then accept set routing-options autonomous-system 65000
设备 R2
set interfaces fe-1/2/0 unit 0 family inet address 10.12.0.2/30 set interfaces lo0 unit 0 family inet address 10.255.14.177/32 set protocols bgp group int type internal set protocols bgp group int local-address 10.255.14.177 set protocols bgp group int neighbor 10.255.71.24 set protocols ospf area 0.0.0.0 interface fe-1/2/0.6 set protocols ospf area 0.0.0.0 interface 10.255.14.177 set routing-options autonomous-system 65000
设备 R0
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 R0:
-
配置接口。
[edit interfaces fe-1/2/0 unit 0] user@R0# set family inet address 10.1.0.1/30 [edit interfaces fe-1/2/1 unit 0] user@R0# set family inet address 10.1.1.1/30 [edit interfaces lo0 unit 0] user@R0# set family inet address 10.255.14.179/32
-
配置 EBGP。
[edit protocols bgp group ext] user@R0# set type external user@R0# set peer-as 65000 user@R0# set neighbor 10.1.0.2 user@R0# set neighbor 10.1.1.2
-
在设备 R0 和设备 R1 之间启用多路径 BGP。
[edit protocols bgp group ext] user@R0# set multipath
-
配置到远程网络的静态路由。 这些路由不是拓扑的一部分。这些路由的目的是演示此示例中的功能。
[edit routing-options] user@R0# set static route 10.1.10.10/32 reject user@R0# set static route 10.1.230.0/23 reject
-
配置接受静态路由的路由策略。
[edit policy-options policy-statement agg_route term 1] user@R0# set from protocol static user@R0# set from route-filter 10.1.230.0/23 exact user@R0# set then accept [edit policy-options policy-statement test_route term 1] user@R0# set from protocol static user@R0# set from route-filter 10.1.10.10/32 exact user@R0# set then accept
-
将路由表中的
agg_route
和test_route
策略导出到 BGP 中。[edit protocols bgp group ext] user@R0# set export test_route user@R0# set export agg_route
-
配置自治系统 (AS) 编号。
[edit routing-options] user@R0# set autonomous-system 65500
结果
在配置模式下,输入 show interfaces
、 show policy-options
、 show protocols
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R0# show interfaces fe-1/2/0 { unit 0 { family inet { address 10.1.0.1/30; } } } fe-1/2/1 { unit 0 { family inet { address 10.1.1.1/30; } } } lo0 { unit 0 { family inet { address 10.255.14.179/32; } } }
user@R0# show policy-options policy-statement agg_route { term 0 { from { protocol static; route-filter 10.1.230.0/23 exact; } then accept; } } policy-statement test_route { term 1 { from { protocol static; route-filter 10.1.10.10/32 exact; } then accept; } }
user@R0# show protocols bgp { group ext { type external; export [ test_route agg_route ]; peer-as 65000; multipath; neighbor 10.1.0.2; neighbor 10.1.1.2; } }
user@R0# show routing-options static { route 10.1.10.10/32 reject; route 10.1.230.0/23 reject; } autonomous-system 65500;
完成设备配置后,请从配置模式进入 commit
。
配置设备 R1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 R1:
-
配置接口。
[edit interfaces fe-1/2/0 unit 0] user@R1# set family inet address 10.1.0.2/30 [edit interfaces fe-1/2/1 unit 0] user@R1# set family inet address 10.1.1.2/30 [edit interfaces fe-1/2/2 unit 0] user@R1# set family inet address 10.12.0.1/30 [edit interfaces lo0 unit 0] user@R1# set family inet address 10.255.71.24/32
-
配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@R1# set interface fe-1/2/1.0 user@R1# set interface 10.255.71.24
-
启用设备 R1 以接受远程下一跃点。
[edit protocols bgp] user@R1# set accept-remote-nexthop
-
配置 IBGP。
[edit protocols bgp group int] user@R1# set type internal user@R1# set local-address 10.255.71.24 user@R1# set neighbor 10.255.14.177
-
配置 EBGP。
[edit protocols bgp group ext] user@R1# set type external user@R1# set peer-as 65500 user@R1# set neighbor 10.1.0.1 user@R1# set neighbor 10.1.1.1
-
在设备 R0 和设备 R1 之间启用多路径 BGP。
[edit protocols bgp group ext] user@R1# set multipath
-
配置一个路由策略,使单跳外部 BGP 对等方(设备 R1)能够接受到 1.1.230.0/23 网络的路由的远程下一跃点 1.10.10。
[edit policy-options policy-statement agg_route term 1] user@R1# set from protocol bgp user@R1# set from route-filter 10.1.230.0/23 exact user@R1# set then next-hop 10.1.10.10 user@R1# set then accept
-
将
agg_route
策略导入设备 R1 上的路由表中。[edit protocols bgp group ext] user@R1# set import agg_route
-
配置自治系统 (AS) 编号。
[edit routing-options] user@R1# set autonomous-system 65000
结果
在配置模式下,输入 show interfaces
、 show policy-options
、 show protocols
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R1# show interfaces fe-1/2/0 { unit 0 { family inet { address 10.1.0.2/30; } } } fe-1/2/1 { unit 0 { family inet { address 10.1.1.2/30; } } } fe-1/2/2 { unit 0 { family inet { address 10.12.0.1/30; } } } lo0 { unit 0 { family inet { address 10.255.71.24/32; } } }
user@R1# show policy-options policy-statement agg_route { term 1 { from { protocol bgp; route-filter 10.1.230.0/23 exact; } then { next-hop 10.1.10.10; accept; } } }
user@R1# show protocols bgp { accept-remote-nexthop; group ext { type external; import agg_route; peer-as 65500; multipath; neighbor 10.1.0.1; neighbor 10.1.1.1; } group int { type internal; local-address 10.255.71.24; neighbor 10.255.14.177; } } ospf { area 0.0.0.0 { interface fe-1/2/1.0; interface 10.255.71.24; } }
user@R1# show routing-options autonomous-system 65000;
完成设备配置后,请从配置模式进入 commit
。
配置设备 R2
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 R2:
-
配置接口。
[edit interfaces fe-1/2/0 unit 0] user@R2# set family inet address 10.12.0.2/30 [edit interfaces lo0 unit 0] user@R2# set family inet address 10.255.14.177/32
-
配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@R2# set interface fe-1/2/0.0 user@R2# set interface 10.255.14.177
-
配置 IBGP。
[edit protocols bgp group int] user@R2# set type internal user@R2# set local-address 10.255.14.177 user@R2# set neighbor 10.255.71.24
-
配置自治系统 (AS) 编号。
[edit routing-options] user@R1# set autonomous-system 65000
结果
在配置模式下,输入 、 show protocols
和show routing-options
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R2# show interfaces fe-1/2/0 { unit 0 { family inet { address 10.12.0.2/30; } } } lo0 { unit 0 { family inet { address 10.255.14.177/32; } } }
user@R2# show protocols bgp { group int { type internal; local-address 10.255.14.177; neighbor 10.255.71.24; } } ospf { area 0.0.0.0 { interface fe-1/2/0.0; interface 10.255.14.177; } }
user@R2# show routing-options autonomous-system 65000;
完成设备配置后,请从配置模式进入 commit
。
验证
确认配置工作正常。
验证带有间接下一跃点的多路径路由是否在路由表中
目的
验证设备 R1 是否具有到 10.1.230.0/23 网络的路由。
行动
在操作模式下,输入 show route 1.1.230.0 extensive
命令。
user@R1> show route 10.1.230.0 extensive inet.0: 11 destinations, 13 routes (11 active, 0 holddown, 0 hidden) Restart Complete 10.1.230.0/23 (2 entries, 1 announced) TSI: KRT in-kernel 1.1.230.0/23 -> {indirect(262142)} Page 0 idx 1 Type 1 val 9168f6c Nexthop: 10.1.10.10 Localpref: 100 AS path: [65000] 65500 I Communities: Path 10.1.230.0 from 10.1.0.1 Vector len 4. Val: 1 *BGP Preference: 170/-101 Next hop type: Indirect Address: 0x90c44d8 Next-hop reference count: 4 Source: 10.1.0.1 Next hop type: Router, Next hop index: 262143 Next hop: 10.1.0.1 via fe-1/2/0.0, selected Next hop: 10.1.1.1 via fe-1/2/2.0 Protocol next hop: 10.1.10.10 Indirect next hop: 91c0000 262142 State: <Active Ext> Local AS: 65000 Peer AS: 65500 Age: 2:55:31 Metric2: 0 Task: BGP_65500.10.1.0.1+64631 Announcement bits (3): 2-KRT 3-BGP_RT_Background 4-Resolve tree 1 AS path: 65500 I Accepted Multipath Localpref: 100 Router ID: 10.255.14.179 Indirect next hops: 1 Protocol next hop: 10.1.10.10 Indirect next hop: 91c0000 262142 Indirect path forwarding next hops: 2 Next hop type: Router Next hop: 10.1.0.1 via fe-1/2/0.0 Next hop: 10.1.1.1 via fe-1/2/2.0 10.1.10.10/32 Originating RIB: inet.0 Node path count: 1 Forwarding nexthops: 2 Nexthop: 10.1.0.1 via fe-1/2/0.0 Nexthop: 10.1.1.1 via fe-1/2/2.0 BGP Preference: 170/-101 Next hop type: Indirect Address: 0x90c44d8 Next-hop reference count: 4 Source: 10.1.1.1 Next hop type: Router, Next hop index: 262143 Next hop: 10.1.0.1 via fe-1/2/0.0, selected Next hop: 10.1.1.1 via fe-1/2/2.0 Protocol next hop: 10.1.10.10 Indirect next hop: 91c0000 262142 State: <NotBest Ext> Inactive reason: Not Best in its group - Update source Local AS: 65000 Peer AS: 65500 Age: 2:55:27 Metric2: 0 Task: BGP_65500.10.1.1.1+53260 AS path: 65500 I Accepted Localpref: 100 Router ID: 10.255.14.179 Indirect next hops: 1 Protocol next hop: 10.1.10.10 Indirect next hop: 91c0000 262142 Indirect path forwarding next hops: 2 Next hop type: Router Next hop: 10.1.0.1 via fe-1/2/0.0 Next hop: 10.1.1.1 via fe-1/2/2.0 10.1.10.10/32 Originating RIB: inet.0 Node path count: 1 Forwarding nexthops: 2 Nexthop: 10.1.0.1 via fe-1/2/0.0 Nexthop: 10.1.1.1 via fe-1/2/2.0
含义
输出显示设备 R1 有一条到 10.1.230.0 网络的路由,并启用了多路径功能 (Accepted Multipath
)。输出还显示,路由的间接下一跃点为 10.1.10.10。
停用和重新激活 accept-remote-nexthop 语句
目的
停用语句时 accept-remote-nexthop
,请确保从路由表中移除具有间接下一跃点的多路径路由。
行动
-
在配置模式下,输入
deactivate protocols bgp accept-remote-nexthop
命令。user@R1# deactivate protocols bgp accept-remote-nexthop user@R1# commit
-
在操作模式下,输入
show route 10.1.230.0
命令。user@R1> show route 10.1.230.0
-
在配置模式下,输入
activate protocols bgp accept-remote-nexthop
命令以重新激活语句。user@R1# activate protocols bgp accept-remote-nexthop user@R1# commit
-
在操作模式下,重新进入
show route 10.1.230.0
命令。user@R1> show route 10.1.230.0 inet.0: 11 destinations, 13 routes (11 active, 0 holddown, 0 hidden) Restart Complete + = Active Route, - = Last Active, * = Both 10.1.230.0/23 *[BGP/170] 03:13:19, localpref 100 AS path: 65500 I > to 10.1.0.1 via fe-1/2/0.0 to 10.1.1.1 via fe-1/2/2.0 [BGP/170] 03:13:15, localpref 100, from 10.1.1.1 AS path: 65500 I > to 10.1.0.1 via fe-1/2/0.0 to 10.1.1.1 via fe-1/2/2.0
含义
当语句 accept-remote-nexthop
停用时,多路径路由到 10。1.230.0 网络将从路由表中移除。
了解分配给路径的带宽不相等的 BGP 流量的负载平衡
多路径选项会将主动路由决策过程中的分断因素排除在外,从而允许将从多个源中学习的等价 BGP 路由安装到转发表表中。但是,当可用路径的成本不相等时,您可能希望以不对称的方式均衡流量负载。
在转发表中安装多个下一跃点后,Junos OS per 前缀负载平衡算法会选择特定的转发下一跃点。此过程对数据包的源地址和目标地址进行散列,以确定性地将前缀配对映射到某个可用的下一跃点。当散列函数包含大量前缀时(例如可能发生在互联网对等交换上),每个前缀映射效果最佳,而且可以防止在通信节点对之间重新订购数据包。
企业网络通常希望更改默认行为,以引发 按数据包 的负载平衡算法。此处强调的是按数据包,因为它的使用是一种错误,这源于原始互联网处理器 ASIC 的历史行为。实际上,当前的瞻博网络路由器支持按前缀(默认)和每流负载平衡。后者涉及对各种第 3 层和第 4 层标头进行散列,包括源地址、目标地址、传输协议、传入接口和应用程序端口的部分。其效果是,现在单个流被散列到特定的下一跃点,从而在可用的下一跃点之间更均匀地分布,特别是在源对和目标对之间路由较少的情况下。
通过按数据包负载均衡,包含两个端点之间的通信流的数据包可能会重新排序,但单个流中的数据包可以保持正确的顺序。无论您选择按前缀还是按数据包进行负载平衡,访问链路不对称都可能带来技术挑战。无论哪种方式,与映射到快速以太网接入链路的流相比,映射到的前缀或流(例如,T1 链路)的性能都会下降。更糟糕的是,在流量负载较重的情况下,任何均衡负载平衡的尝试都可能导致由于丢包而导致 T1 链路和会话中断的全面饱和。
幸运的是,瞻博网络 BGP 的实施支持了带宽社区的概念。这种扩展社区对给定下一跃点的带宽进行编码,当与多路径结合使用时,负载平衡算法将流量分布到下一跃点的一组与其相对带宽成比例的下一跃点。换句话说,如果有一个 10 Mbps 的下一跃点和 1 Mbps 的下一跃点,平均有 9 个流将映射到每个使用低速的高速下一跃点。
只有在按数据包进行负载平衡时,才支持使用 BGP 带宽社区。
配置任务由两部分组成:
配置外部 BGP (EBGP) 对等会话,启用多路径,并定义导入策略,以使用反映链路速度的带宽社区来标记路由。
启用按数据包(实际上按流)负载平衡,以优化流量分配。
另请参阅
示例:在分配给路径的带宽不相等的 BGP 流量中实现负载平衡
此示例说明如何配置 BGP 以选择多个不相等成本路径作为活动路径。
BGP 社区可以帮助您控制路由策略。对 BGP 社区有好处的一个示例就是负载平衡不均衡。当自治系统边界路由器 (ASBR) 从直连外部 BGP (EBGP) 邻接方接收路由时,ASBR 将使用 IBGP 播发将这些路由播发至内部邻接方。在 IBGP 对抗中,您可以连接链路带宽社区,以传达播发外部链路的带宽。如果存在多个外部链路,并且您希望在链路上实现不相等的负载平衡,此功能会很有用。您可以在 AS 的所有入口链路上配置链路带宽扩展社区。链路带宽扩展社区中的带宽信息基于 EBGP 链路配置的带宽。它不是基于链路上的流量。Junos OS 支持 BGP 链路带宽和多路径负载平衡,详述于互联网草案 draft-ietf-idr-link-bandwidth-06, BGP 链路带宽扩展社区。请注意,即使 draft-ietf-idr-link-bandwidth-06 指定了非传递社区,Junos OS 的实施也仅限于传递社区。
要求
开始之前:
配置设备接口。
配置内部网关协议 (IGP)。
配置 BGP。
配置将路由(如直接路由或 IGP 路由)从路由表导出到 BGP 的路由策略。
概述
在此示例中,设备 R1 位于 AS 64500 中,并连接到位于 AS 64501 中的设备 R2 和设备 R3。
示例使用带宽扩展社区。
默认情况下,使用 BGP 多路径时,流量在计算的多个路径之间平均分布。带宽扩展社区允许向 BGP 路径中添加一个附加属性,从而允许流量分布不均。主要应用是给定网络具有非对称带宽功能的多个外部路径的情况。在这种情况下,您可以标记通过带宽扩展社区收到的路由。当 BGP 多路径(内部或外部)在包含带宽属性的路由之间操作时,转发引擎可以根据与每个路径对应的带宽不平等分配流量。
当 BGP 有多个可用于多路径的候选路径时,BGP 不会根据带宽社区执行不相等的成本负载平衡,除非所有候选路径都有此属性。
带宽扩展社区的适用性受 BGP 多路径接受多个路径供考虑的限制所限制。显然,就 BGP 而言,执行负载平衡的路由器与多个出口点之间的 IGP 距离需要相同。这可以通过使用不跟踪相应 IGP 指标的全网状标签交换路径 (LSP) 来实现。但是,在电路的传播延迟非常显著的网络中(例如,如果存在远距离电路),考虑不同路径的延迟特性通常非常重要。
按如下配置带宽社区:
[edit policy-options] user@host# set community members bandwidth:[1-65535]:[0-4294967295]
第一个 16 位数字表示本地自治系统。第二个 32 位编号表示链路带宽,以字节/秒为单位。
例如:
[edit policy-options] user@host# show community bw-t1 members bandwidth:10458:193000; community bw-t3 members bandwidth:10458:5592000; community bw-oc3 members bandwidth:10458:19440000;
其中 10458 是本地 AS 编号。这些值对应于 T1、T3 和 OC-3 路径的带宽,单位为字节/秒。指定为带宽值的值不需要与特定接口的实际带宽相对应。所用平衡因素按指定总带宽的函数计算。要使用此扩展社区标记路由,请定义一个策略语句,如下所示:
[edit policy-options] user@host# show policy-statement link-bw-t1 { then { community set bw-t1; } accept; }
将其作为导入策略应用于面向非对称带宽链路的 BGP 对等会话。虽然从理论上讲,可以在网络中的任何一点添加或移除社区属性,但根据上述情形,在面向外部链路的 EBGP 对等会话中应用社区作为导入策略,可以使该属性影响本地多路径决策,并且可能更易于管理。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 CLI 中 [edit]
。
设备 R1
set interfaces ge-1/2/0 unit 0 description R1->R3 set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces ge-1/2/1 unit 0 description R1->R2 set interfaces ge-1/2/1 unit 0 family inet address 10.0.1.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set protocols bgp group external type external set protocols bgp group external import bw-dis set protocols bgp group external peer-as 64501 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.1 set protocols bgp group external neighbor 10.0.0.2 set policy-options policy-statement bw-dis term a from protocol bgp set policy-options policy-statement bw-dis term a from neighbor 10.0.1.1 set policy-options policy-statement bw-dis term a then community add bw-high set policy-options policy-statement bw-dis term a then accept set policy-options policy-statement bw-dis term b from protocol bgp set policy-options policy-statement bw-dis term b from neighbor 10.0.0.2 set policy-options policy-statement bw-dis term b then community add bw-low set policy-options policy-statement bw-dis term b then accept set policy-options policy-statement loadbal from route-filter 10.0.0.0/16 orlonger set policy-options policy-statement loadbal then load-balance per-packet set policy-options community bw-high members bandwidth:65000:60000000 set policy-options community bw-low members bandwidth:65000:40000000 set routing-options autonomous-system 64500 set routing-options forwarding-table export loadbal
设备 R2
set interfaces ge-1/2/0 unit 0 description R2->R1 set interfaces ge-1/2/0 unit 0 family inet address 10.0.1.1/30 set interfaces ge-1/2/1 unit 0 description R2->R3 set interfaces ge-1/2/1 unit 0 family inet address 10.0.2.2/30 set interfaces ge-1/2/1 unit 0 family iso set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set interfaces lo0 unit 0 family iso address 49.0001.1921.6800.0002.00 set protocols bgp group external type external set protocols bgp group external export bgp-default set protocols bgp group external export send-direct set protocols bgp group external peer-as 64500 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.2 set protocols isis interface ge-1/2/1.0 set protocols isis interface lo0.0 set policy-options policy-statement bgp-default from protocol static set policy-options policy-statement bgp-default from route-filter 172.16.0.0/16 exact set policy-options policy-statement bgp-default then accept set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set routing-options static route 172.16.0.0/16 discard set routing-options static route 172.16.0.0/16 no-install set routing-options autonomous-system 64501
设备 R3
set interfaces ge-1/2/0 unit 0 description R3->R2 set interfaces ge-1/2/0 unit 0 family inet address 10.0.2.1/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/1 unit 0 description R3->R1 set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set interfaces lo0 unit 0 family iso address 49.0001.1921.6800.0003.00 set protocols bgp group external type external set protocols bgp group external export send-direct set protocols bgp group external export bgp-default set protocols bgp group external peer-as 64500 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.0.1 set protocols isis interface ge-1/2/0.0 set protocols isis interface lo0.0 set policy-options policy-statement bgp-default from protocol static set policy-options policy-statement bgp-default from route-filter 172.16.0.0/16 exact set policy-options policy-statement bgp-default then accept set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set routing-options static route 172.16.0.0/16 discard set routing-options static route 172.16.0.0/16 no-install set routing-options autonomous-system 64501
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话:
配置接口。
user@R1# set ge-1/2/0 unit 0 description R1->R3 user@R1# set ge-1/2/0 unit 0 family inet address 10.0.0.1/30 user@R1# set ge-1/2/1 unit 0 description R1->R2 user@R1# set ge-1/2/1 unit 0 family inet address 10.0.1.2/30 user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
配置 BGP 组。
[edit protocols bgp group external] user@R1# set type external user@R1# set import bw-dis user@R1# set peer-as 64501 user@R1# set neighbor 10.0.1.1 user@R1# set neighbor 10.0.0.2
允许 BGP 组使用多个路径。
注:要禁用默认检查,要求 BGP 多路径接受的路径必须具有相同的相邻自治系统 (AS),请包括以下
multiple-as
选项。multiple-as
如果邻接方位于不同的 AS 中,请使用选项。[edit protocols bgp group external] user@R1# set multipath
配置负载平衡策略。
[edit policy-options policy-statement loadbal] user@R1# set from route-filter 10.0.0.0/16 orlonger user@R1# set then load-balance per-packet
应用负载平衡策略。
[edit routing-options] user@R1# set forwarding-table export loadbal
配置 BGP 社区成员。
此示例假设带宽为 1 Gbps,并将 60% 分配给 bw-high,40% 分配给 bw-low。参考带宽不一定与链路带宽相同。
[edit policy-options] user@R1# set community bw-high members bandwidth:65000:60000000 user@R1# set community bw-low members bandwidth:65000:40000000
配置带宽分配策略。
[edit policy-options bw-dis] user@R1# set term a from protocol bgp user@R1# set term a from neighbor 10.0.1.1 user@R1# set term a then community add bw-high user@R1# set term a then accept user@R1# set term b from protocol bgp user@R1# set term b from neighbor 10.0.0.2 user@R1# set term b then community add bw-low user@R1# set term b then accept
配置本地自治系统 (AS) 编号。
[edit routing-options] user@R1# set autonomous-system 64500
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R1# show interfaces
ge-1/2/0 {
unit 0 {
description R1->R3;
family inet {
address 10.0.0.1/30;
}
}
}
ge-1/2/1 {
unit 0 {
description R1->R2;
family inet {
address 10.0.1.2/30;
}
}
}
lo0 {
unit 0 {
family inet {
address 192.168.0.1/32;
}
}
}
user@R1# show protocols
bgp {
group external {
type external;
import bw-dis;
peer-as 64501;
multipath;
neighbor 10.0.1.1;
neighbor 10.0.0.2;
}
}
user@R1# show policy-options
policy-statement bw-dis {
term a {
from {
protocol bgp;
neighbor 10.0.1.1;
}
then {
community add bw-high;
accept;
}
}
term b {
from {
protocol bgp;
neighbor 10.0.0.2;
}
then {
community add bw-low;
accept;
}
}
}
policy-statement loadbal {
from {
route-filter 10.0.0.0/16 orlonger;
}
then {
load-balance per-packet;
}
}
community bw-high members bandwidth:65000:60000000;
community bw-low members bandwidth:65000:40000000;
user@R1# show routing-options
autonomous-system 64500;
forwarding-table {
export loadbal;
}
完成设备配置后,请从配置模式进入 commit
。
验证
确认配置工作正常:
验证路由
目的
验证是否已选择这两个路由,以及路由上的下一跃点是否显示 60%/40% 的平衡。
行动
在操作模式下,运行 show route protocol bgp detail
命令。
user@R1> show route 172.16/16 protocol bgp detail inet.0: 9 destinations, 13 routes (9 active, 0 holddown, 0 hidden) 172.16.0.0/16 (2 entries, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 262143 Address: 0x93fc078 Next-hop reference count: 3 Source: 10.0.0.2 Next hop: 10.0.0.2 via ge-1/2/0.0 balance 40% Next hop: 10.0.1.1 via ge-1/2/1.0 balance 60%, selected State: **Active Ext> Local AS: 64500 Peer AS: 64501 Age: 3:22:55 Task: BGP_64501.10.0.0.2+55344 Announcement bits (1): 0-KRT AS path: 64501 I Communities: bandwidth:65000:40000000 Accepted Multipath Localpref: 100 Router ID: 192.168.0.3 BGP Preference: 170/-101 Next hop type: Router, Next hop index: 658 Address: 0x9260520 Next-hop reference count: 4 Source: 10.0.1.1 Next hop: 10.0.1.1 via ge-1/2/1.0, selected State: <NotBest Ext> Inactive reason: Not Best in its group - Active preferred Local AS: 64500 Peer AS: 64501 Age: 3:22:55 Task: BGP_65001.10.0.1.1+62586 AS path: 64501 I Communities: bandwidth:65000:60000000 Accepted MultipathContrib Localpref: 100 Router ID: 192.168.0.2
user@R1> show route 10.0.2.0 protocol bgp detail inet.0: 9 destinations, 13 routes (9 active, 0 holddown, 0 hidden) 10.0.2.0/30 (2 entries, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 262143 Address: 0x93fc078 Next-hop reference count: 3 Source: 10.0.1.1 Next hop: 10.0.0.2 via ge-1/2/0.0 balance 40% Next hop: 10.0.1.1 via ge-1/2/1.0 balance 60%, selected State: <Active Ext> Local AS: 64500 Peer AS: 64501 Age: 3:36:37 Task: BGP_65001.10.0.1.1+62586 Announcement bits (1): 0-KRT AS path: 64501 I Communities: bandwidth:65000:60000000 Accepted Multipath Localpref: 100 Router ID: 192.168.0.2 BGP Preference: 170/-101 Next hop type: Router, Next hop index: 657 Address: 0x92604d8 Next-hop reference count: 4 Source: 10.0.0.2 Next hop: 10.0.0.2 via ge-1/2/0.0, selected State: <NotBest Ext> Inactive reason: Not Best in its group - Active preferred Local AS: 64500 Peer AS: 65001 Age: 3:36:36 Task: BGP_65001.10.0.0.2+55344 AS path: 64501 I Communities: bandwidth:65000:40000000 Accepted MultipathContrib Localpref: 100 Router ID: 192.168.0.3
含义
活动路径(以星号 (*)表示)有两个下一跃点:10.0.1.1 和 10.0.0.2 到 172.16/16 目标。
同样,用星号 (*)表示的活动路径有两个下一跃点:10.0.1.1 和 10.0.0.2 到 10.0.2.0 目标。
在这两种情况下,10.0.1.1 下一跃点都从非活动路径复制到活动路径。
输出中显示了 40% 和 60% 的 show route
平衡。这表示流量分布在两个下一跃点之间,60% 的流量遵循第一个路径,而 40% 的流量遵循第二个路径。
跨外部 BGP 链路广告聚合带宽,用于负载平衡概述
从内部对等方接收多个路径的 BGP 对等方会对这些路径之间的流量进行负载平衡。在早期 Junos OS 版本中,从其内部对等方接收多个路径的 BGP 发送方仅播发与活动路由关联的链路带宽。BGP 使用链路带宽扩展社区,跨外部链路播发多个路由的聚合带宽。BGP 计算具有不相等带宽分配的多路径的聚合带宽,并将聚合带宽播发给外部 BGP 对等方。您可以配置聚合带宽阈值来限制 BGP 组的带宽使用。IPv4 和 IPv6 路由(包括任播地址)都支持聚合带宽。
要播发多路径路由的聚合带宽并设置最大阈值,请在 [edit policy-options aggregate-bandwidth
policy-statement name then] 层次结构级别配置策略并limit-bandwidth
采取措施。

在 图 4中,自治系统 1 (AS1) 将其 3 个多路径路由的带宽聚合到一个远程前缀,并使用链路带宽扩展社区以 30 的带宽将其播发至自治系统 4 (AS4)。如果 AS3 和 AS4 之间的链路故障,AS4 会从它播发至 AS6 的带宽中减去 60,并将播发的带宽从 130 修改为 70。
当 BGP 对等方传播使用聚合带宽社区配置的多路径路由时,将用传入带宽社区或该前缀的带宽总和添加新链路带宽社区。可用链路带宽从接口速度动态派生。链路带宽作为传递式扩展社区发送。但是,如果设备接收的链路带宽是作为非传递链路带宽扩展社区,Junos OS 会忽略此社区,而是将其传播到传递链路带宽扩展社区。如果每个传入多路径路由均未收到链路带宽社区,则不会将链路带宽社区播发给其外部对等方。
当其中一个多路径链路发生故障时,BGP 会从传出链路带宽社区中减去失败链路的带宽来读取路由。如果发现聚合链路带宽超过配置的限制,则播发的聚合带宽将被截短至两个对等方之间配置的链路带宽限制。
另请参阅
示例:配置策略以跨外部 BGP 链路播发聚合带宽,以实现负载平衡
此示例说明如何配置一个策略,以跨外部 BGP 链路播发聚合带宽,以实现负载平衡,并为配置的聚合带宽指定阈值。BGP 会添加多路径的可用链路带宽并计算聚合带宽。如果链路故障,将调整聚合带宽以反映可用带宽的当前状态。
要求
此示例使用以下硬件和软件组件:
具有负载平衡功能的四个路由器
在所有设备上运行的 Junos OS 17.4 或更高版本
概述
从 Junos OS 17.4R1 版开始,从内部对等方接收多个路径的 BGP 发送方会在这些路径之间均衡流量。在早期 Junos OS 版本中,从其内部对等方接收多个路径的 BGP 发送方仅播发与活动路由关联的链路带宽。BGP 使用包含聚合带宽的新链路带宽扩展社区来标记多路径,并通过其 DMZ 链路通告这些多个路由的聚合带宽。要播发聚合的多个路由,请在 [edit policy-options policy-statement aggregate-bandwidth
name then] 层次结构级别配置策略并limit bandwidth
执行操作。
拓扑

在 图 5中,路由器 R1 通过路由器 R2 中的下一跃点 10.0.1.1(每秒 60,000,000 字节)和路由器 R3 中的 10.0.0.2(以每秒 40,000,000 字节)将流量负载平衡到远程目标。路由器 R1 将目标 10.0.2.0 播发至路由器 R4。路由器 R1 计算可用带宽的聚合,即每秒 1000000 字节。但是,在路由器 R1 上配置的策略会将聚合带宽的阈值设置为每秒 80,000,000 字节。因此,R1 每秒播发 80,000,000 个字节,而不是每秒播发 10,000,000 个字节。
如果其中一个多路径链路出现故障,则故障链路的带宽不会添加到播发给 BGP 邻接方的聚合带宽中。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit] CLI 中,然后从配置模式进入 commit
。
路由器 R1
set interfaces ge-0/0/0 unit 0 description R1->R3 set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.1/30 set interfaces ge-0/0/1 unit 0 description R1->R2 set interfaces ge-0/0/1 unit 0 family inet address 10.0.1.2/30 set interfaces ge-0/0/2 unit 0 description R1->R4 set interfaces ge-0/0/2 unit 0 family inet address 10.0.4.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set routing-options autonomous-system 65000 set protocols bgp group external type external set protocols bgp group external import bw-dis set protocols bgp group external peer-as 65001 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.1 set protocols bgp group external neighbor 10.0.0.2 set protocols bgp group external2 type external set protocols bgp group external2 peer-as 65002 set policy-options policy-statement bw-dis term a from protocol bgp set policy-options policy-statement bw-dis term a from neighbor 10.0.1.1 set policy-options policy-statement bw-dis term a then community add bw-high set policy-options policy-statement bw-dis term a then accept set policy-options policy-statement bw-dis term b from protocol bgp set policy-options policy-statement bw-dis term b from neighbor 10.0.0.2 set policy-options policy-statement bw-dis term b then community add bw-low set policy-options policy-statement bw-dis term b then accept set policy-options policy-statement aggregate_bw_and_limit_capacity then aggregate-bandwidth set policy-options policy-statement aggregate_bw_and_limit_capacity then limit-bandwidth 80000000 set policy-options policy-statement aggregate_bw_and_limit_capacity then accept set protocols bgp group external2 neighbor 10.0.4.2 export aggregate_bw_and_limit_capacity set policy-options policy-statement loadbal from route-filter 10.0.0.0/16 orlonger set policy-options policy-statement loadbal then load-balance per-packet set routing-options forwarding-table export loadbal set policy-options community bw-high members bandwidth:65000:60000000 set policy-options community bw-low members bandwidth:65000:40000000
路由器 R2
set interfaces ge-0/0/0 unit 0 description R2->R3 set interfaces ge-0/0/0 unit 0 family inet address 10.0.2.2/30 set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/1 unit 0 description R2->R1 set interfaces ge-0/0/1 unit 0 family inet address 10.0.1.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set interfaces lo0 unit 0 family iso address 49.0001.1921.6800.0002.00 set routing-options static route 172.16.0.0/16 discard set routing-options static route 172.16.0.0/16 no-install set routing-options autonomous-system 65001 set protocols bgp group external type external set protocols bgp group external export bgp-default set protocols bgp group external export send-direct set protocols bgp group external peer-as 65000 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.2 set protocols isis interface ge-0/0/0.0 set protocols isis interface lo0.0 set policy-options policy-statement bgp-default from protocol static set policy-options policy-statement bgp-default from route-filter 172.16.0.0/16 exact set policy-options policy-statement bgp-default then accept set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept
路由器 R3
set interfaces ge-0/0/0 description R3->R2 set interfaces ge-0/0/0 unit 0 family inet address 10.0.2.1/30 set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/1 unit 0 description R3->R1 set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set interfaces lo0 unit 0 family iso address 49.0001.1921.6800.0003.00 set routing-options static route 172.16.0.0/16 discard set routing-options static route 172.16.0.0/16 no-install set routing-options autonomous-system 65001 set protocols bgp group external type external set protocols bgp group external export bgp-default set protocols bgp group external export send-direct set protocols bgp group external peer-as 65000 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.0.1 set protocols isis interface ge-0/0/0.0 set protocols isis interface lo0.0 set policy-options policy-statement bgp-default from protocol static set policy-options policy-statement bgp-default from route-filter 172.16.0.0/16 exact set policy-options policy-statement bgp-default then accept set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept
路由器 R4
set interfaces ge-0/0/0 unit 0 description R4->R1 set interfaces ge-0/0/0 unit 0 family inet address 10.0.4.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.4/32 set routing-options autonomous-system 65002 set protocols bgp group external type external set protocols bgp group external peer-as 65000 set protocols bgp group external neighbor 10.0.4.1
配置路由器,从 R1 开始
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用CLI 编辑器。
要配置将聚合带宽播发至 BGP 对等方的策略(从路由器 R1 开始):
修改相应的接口名称、地址和其他参数后,在路由器 R2、R3 和 R4 上重复此过程。
使用 IPv4 地址配置接口。
[edit interfaces] user@R1# set ge-0/0/0 unit 0 description R1->R3 user@R1# set ge-0/0/0 unit 0 family inet address 10.0.0.1/30 user@R1# set ge-0/0/1 unit 0 description R1->R2 user@R1# set ge-0/0/1 unit 0 family inet address 10.0.1.2/30 user@R1# set ge-0/0/2 unit 0 description R1->R4 user@R1# set ge-0/0/2 unit 0 family inet address 10.0.4.1/30
配置环路地址。
[edit interfaces] user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
为 BGP 主机配置自治系统。
[edit routing-options] user@R1# set autonomous-system 65000
在外部边缘路由器上配置 EBGP。
[edit protocols] user@R1# set bgp group external type external user@R1# set bgp group external import bw-dis user@R1# set bgp group external peer-as 65001 user@R1# set bgp group external multipath user@R1# set bgp group external neighbor 10.0.1.1 user@R1# set bgp group external neighbor 10.0.0.2 user@R1# set bgp group external2 type external user@R1# set bgp group external2 peer-as 65002
定义带宽分配策略,将高带宽社区分配给发往路由器 R3 的流量。
[edit policy-options] user@R1# set policy-statement bw-dis term a from protocol bgp user@R1# set policy-statement bw-dis term a from neighbor 10.0.1.1 user@R1# set policy-statement bw-dis term a then community add bw-high user@R1# set policy-statement bw-dis term a then accept
定义带宽分配策略,将低带宽社区分配给发往路由器 R2 的流量。
[edit policy-options] user@R1# set policy-statement bw-dis term b from protocol bgp user@R1# set policy-statement bw-dis term b from neighbor 10.0.0.2 user@R1# set policy-statement bw-dis term b then community add bw-low user@R1# set policy-statement bw-dis term b then accept
启用该功能,以通过 BGP 会话向 EBGP 对等路由器 R4 播发 80,000,000 字节的聚合带宽。
[edit policy-options] user@R1# set policy-statement aggregate_bw_and_limit_capacity then aggregate-bandwidth user@R1# set policy-statement aggregate_bw_and_limit_capacity then limit-bandwidth 80000000 user@R1# set policy-statement aggregate_bw_and_limit_capacity then accept
将aggregate_bw_and limit_capacity策略应用于 EBGP 组
external2
。[edit protocols] user@R1# set bgp group external2 neighbor 10.0.4.2 export aggregate_bw_and_limit_capacity
定义负载平衡策略。
[edit policy-options] user@R1# set policy-statement loadbal from route-filter 10.0.0.0/16 orlonger user@R1# set policy-statement loadbal then load-balance per-packet
应用负载平衡策略。
[edit routing-options] user@R1# set forwarding-table export loadbal
配置 BGP 社区成员。第一个 16 位数字表示本地自治系统。第二个 32 位编号表示链路带宽,以字节/秒为单位。配置一个
bw-high
具有 1-Gbps 链路 60% 的社区,以及另一个bw-low
使用 1-Gbps 链路 40% 的社区。配置 60% 的 1-Gbps 链路到 bw-high 社区,40% 配置 bw-low 社区。
[edit policy-options] user@R1# set community bw-high members bandwidth:65000:60000000 user@R1# set community bw-low members bandwidth:65000:40000000
结果
在配置模式下,输入 show interfaces、 show protocols、 show routing-options和 show policy-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit] user@R1# show interfaces interfaces { ge-0/0/0 { unit 0 { description R1->R3; family inet { address 10.0.0.1/30; } } } ge-0/0/1 { unit 0 { description R1->R2; family inet { address 10.0.1.2/30; } } } ge-0/0/2 { unit 0 { description R1->R4; family inet { address 10.0.4.1/30; } } } lo0 { unit 0 { family inet { address 192.168.0.1/32; } } } }
[edit] user@R1# show protocols protocols { bgp { group external { type external; import bw-dis; peer-as 65001; multipath; neighbor 10.0.1.1; neighbor 10.0.0.2; } group external2 { type external; peer-as 65002; neighbor 10.0.4.2 { export aggregate_bw_and_limit_capacity; } } } }
[edit] user@R1# show routing-options routing-options { autonomous-system 65000; forwarding-table { export loadbal; } }
[edit] user@R1# show policy-options policy-options { policy-statement bw-dis { term a { from { protocol bgp; neighbor 10.0.1.1; } then { community add bw-high; accept; } } term b { from { protocol bgp; neighbor 10.0.0.2; } then { community add bw-low; accept; } } } policy-statement aggregate_bw_and_limit_capacity { then { aggregate-bandwidth; limit-bandwidth 80000000; accept; } } policy-statement loadbal { from { route-filter 10.0.0.0/16 orlonger; } then { load-balance per-packet; } } community bw-high members bandwidth:65000:60000000; community bw-low members bandwidth:65000:40000000; }
验证
验证 BGP 会话是否已建立
目的
要验证 BGP 对等互连是否已完成并在路由器之间建立 BGP 会话,
行动
user@R1> show bgp summary Groups: 2 Peers: 3 Down peers: 0 Table Tot Paths Act Paths Suppressed History Damp State Pending inet.0 12 8 0 0 0 0 Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped... 10.0.0.2 65001 153 149 0 0 1:07:23 4/6/6/0 0/0/0/0 10.0.1.1 65001 229 226 0 0 1:41:44 4/6/6/0 0/0/0/0 10.0.4.2 65002 1227 1227 0 0 9:10:27 0/0/0/0 0/0/0/0
含义
路由器 R1 已完成与路由器 R2、R3 和 R4 的对等互连。
验证每个路径中是否存在聚合带宽
目的
验证每个路由路径是否都存在扩展社区。
行动
在操作模式下,运行 show route protocol bgp detail
命令。
user@R1> show route 10.0.2.0 protocol bgp detail inet.0: 20 destinations, 26 routes (20 active, 0 holddown, 0 hidden) 10.0.2.0/30 (2 entries, 1 announced) *BGP Preference: 170/-101 Next hop type: Router, Next hop index: 0 Address: 0xb618990 Next-hop reference count: 3 Source: 10.0.1.1 Next hop: 10.0.0.2 via ge-0/0/0.0 balance 40% Session Id: 0x0 Next hop: 10.0.1.1 via ge-0/0/1.0 balance 60%, selected Session Id: 0x0 State: <Active Ext> Local AS: 65000 Peer AS: 65001 Age: 20:33 Validation State: unverified Task: BGP_65001.10.0.1.1 Announcement bits (3): 0-KRT 2-BGP_Listen.0.0.0.0+179 3-BGP_RT_Background AS path: 65001 I Communities: bandwidth:65000:60000000 Accepted Multipath Localpref: 100 Router ID: 128.49.121.137 BGP Preference: 170/-101 Next hop type: Router, Next hop index: 595 Address: 0xb7a1330 Next-hop reference count: 9 Source: 10.0.0.2 Next hop: 10.0.0.2 via ge-0/0/0.0, selected Session Id: 0x141 State: <NotBest Ext> Inactive reason: Not Best in its group - Active preferred Local AS: 65000 Peer AS: 65001 Age: 20:33 Validation State: unverified Task: BGP_65001.10.0.0.2 AS path: 65001 I Communities: bandwidth:65000:40000000 Accepted MultipathContrib Localpref: 100 Router ID: 128.49.121.132
含义
验证路由器 R1 是否正在向其邻接路由器 R4 发布聚合带宽
目的
验证路由器 R1 是否正在向其外部邻接方发布聚合带宽。
行动
user@R1> show route advertising-protocol bgp 10.0.4.2 10.0.2.0/30 detail inet.0: 20 destinations, 26 routes (20 active, 0 holddown, 0 hidden) * 10.0.2.0/30 (2 entries, 1 announced) BGP group external2 type External Nexthop: Self AS path: [65000] 65001 I Communities: bandwidth:65000:80000000
含义
路由器 R1 正在向其邻接方传播 80,000,000 字节的聚合带宽。
了解 BGP 中向单个目标方向的多个路径通告
BGP 对等方在更新消息中相互播发路由。BGP 将其路由存储在 Junos OS 路由表 (inet.0
) 中。对于路由表中的每个前缀,路由协议进程会选择一个最佳路径,称为活动路径。除非您将 BGP 配置为将多个路径播发到同一目标,否则 BGP 只会播发活动路径。
您可以将 BGP 配置为将多个路径播发到目标,而不是仅播发活动路径。在自治系统 (AS) 中,到达目标的多个出口点的可用性提供了以下优势:
容错 — 路径多样性可缩短故障后恢复时间。例如,在将多个路径接收到同一目标之后的边界可以预先计算备份路径并准备好它,以便在主路径无效时,边界路由设备可以使用备份设备快速恢复连接。如果没有备用路径,恢复时间取决于 BGP 重新融合,在学习新最佳路径之前,包括网络中的信息提取和播发消息。
负载平衡 — 如果 AS 中的路由满足某些约束,可通过多个路径到达同一目标,从而实现流量负载平衡。
维护 — 备用出口点的可用性允许路由器平稳地进行维护操作。
以下限制适用于在 BGP 中公布多个路由:
支持的地址族:
IPv4 单播 (
family inet unicast
)IPv6 单播 (
family inet6 unicast
)IPv4 标记的单播 (
family inet labeled-unicast
)IPv6 标记的单播 (
family inet6 labeled-unicast
)IPv4 VPN 单播 (
family inet-vpn unicast
)IPv6 VPN 单播 (
family inet6-vpn unicast
)
以下示例显示了 IPv4 VPN 单播和 IPv6 VPN 单播家族的配置:
bgp { group <group-name> { family inet-vpn unicast { add-path { send { include-backup-path include-backup-path; multipath; path-count path-count; path-selection-mode { (all-paths | equal-cost-paths); } prefix-policy [ policy-names ... ]; } receive; } family inet6-vpn unicast { add-path { send { include-backup-path include-backup-path; multipath; path-count path-count; path-selection-mode { (all-paths | equal-cost-paths); } prefix-policy [ policy-names ... ]; } receive; } } }
支持内部 BGP (IBGP) 和外部 BGP (EBGP) 对等方。我们默认支持 EBGP 添加路径接收,并在层级支持通过配置语句
[edit logical-systems logical-system-name protocols bgp group group-name family family]
发送 EBGP 添加路径。仅限主实例。不支持路由实例。
支持平滑重启和不间断活动路由 (NSR)。
不支持 BGP 监控协议 (BMP)。
您可以通过前缀策略过滤路由器上的路由,该路由器配置为将多个路径播发至目标。前缀策略只能与前缀匹配。它们无法匹配路由属性,也不能更改路由的属性。
从 Junos OS 18.4R1 版开始,除了多个 ECMP 路径外,BGP 最多可以播发 2 个添加路径路由。
要播发最多 64 个添加路径的所有添加路径或仅播发等价路径,请包含在path-selection-mode
[edit protocols bgp group group-name family name addpath send]
层次结构级别。您不能同时启用这两multipath
path-selection-mode
种功能。
另请参阅
示例:在 BGP 中广告多个路径
在此示例中,BGP 路由器配置为播发多个路径,而不是仅播发活动路径。RFC 7911(BGP 中 多个路径的播发)中指定了 BGP 中的多个路径播发。
要求
此示例使用以下硬件和软件组件:
八个支持 BGP 的设备。
其中五个支持 BGP 的设备不一定是路由器。例如,它们可以是 EX 系列以太网交换机。
三个支持 BGP 的设备配置为发送多个路径或接收多个路径(或同时接收多个路径)。这三个支持 BGP 的设备必须是 M 系列多服务边缘路由器、MX 系列 5G 通用路由平台或 T 系列核心路由器。
这三台路由器必须运行 Junos OS 11.4 或更高版本。
概述
以下语句用于配置指向目标的多个路径:
[edit protocols bgp group group-name family family] add-path { receive; send { include-backup-path include-backup-path; multipath; path-count path-count; path-selection-mode { (all-paths | equal-cost-paths); } prefix-policy [ policy-names ... ]; } }
在此示例中,路由器 R5、路由器 R6 和路由器 R7 会将静态路由重新分配到 BGP 中。路由器 R1 和路由器 R4 是路由反射器。路由器 R2 和路由器 R3 是路由反射器 R1 的客户端。路由器 R8 是路由反射器 R4 的客户端。
当 BGP 中启用多路径播发时,路由反射是可选的。
根据 add-path send path-count 6
配置,路由器 R1 配置为向路由器 R4 发送最多六条路径(每个目标路径)。
根据 add-path receive
配置,路由器 R4 配置为接收来自路由器 R1 的多个路径。
使用配置, add-path send path-count 6
路由器 R4 配置为向路由器 R8 发送最多 6 条路径。
根据 add-path receive
配置,路由器 R8 配置为接收来自路由器 R4 的多个路径。
策略 add-path send prefix-policy allow_199
配置(以及相应的路由过滤器)将路由器 R4 限制为仅为 172.16.199.1/32 路由发送多个路径。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 CLI 中 [edit]
。
路由器 R1
set interfaces fe-0/0/0 unit 12 family inet address 10.0.12.1/24 set interfaces fe-0/0/1 unit 13 family inet address 10.0.13.1/24 set interfaces fe-1/0/0 unit 14 family inet address 10.0.14.1/24 set interfaces fe-1/2/0 unit 15 family inet address 10.0.15.1/24 set interfaces lo0 unit 10 family inet address 10.0.0.10/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.10 set protocols bgp group rr cluster 10.0.0.10 set protocols bgp group rr neighbor 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.30 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.2 local-address 10.0.15.1 set protocols bgp group e1 neighbor 10.0.15.2 peer-as 2 set protocols bgp group rr_rr type internal set protocols bgp group rr_rr local-address 10.0.0.10 set protocols bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6 set protocols ospf area 0.0.0.0 interface lo0.10 passive set protocols ospf area 0.0.0.0 interface fe-0/0/0.12 set protocols ospf area 0.0.0.0 interface fe-0/0/1.13 set protocols ospf area 0.0.0.0 interface fe-1/0/0.14 set protocols ospf area 0.0.0.0 interface fe-1/2/0.15 set routing-options router-id 10.0.0.10 set routing-options autonomous-system 1
路由器 R2
set interfaces fe-1/2/0 unit 21 family inet address 10.0.12.2/24 set interfaces fe-1/2/1 unit 26 family inet address 10.0.26.1/24 set interfaces lo0 unit 20 family inet address 10.0.0.20/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.2 peer-as 2 set protocols ospf area 0.0.0.0 interface lo0.20 passive set protocols ospf area 0.0.0.0 interface fe-1/2/0.21 set protocols ospf area 0.0.0.0 interface fe-1/2/1.28 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 1
路由器 R3
set interfaces fe-1/0/1 unit 31 family inet address 10.0.13.2/24 set interfaces fe-1/0/2 unit 37 family inet address 10.0.37.1/24 set interfaces lo0 unit 30 family inet address 10.0.0.30/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.30 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.2 peer-as 2 set protocols ospf area 0.0.0.0 interface lo0.30 passive set protocols ospf area 0.0.0.0 interface fe-1/0/1.31 set protocols ospf area 0.0.0.0 interface fe-1/0/2.37 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 1
路由器 R4
set interfaces fe-1/2/0 unit 41 family inet address 10.0.14.2/24 set interfaces fe-1/2/1 unit 48 family inet address 10.0.48.1/24 set interfaces lo0 unit 40 family inet address 10.0.0.40/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.40 set protocols bgp group rr family inet unicast add-path receive set protocols bgp group rr neighbor 10.0.0.10 set protocols bgp group rr_client type internal set protocols bgp group rr_client local-address 10.0.0.40 set protocols bgp group rr_client cluster 10.0.0.40 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy allow_199 set protocols ospf area 0.0.0.0 interface fe-1/2/0.41 set protocols ospf area 0.0.0.0 interface lo0.40 passive set protocols ospf area 0.0.0.0 interface fe-1/2/1.48 set policy-options policy-statement allow_199 from route-filter 172.16.199.1/32 exact set policy-options policy-statement allow_199 term match_199 from prefix-list match_199 set policy-options policy-statement allow_199 then add-path send-count 20 set policy-options policy-statement allow_199 then accept set routing-options autonomous-system 1
路由器 R5
set interfaces fe-1/2/0 unit 51 family inet address 10.0.15.2/24 set interfaces lo0 unit 50 family inet address 10.0.0.50/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.1 export s2b set protocols bgp group e1 neighbor 10.0.15.1 peer-as 1 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then as-path-expand 2 set policy-options policy-statement s2b then accept set routing-options autonomous-system 2 set routing-options static route 172.16.199.1/32 reject set routing-options static route 172.16.198.1/32 reject
路由器 R6
set interfaces fe-1/2/0 unit 62 family inet address 10.0.26.2/24 set interfaces lo0 unit 60 family inet address 10.0.0.60/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.1 export s2b set protocols bgp group e1 neighbor 10.0.26.1 peer-as 1 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then accept set routing-options autonomous-system 2 set routing-options static route 172.16.199.1/32 reject set routing-options static route 172.16.198.1/32 reject
路由器 R7
set interfaces fe-1/2/0 unit 73 family inet address 10.0.37.2/24 set interfaces lo0 unit 70 family inet address 10.0.0.70/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.1 export s2b set protocols bgp group e1 neighbor 10.0.37.1 peer-as 1 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then accept set routing-options autonomous-system 2 set routing-options static route 172.16.199.1/32 reject
路由器 R8
set interfaces fe-1/2/0 unit 84 family inet address 10.0.48.2/24 set interfaces lo0 unit 80 family inet address 10.0.0.80/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.80 set protocols bgp group rr neighbor 10.0.0.40 family inet unicast add-path receive set protocols ospf area 0.0.0.0 interface lo0.80 passive set protocols ospf area 0.0.0.0 interface fe-1/2/0.84 set routing-options autonomous-system 1
配置路由器 R1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置路由器 R1:
配置路由器 R2、路由器 R3、路由器 R4 和路由器 R5 的接口,并配置环路 (lo0) 接口。
[edit interfaces] user@R1# set fe-0/0/0 unit 12 family inet address 10.0.12.1/24 user@R1# set fe-0/0/1 unit 13 family inet address 10.0.13.1/24 user@R1# set fe-1/0/0 unit 14 family inet address 10.0.14.1/24 user@R1# set fe-1/2/0 unit 15 family inet address 10.0.15.1/24 user@R1#set lo0 unit 10 family inet address 10.0.0.10/32
在接口上配置 BGP,然后配置 IBGP 路由反射。
[edit protocols bgp] user@R1# set group rr type internal user@R1# set group rr local-address 10.0.0.10 user@R1# set group rr cluster 10.0.0.10 user@R1# set group rr neighbor 10.0.0.20 user@R1# set group rr neighbor 10.0.0.30 user@R1# set group rr_rr type internal user@R1# set group rr_rr local-address 10.0.0.10 user@R1# set group e1 type external user@R1# set group e1 neighbor 10.0.15.2 local-address 10.0.15.1 user@R1# set group e1 neighbor 10.0.15.2 peer-as 2
将路由器 R1 配置为向其邻接方路由器 R4 发送最多 6 条路径。
路径的目标可以是路由器 R1 可以通过多个路径访问的任何目标。
[edit protocols bgp] user@R1# set group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6
在接口上配置 OSPF。
[edit protocols ospf] user@R1# set area 0.0.0.0 interface lo0.10 passive user@R1# set area 0.0.0.0 interface fe-0/0/0.12 user@R1# set area 0.0.0.0 interface fe-0/0/1.13 user@R1# set area 0.0.0.0 interface fe-1/0/0.14 user@R1# set area 0.0.0.0 interface fe-1/2/0.15
配置路由器 ID 和自治系统编号。
[edit routing-options] user@R1# set router-id 10.0.0.10 user@R1# set autonomous-system 1
完成设备配置后,提交配置。
user@R1# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R1# show interfaces fe-0/0/0 { unit 12 { family inet { address 10.0.12.1/24; } } } fe-0/0/1 { unit 13 { family inet { address 10.0.13.1/24; } } } fe-1/0/0 { unit 14 { family inet { address 10.0.14.1/24; } } } fe-1/2/0 { unit 15 { family inet { address 10.0.15.1/24; } } } lo0 { unit 10 { family inet { address 10.0.0.10/32; } } }
user@R1# show protocols bgp { group rr { type internal; local-address 10.0.0.10; cluster 10.0.0.10; neighbor 10.0.0.20; neighbor 10.0.0.30; } group e1 { type external; neighbor 10.0.15.2 { local-address 10.0.15.1; peer-as 2; } } group rr_rr { type internal; local-address 10.0.0.10; neighbor 10.0.0.40 { family inet { unicast { add-path { send { path-count 6; } } } } } } } ospf { area 0.0.0.0 { interface lo0.10 { passive; } interface fe-0/0/0.12; interface fe-0/0/1.13; interface fe-1/0/0.14; interface fe-1/2/0.15; } }
user@R1# show routing-options router-id 10.0.0.10; autonomous-system 1;
配置路由器 R2
逐步过程
要配置路由器 R2:
配置环路 (lo0) 接口和路由器 R6 和路由器 R1 的接口。
[edit interfaces] user@R2# set fe-1/2/0 unit 21 family inet address 10.0.12.2/24 user@R2# set fe-1/2/1 unit 26 family inet address 10.0.26.1/24 user@R2# set lo0 unit 20 family inet address 10.0.0.20/32
在路由器 R2 的接口上配置 BGP 和 OSPF。
[edit protocols] user@R2# set bgp group rr type internal user@R2# set bgp group rr local-address 10.0.0.20 user@R2# set bgp group e1 type external user@R2# set bgp group e1 neighbor 10.0.26.2 peer-as 2 user@R2# set ospf area 0.0.0.0 interface lo0.20 passive user@R2# set ospf area 0.0.0.0 interface fe-1/2/0.21 user@R2# set ospf area 0.0.0.0 interface fe-1/2/1.28
对于从路由器 R2 发送到路由器 R1 的路由,将路由器 R2 播发为下一跃点,因为路由器 R1 没有路由到 10.0.26.0/24 网络上的路由器 R6 地址。
[edit] user@R2# set policy-options policy-statement set_nh_self then next-hop self user@R2# set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self
配置自治系统编号。
[edit] user@R2# set routing-options autonomous-system 1
完成设备配置后,提交配置。
user@R2# commit
结果
在配置模式下,输入 、 show protocols
、 show policy-options
和show routing-options
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R2# show interfaces fe-1/2/0 { unit 21 { family inet { address 10.0.12.2/24; } } } fe-1/2/1 { unit 26 { family inet { address 10.0.26.1/24; } } } lo0 { unit 20 { family inet { address 10.0.0.20/32; } } }
user@R2# show protocols bgp { group rr { type internal; local-address 10.0.0.20; neighbor 10.0.0.10 { export set_nh_self; } } group e1 { type external; neighbor 10.0.26.2 { peer-as 2; } } } ospf { area 0.0.0.0 { interface lo0.20 { passive; } interface fe-1/2/0.21; interface fe-1/2/1.28; } }
user@R2# show policy-options policy-statement set_nh_self { then { next-hop self; } }
user@R2# show routing-options autonomous-system 1;
配置路由器 R3
逐步过程
要配置路由器 R3:
配置环路 (lo0) 接口和路由器 R7 和路由器 R1 的接口。
[edit interfaces] user@R3# set fe-1/0/1 unit 31 family inet address 10.0.13.2/24 user@R3# set fe-1/0/2 unit 37 family inet address 10.0.37.1/24 user@R3# set lo0 unit 30 family inet address 10.0.0.30/32
在路由器 R3 的接口上配置 BGP 和 OSPF。
[edit protocols] user@R3# set bgp group rr type internal user@R3# set bgp group rr local-address 10.0.0.30 user@R3# set bgp group e1 type external user@R3# set bgp group e1 neighbor 10.0.37.2 peer-as 2 user@R3# set ospf area 0.0.0.0 interface lo0.30 passive user@R3# set ospf area 0.0.0.0 interface fe-1/0/1.31 user@R3# set ospf area 0.0.0.0 interface fe-1/0/2.37
对于从路由器 R3 发送到路由器 R1 的路由,将路由器 R3 播发为下一跃点,因为路由器 R1 没有路由到 10.0.37.0/24 网络上的路由器 R7 地址。
[edit] user@R3# set policy-options policy-statement set_nh_self then next-hop self user@R3# set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self
配置自治系统编号。
[edit] user@R3# set routing-options autonomous-system 1
完成设备配置后,提交配置。
user@R3# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R3# show interfaces fe-1/0/1 { unit 31 { family inet { address 10.0.13.2/24; } } } fe-1/0/2 { unit 37 { family inet { address 10.0.37.1/24; } } } lo0 { unit 30 { family inet { address 10.0.0.30/32; } } }
user@R3# show protocols bgp { group rr { type internal; local-address 10.0.0.30; neighbor 10.0.0.10 { export set_nh_self; } } group e1 { type external; neighbor 10.0.37.2 { peer-as 2; } } } ospf { area 0.0.0.0 { interface lo0.30 { passive; } interface fe-1/0/1.31; interface fe-1/0/2.37; } } user@R3# show policy-options policy-statement set_nh_self { then { next-hop self; } }
user@R3# show routing-options autonomous-system 1;
配置路由器 R4
逐步过程
要配置路由器 R4:
配置路由器 R1 和路由器 R8 的接口,并配置环路 (lo0) 接口。
[edit interfaces] user@R4# set fe-1/2/0 unit 41 family inet address 10.0.14.2/24 user@R4# set fe-1/2/1 unit 48 family inet address 10.0.48.1/24 user@R4# set lo0 unit 40 family inet address 10.0.0.40/32
在接口上配置 BGP,然后配置 IBGP 路由反射。
[edit protocols bgp] user@R4# set group rr type internal user@R4# set group rr local-address 10.0.0.40 user@R4# set group rr neighbor 10.0.0.10 user@R4# set group rr_client type internal user@R4# set group rr_client local-address 10.0.0.40 user@R4# set group rr_client cluster 10.0.0.40
将路由器 R4 配置为向其邻接方路由器 R8 发送最多 6 条路径。
路径的目标可以是路由器 R4 可以通过多个路径访问的任何目标。
[edit protocols bgp] user@R4# set group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6
将路由器 R4 配置为接收来自其邻接方路由器 R1 的多个路径。
路径的目标可以是路由器 R1 可以通过多个路径访问的任何目标。
[edit protocols bgp group rr family inet unicast] user@R4# set add-path receive
在接口上配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@R4# set interface fe-1/2/0.41 user@R4# set interface lo0.40 passive user@R4# set interface fe-1/2/1.48
配置一个策略,使路由器 R4 能够将路由器 R8 的多个路径发送到 172.16.199.1/32 路由。
路由器 R4 接收 172.16.198.1/32 路由和 172.16.199.1/32 路由的多个路径。但是,由于此策略,路由器 R4 仅为 172.16.199.1/32 路由发送多个路径。
[edit protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast] user@R4# set add-path send prefix-policy allow_199 [edit policy-options policy-statement allow_199] user@R4# set from route-filter 172.16.199.1/32 exact user@R4# set then accept
路由器 R4 也可配置为为 add-path 播发前缀的子集发送多达 20 个 BGP
add-path
路由。[edit policy-options policy-statement allow_199] user@R4# set term match_199 from prefix-list match_199 user@R4# set then add-path send-count 20
配置自治系统编号。
[edit routing-options] user@R4# set autonomous-system 1
完成设备配置后,提交配置。
user@R4# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R4# show interfaces fe-1/2/0 { unit 41 { family inet { address 10.0.14.2/24; } } } fe-1/2/1 { unit 48 { family inet { address 10.0.48.1/24; } } } lo0 { unit 40 { family inet { address 10.0.0.40/32; } } }
user@R4# show protocols bgp { group rr { type internal; local-address 10.0.0.40; family inet { unicast { add-path { receive; } } } neighbor 10.0.0.10; } group rr_client { type internal; local-address 10.0.0.40; cluster 10.0.0.40; neighbor 10.0.0.80 { family inet { unicast { add-path { send { path-count 6; prefix-policy allow_199; } } } } } } } ospf { area 0.0.0.0 { interface lo0.40 { passive; } interface fe-1/2/0.41; interface fe-1/2/1.48; } }
user@R4# show policy-options policy-statement allow_199 { from { route-filter 172.16.199.1/32 exact; } from term match_199 { prefix-list match_199; } then add-path send-count 20; then accept; }
user@R4# show routing-options autonomous-system 1;
配置路由器 R5
逐步过程
要配置路由器 R5:
配置环路 (lo0) 接口和路由器 R1 接口。
[edit interfaces] user@R5# set fe-1/2/0 unit 51 family inet address 10.0.15.2/24 user@R5# set lo0 unit 50 family inet address 10.0.0.50/32
在路由器 R5 的接口上配置 BGP。
[edit protocols bgp group e1] user@R5# set type external user@R5# set neighbor 10.0.15.1 peer-as 1
创建静态路由,以便重新分配到 BGP 中。
[edit routing-options] user@R5# set static route 172.16.199.1/32 reject user@R5# set static route 172.16.198.1/32 reject
将静态和直接路由重新分配给 BGP。
[edit protocols bgp group e1 neighbor 10.0.15.1] user@R5# set export s2b [edit policy-options policy-statement s2b] user@R5# set from protocol static user@R5# set from protocol direct user@R5# set then as-path-expand 2 user@R5# set then accept
配置自治系统编号。
[edit routing-options] user@R5# set autonomous-system 2
完成设备配置后,提交配置。
user@R5# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R5# show interfaces fe-1/2/0 { unit 51 { family inet { address 10.0.15.2/24; } } } lo0 { unit 50 { family inet { address 10.0.0.50/32; } } }
user@R5# show protocols bgp { group e1 { type external; neighbor 10.0.15.1 { export s2b; peer-as 1; } } }
user@R5# show policy-options policy-statement s2b { from protocol [ static direct ]; then { as-path-expand 2; accept; } }
user@R5# show routing-options static { route 172.16.198.1/32 reject; route 172.16.199.1/32 reject; } autonomous-system 2;
配置路由器 R6
逐步过程
要配置路由器 R6:
配置环路 (lo0) 接口和路由器 R2 接口。
[edit interfaces] user@R6# set fe-1/2/0 unit 62 family inet address 10.0.26.2/24 user@R6# set lo0 unit 60 family inet address 10.0.0.60/32
在路由器 R6 的接口上配置 BGP。
[edit protocols] user@R6# set bgp group e1 type external user@R6# set bgp group e1 neighbor 10.0.26.1 peer-as 1
创建静态路由,以便重新分配到 BGP 中。
[edit] user@R6# set routing-options static route 172.16.199.1/32 reject user@R6# set routing-options static route 172.16.198.1/32 reject
将来自路由器 R6 路由表的静态和直接路由重新分配到 BGP。
[edit protocols bgp group e1 neighbor 10.0.26.1] user@R6# set export s2b [edit policy-options policy-statement s2b] user@R6# set from protocol static user@R6# set from protocol direct user@R6# set then accept
配置自治系统编号。
[edit routing-options] user@R6# set autonomous-system 2
完成设备配置后,提交配置。
user@R6# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R6# show interfaces fe-1/2/0 { unit 62 { family inet { address 10.0.26.2/24; } } } lo0 { unit 60 { family inet { address 10.0.0.60/32; } } }
user@R6# show protocols bgp { group e1 { type external; neighbor 10.0.26.1 { export s2b; peer-as 1; } } }
user@R6# show policy-options policy-statement s2b { from protocol [ static direct ]; then accept; }
user@R6# show routing-options static { route 172.16.198.1/32 reject; route 172.16.199.1/32 reject; } autonomous-system 2;
配置路由器 R7
逐步过程
要配置路由器 R7:
配置环路 (lo0) 接口和路由器 R3 接口。
[edit interfaces] user@R7# set fe-1/2/0 unit 73 family inet address 10.0.37.2/24 user@R7# set lo0 unit 70 family inet address 10.0.0.70/32
在路由器 R7 的接口上配置 BGP。
[edit protocols bgp group e1] user@R7# set type external user@R7# set neighbor 10.0.37.1 peer-as 1
创建一个静态路由,以便重新分配到 BGP 中。
[edit] user@R7# set routing-options static route 172.16.199.1/32 reject
将来自路由器 R7 的路由表的静态和直接路由重新分配给 BGP。
[edit protocols bgp group e1 neighbor 10.0.37.1] user@R7# set export s2b [edit policy-options policy-statement s2b] user@R7# set from protocol static user@R7# set from protocol direct user@R7# set then accept
配置自治系统编号。
[edit routing-options] user@R7# set autonomous-system 2
完成设备配置后,提交配置。
user@R7# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R7# show interfaces fe-1/2/0 { unit 73 { family inet { address 10.0.37.2/24; } } } lo0 { unit 70 { family inet { address 10.0.0.70/32; } } }
user@R7# show protocols bgp { group e1 { type external; neighbor 10.0.37.1 { export s2b; peer-as 1; } } }
user@R7# show policy-options policy-statement s2b { from protocol [ static direct ]; then accept; }
user@R7# show routing-options static { route 172.16.199.1/32 reject; } autonomous-system 2;
配置路由器 R8
逐步过程
要配置路由器 R8:
配置环路 (lo0) 接口和路由器 R4 接口。
[edit interfaces] user@R8# set fe-1/2/0 unit 84 family inet address 10.0.48.2/24 user@R8# set lo0 unit 80 family inet address 10.0.0.80/32
在路由器 R8 接口上配置 BGP 和 OSPF。
[edit protocols] user@R8# set bgp group rr type internal user@R8# set bgp group rr local-address 10.0.0.80 user@R8# set ospf area 0.0.0.0 interface lo0.80 passive user@R8# set ospf area 0.0.0.0 interface fe-1/2/0.84
将路由器 R8 配置为接收来自其邻接方路由器 R4 的多个路径。
路径的目标可以是路由器 R4 可以通过多个路径访问的任何目标。
[edit protocols] user@R8# set bgp group rr neighbor 10.0.0.40 family inet unicast add-path receive
配置自治系统编号。
[edit] user@R8# set routing-options autonomous-system 1
完成设备配置后,提交配置。
user@R8# commit
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R8# show interfaces fe-1/2/0 { unit 84 { family inet { address 10.0.48.2/24; } } } lo0 { unit 80 { family inet { address 10.0.0.80/32; } } }
user@R8# show protocols bgp { group rr { type internal; local-address 10.0.0.80; neighbor 10.0.0.40 { family inet { unicast { add-path { receive; } } } } } } ospf { area 0.0.0.0 { interface lo0.80 { passive; } interface fe-1/2/0.84; } }
user@R8# show routing-options autonomous-system 1;
验证
确认配置工作正常。
验证 BGP 对等方是否能够发送和接收多个路径
目的
请确保命令输出 show bgp neighbor
中显示以下一个或两个以下字符串:
NLRI's for which peer can receive multiple paths: inet-unicast
NLRI's for which peer can send multiple paths: inet-unicast
行动
user@R1> show bgp neighbor 10.0.0.40 Peer: 10.0.0.40+179 AS 1 Local: 10.0.0.10+64227 AS 1 Type: Internal State: Established Flags: <Sync> ... NLRI's for which peer can receive multiple paths: inet-unicast ...
user@R4> show bgp neighbor 10.0.0.10 Peer: 10.0.0.10+64227 AS 1 Local: 10.0.0.40+179 AS 1 Type: Internal State: Established Flags: <Sync> ... NLRI's for which peer can send multiple paths: inet-unicast ...
user@R4> show bgp neighbor 10.0.0.80 Peer: 10.0.0.80+55416 AS 1 Local: 10.0.0.40+179 AS 1 Type: Internal State: Established (route reflector client)Flags: <Sync> ,,, NLRI's for which peer can receive multiple paths: inet-unicast ...
user@R8> show bgp neighbor 10.0.0.40 Peer: 10.0.0.40+179 AS 1 Local: 10.0.0.80+55416 AS 1 Type: Internal State: Established Flags: <Sync> ... NLRI's for which peer can send multiple paths: inet-unicast ...
验证路由器 R1 是否在宣传多个路径
目的
请确保将多条路径播发至 172.16.198.1/32 目标路径和 172.16.199.1/32 目标的多个路径。
行动
user@R1> show route advertising-protocol bgp 10.0.0.40 inet.0: 21 destinations, 25 routes (21 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 172.16.198.1/32 10.0.0.20 100 2 I 10.0.15.2 100 2 2 I * 172.16.199.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I * 172.16.200.0/30 10.0.0.20 100 2 I
含义
当您看到一个前缀和多个下一跃点时,表示多个路径会播发到路由器 R4。
验证路由器 R4 是否正在接收和传播多个路径
目的
请确保从路由器 R1 接收到 172.16.199.1/32 目标的多个路径,并播发至路由器 R8。请确保从路由器 R1 接收到 172.16.198.1/32 目标的多个路径,但仅向路由器 R8 播发此目标的一条路径。
行动
user@R4> show route receive-protocol bgp 10.0.0.10 inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 172.16.198.1/32 10.0.0.20 100 2 I 10.0.15.2 100 2 2 I * 172.16.199.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I * 172.16.200.0/30 10.0.0.20 100 2 I
user@R4> show route advertising-protocol bgp 10.0.0.80 inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 172.16.198.1/32 10.0.0.20 100 2 I * 172.16.199.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I * 172.16.200.0/30 10.0.0.20 100 2 I
含义
命令 show route receive-protocol
显示,路由器 R4 接收两条指向 172.16.198.1/32 目标的路径和 172.16.199.1/32 目标的三条路径。命令 show route advertising-protocol
显示,路由器 R4 仅向 172.16.198.1/32 目标播发一条路径,并将所有三条路径播发至 172.16.199.1/32 目标。
由于应用于路由器 R4 的前缀策略,路由器 R4 不会将多个路径播发至 172.16.198.1/32 目标。路由器 R4 仅向 172.16.198.1/32 目标播发一条路径,即使接收到此目标的多个路径。
验证路由器 R8 是否接收多个路径
目的
确保路由器 R8 通过路由器 R4 接收通往 172.16.199.1/32 目标的多个路径。确保路由器 R8 通过路由器 R4 仅接收一条通向 172.16.198.1/32 目标的路径。
行动
user@R8> show route receive-protocol bgp 10.0.0.40 inet.0: 18 destinations, 20 routes (18 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 172.16.198.1/32 10.0.0.20 100 2 I * 172.16.199.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I * 200.1.1.0/30 10.0.0.20 100 2 I
检查路径 ID
目的
在下游设备上,路由器 R4 和路由器 R8 上,验证路径 ID 是否唯一标识该路径。查找 Addpath Path ID:
字符串。
行动
user@R4> show route 172.16.199.1/32 detail inet.0: 18 destinations, 20 routes (18 active, 0 holddown, 0 hidden) 172.16.199.1/32 (3 entries, 3 announced) *BGP Preference: 170/-101 Next hop type: Indirect Next-hop reference count: 9 Source: 10.0.0.10 Next hop type: Router, Next hop index: 676 Next hop: 10.0.14.1 via lt-1/2/0.41, selected Protocol next hop: 10.0.0.20 Indirect next hop: 92041c8 262146 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 1:44:37 Metric2: 2 Task: BGP_1.10.0.0.10+64227 Announcement bits (3): 2-KRT 3-BGP RT Background 4-Resolve tree 1 AS path: 2 I (Originator) Cluster list: 10.0.0.10 AS path: Originator ID: 10.0.0.20 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 1 BGP Preference: 170/-101 Next hop type: Indirect Next-hop reference count: 4 Source: 10.0.0.10 Next hop type: Router, Next hop index: 676 Next hop: 10.0.14.1 via lt-1/2/0.41, selected Protocol next hop: 10.0.0.30 Indirect next hop: 92042ac 262151 State: <NotBest Int Ext> Inactive reason: Not Best in its group - Router ID Local AS: 1 Peer AS: 1 Age: 1:44:37 Metric2: 2 Task: BGP_1.10.0.0.10+64227 Announcement bits (1): 3-BGP RT Background AS path: 2 I (Originator) Cluster list: 10.0.0.10 AS path: Originator ID: 10.0.0.30 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 2 BGP Preference: 170/-101 Next hop type: Indirect Next-hop reference count: 4 Source: 10.0.0.10 Next hop type: Router, Next hop index: 676 Next hop: 10.0.14.1 via lt-1/2/0.41, selected Protocol next hop: 10.0.15.2 Indirect next hop: 92040e4 262150 State: <Int Ext> Inactive reason: AS path Local AS: 1 Peer AS: 1 Age: 1:44:37 Metric2: 2 Task: BGP_1.10.0.0.10+64227 Announcement bits (1): 3-BGP RT Background AS path: 2 2 I Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 3
user@R8> show route 172.16.199.1/32 detail inet.0: 17 destinations, 19 routes (17 active, 0 holddown, 0 hidden) 172.16.199.1/32 (3 entries, 1 announced) *BGP Preference: 170/-101 Next hop type: Indirect Next-hop reference count: 9 Source: 10.0.0.40 Next hop type: Router, Next hop index: 1045 Next hop: 10.0.48.1 via lt-1/2/0.84, selected Protocol next hop: 10.0.0.20 Indirect next hop: 91fc0e4 262148 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 1:56:51 Metric2: 3 Task: BGP_1.10.0.0.40+179 Announcement bits (2): 2-KRT 4-Resolve tree 1 AS path: 2 I (Originator) Cluster list: 10.0.0.40 10.0.0.10 AS path: Originator ID: 10.0.0.20 Accepted Localpref: 100 Router ID: 10.0.0.40 Addpath Path ID: 1 BGP Preference: 170/-101 Next hop type: Indirect Next-hop reference count: 4 Source: 10.0.0.40 Next hop type: Router, Next hop index: 1045 Next hop: 10.0.48.1 via lt-1/2/0.84, selected Protocol next hop: 10.0.0.30 Indirect next hop: 91fc1c8 262152 State: <NotBest Int Ext> Inactive reason: Not Best in its group - Router ID Local AS: 1 Peer AS: 1 Age: 1:56:51 Metric2: 3 Task: BGP_1.10.0.0.40+179 AS path: 2 I (Originator) Cluster list: 10.0.0.40 10.0.0.10 AS path: Originator ID: 10.0.0.30 Accepted Localpref: 100 Router ID: 10.0.0.40 Addpath Path ID: 2 BGP Preference: 170/-101 Next hop type: Indirect Next-hop reference count: 4 Source: 10.0.0.40 Next hop type: Router, Next hop index: 1045 Next hop: 10.0.48.1 via lt-1/2/0.84, selected Protocol next hop: 10.0.15.2 Indirect next hop: 91fc2ac 262153 State: <Int Ext> Inactive reason: AS path Local AS: 1 Peer AS: 1 Age: 1:56:51 Metric2: 3 Task: BGP_1.10.0.0.40+179 AS path: 2 2 I (Originator) Cluster list: 10.0.0.40 AS path: Originator ID: 10.0.0.10 Accepted Localpref: 100 Router ID: 10.0.0.40 Addpath Path ID: 3
示例:配置 BGP 多路径的选择性广告,以平衡负载
此示例说明如何配置 BGP 多路径的选择性广告。公布所有可用的多个路径可能会导致设备内存处理开销很大,这也是一个扩展考虑因素。您可以配置 BGP 路由反射器,以仅播发参与者多路径,以实现负载平衡。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
八个路由器,可以是 M 系列、MX 系列或 T 系列路由器的组合
设备上的 Junos OS 16.1R2 或更高版本
概述
从 Junos OS 16.1R2 版开始,您可以限制 BGP add-path
仅播发多个路径。您可以限制和配置 BGP multipath
算法选择的最多六个前缀。选择性地传播多个路径有利于使用路由反射器在 IBGP 中构建路径内多元化的互联网服务提供商和数据中心。您可以启用 BGP 路由反射器来播发作为负载平衡贡献路径的多路径。
拓扑
在 图 7中,RR1 和 RR4 是路由反射器。路由器 R2 和 R3 是路由反射器 RR1 的客户端。路由器 R8 是用于路由反射器 RR4 的客户端。为多路径配置了具有邻接方 R2 和 R3 的 RR1 组。路由器 R5、R6 和路由器 R7 将静态路由 199.1.1.1/32 和 198.1.1.1/32 重新分配给 BGP。
在路由器 RR1 上配置了负载平衡策略,以便计算 199.1.1.1/32 路由的多路径。多路径功能在邻接方 RR4 的添加路径下配置。但是,路由器 RR4 未配置负载平衡多路径。路由器 RR1 配置为向从多路径候选路由中选择的 199.1.1.1/32 发送最多 6 个添加路径路由的路由器 RR4。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入提交。
路由器 RR1
set interfaces ge-1/0/10 unit 0 description RR1->R2 set interfaces ge-1/0/10 unit 0 family inet address 10.0.12.1/24 set interfaces ge-1/0/11 unit 0 description RR1->RR4 set interfaces ge-1/0/11 unit 0 family inet address 10.0.14.1/24 set interfaces ge-1/0/12 unit 0 description RR1->R5 set interfaces ge-1/0/12 unit 0 family inet address 10.0.15.1/24 set interfaces ge-1/0/13 unit 0 description RR1->R3 set interfaces ge-1/0/13 unit 0 family inet address 10.0.13.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.10/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.10 set protocols bgp group rr cluster 10.0.0.10 set protocols bgp group rr multipath set protocols bgp group rr neighbor 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.30 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.2 local-address 10.0.15.1 set protocols bgp group e1 neighbor 10.0.15.2 peer-as 64502 set protocols bgp group rr_rr type internal set protocols bgp group rr_rr local-address 10.0.0.10 set protocols bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6 set protocols bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send multipath set protocols ospf area 0.0.0.0 interface lo0.10 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/13 set protocols ospf area 0.0.0.0 interface ge-1/0/11 set protocols ospf area 0.0.0.0 interface ge-1/0/12 set policy-options prefix-list match_199 199.1.1.1/32 set policy-options policy-statement loadbal_199 term match_100 from prefix-list match_199 set policy-options policy-statement loadbal_199 from route-filter 199.1.1.1/32 exact set policy-options policy-statement loadbal_199 then load-balance per-packet set routing-options router-id 10.0.0.10 set routing-options autonomous-system 64501 set routing-options forwarding-table export loadbal_199
路由器 R2
set interfaces ge-1/0/10 unit 0 description R2->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.12.2/24 set interfaces ge-1/0/11 unit 0 description R2->R6 set interfaces ge-1/0/11 unit 0 family inet address 10.0.26.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.20/32 set protocols bgp group rr local-address 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.2 peer-as 64502 set protocols ospf area 0.0.0.0 interface lo0.20 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/11 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 64501
路由器 R3
set interfaces ge-1/0/10 unit 0 description R3->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.13.2/24 set interfaces ge-1/0/11 unit 0 description R3->R7 set interfaces ge-1/0/11 unit 0 family inet address 10.0.37.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.30/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.30 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.2 peer-as 64502 set protocols ospf area 0.0.0.0 interface lo0.30 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/13 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 64501
路由器 RR4
set interfaces ge-1/0/10 unit 0 description RR4->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.14.2/24 set interfaces ge-1/0/11 unit 0 description RR4->R8 set interfaces ge-1/0/11 unit 0 family inet address 10.0.48.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.40/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.40 set protocols bgp group rr family inet unicast add-path receive set protocols bgp group rr neighbor 10.0.0.10 set protocols bgp group rr_client type internal set protocols bgp group rr_client local-address 10.0.0.40 set protocols bgp group rr_client cluster 10.0.0.40 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy addpath-communities-send-4713-100 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 2 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send multipath set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface lo0.40 passive set protocols ospf area 0.0.0.0 interface ge-1/0/11 set policy-options prefix-list match_199 199.1.1.1/32 set routing-options autonomous-system 64501
路由器 R5
set interfaces ge-1/0/10 unit 0 description R5->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.15.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.50/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.1 export s2b set protocols bgp group e1 neighbor 10.0.15.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then as-path-expand 2 set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options static route 198.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R6
set interfaces ge-1/0/10 unit 0 description R6->R2 set interfaces ge-1/0/10 unit 0 family inet address 10.0.26.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.60/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.1 export s2b set protocols bgp group e1 neighbor 10.0.26.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options static route 198.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R7
set interfaces ge-1/0/10 unit 0 description R7->R3 set interfaces ge-1/0/10 unit 0 family inet address 10.0.37.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.70/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.1 export s2b set protocols bgp group e1 neighbor 10.0.37.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R8
set interfaces ge-1/0/10 unit 0 description R8->RR4 set interfaces ge-1/0/10 unit 0 family inet address 10.0.48.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.80/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.80 set protocols bgp group rr neighbor 10.0.0.40 family inet unicast add-path receive set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10.8 set routing-options autonomous-system 64501 set chassis fpc 1 pic 0 tunnel-services bandwidth 1g
配置路由器 RR1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用CLI 编辑器。
要配置路由器 RR1:
修改相应的接口名称、地址和其他参数后,对其他路由器重复此过程。
使用 IPv4 地址配置接口。
[edit interfaces] user@RR1# set ge-1/0/10 unit 0 description RR1->R2 user@RR1# set ge-1/0/10 unit 0 family inet address 10.0.12.1/24 user@RR1# set ge-1/0/11 unit 0 description RR1->RR4 user@RR1# set ge-1/0/11 unit 0 family inet address 10.0.14.1/24 user@RR1# set ge-1/0/12 unit 0 description RR1->R5 user@RR1# set ge-1/0/12 unit 0 family inet address 10.0.15.1/24 user@RR1# set ge-1/0/13 unit 0 description RR1->R3 user@RR1# set ge-1/0/13 unit 0 family inet address 10.0.13.1/24
配置环路地址。
[edit interfaces] user@RR1# set lo0 unit 0 family inet address 10.0.0.10/32
配置内部网关协议 (IGP),例如 OSPF 或 IS-IS。
[edit protocols] user@RR1# set ospf area 0.0.0.0 interface lo0.10 passive user@RR1# set ospf area 0.0.0.0 interface ge-1/0/10 user@RR1# set ospf area 0.0.0.0 interface ge-1/0/13 user@RR1# set ospf area 0.0.0.0 interface ge-1/0/11 user@RR1# set ospf area 0.0.0.0 interface ge-1/0/12
为连接到内部路由器 R2 和 R3 的接口配置内部组 rr。
[edit protocols] user@RR1# set bgp group rr type internal user@RR1# set bgp group rr local-address 10.0.0.10 user@RR1# set bgp group rr cluster 10.0.0.10 user@RR1# set bgp group rr neighbor 10.0.0.20 user@RR1# set bgp group rr neighbor 10.0.0.30
为内部 BGP 组 rr 配置负载平衡。
[edit protocols] user@RR1# set bgp group rr multipath
为路由反射器配置内部组rr_rr。
[edit protocols] user@RR1# set bgp group rr_rr type internal user@RR1# set bgp group rr_rr local-address 10.0.0.10
将 addpath 多路径功能配置为仅播发多个参与者路径,并将播发的多路径数量限制为 6 个。
[edit protocols] user@RR1# set bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send multipath user@RR1# set bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6
在连接到外部边缘路由器的接口上配置 EBGP。
[edit protocols] user@RR1# set bgp group e1 type external user@RR1# set bgp group e1 neighbor 10.0.15.2 local-address 10.0.15.1 user@RR1# set bgp group e1 neighbor 10.0.15.2 peer-as 64502
为每个数据包负载平衡定义策略loadbal_199。
[edit policy-options] user@RR1# set prefix-list match_199 199.1.1.1/32 user@RR1# set policy-statement loadbal_199 term match_100 from prefix-list match_199 user@RR1# set policy-statement loadbal_199 from route-filter 199.1.1.1/32 exact user@RR1# set policy-statement loadbal_199 then load-balance per-packet
loadbal_199应用定义的导出策略。
[edit routing-options] user@RR1# set forwarding-table export loadbal_199
为 BGP 主机配置路由器 ID 和自治系统。
[edit routing-options] user@RR1# set router-id 10.0.0.10 user@RR1# set autonomous-system 64501
结果
在配置模式下,输入 show interfaces、 show protocols、 show routing-options和 show policy-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit] user@RR1# show interfaces ge-1/0/10 { unit 0 { description RR1->R2; family inet { address 10.0.12.1/24; } } } ge-1/0/11 { unit 0 { description RR1->RR4; family inet { address 10.0.14.1/24; } } } ge-1/0/12 { unit 0 { description RR1->R5; family inet { address 10.0.15.1/24; } } } ge-1/0/13 { unit 0 { description RR1->R3; family inet { address 10.0.13.1/24; } } } lo0 { unit 0 { family inet { address 10.0.0.10/32; } } }
[edit] user@RR1# show protocols bgp { group rr { type internal; local-address 10.0.0.10; cluster 10.0.0.10; multipath; neighbor 10.0.0.20; neighbor 10.0.0.30; } group e1 { type external; neighbor 10.0.15.2 { local-address 10.0.15.1; peer-as 64502; } } group rr_rr { type internal; local-address 10.0.0.10; neighbor 10.0.0.40 { family inet { unicast { add-path { send { path-count 6; multipath; } } } } } } } ospf { area 0.0.0.0 { interface all; interface fxp0.0 { disable; } interface lo0.10 { passive; } interface ge-1/0/10; interface ge-1/0/13; interface ge-1/0/11; interface ge-1/0/12; } }
[edit] user@RR1# show routing-options router-id 10.0.0.10; autonomous-system 64501; forwarding-table { export load-bal_199; }
[edit] user@RR1# show policy-options prefix-list match_199 { 199.1.1.1/32; } policy-statement loadbal_199 { term match_100 { from { prefix-list match_199; } } from { route-filter 199.1.1.1/32 exact; } then { load-balance per-packet; } }
完成设备配置后,提交配置。
user@RR1# commit
验证
确认配置工作正常。
验证静态路由 199.1.1.1/32 的多路径路由
目的
验证目标 199.1.1.1/32 的可用多路径路由。
行动
在操作模式下,在 show route 199.1.1.1/32 detail 路由器 RR1 上运行命令。
user@RR1> show route 199.1.1.1/32 detail inet.0: 22 destinations, 26 routes (22 active, 0 holddown, 0 hidden) 199.1.1.1/32 (3 entries, 2 announced) *BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae5cc90 Next-hop reference count: 1 Source: 10.0.0.20 Next hop type: Router, Next hop index: 1118 Next hop: 10.0.12.2 via lt-1/0/10.1, selected Session Id: 0x0 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.13.2 via lt-1/0/10.9 Session Id: 0x0 Protocol next hop: 10.0.0.20 Indirect next hop: 0xc409410 1048574 INH Session ID: 0x0 Protocol next hop: 10.0.0.30 Indirect next hop: 0xc409520 1048575 INH Session ID: 0x0 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 4:03:29 Metric2: 1 Validation State: unverified Task: BGP_1.10.0.0.20 Announcement bits (3): 2-KRT 3-BGP_RT_Background 4-Resolve tree 2 AS path: 2 I Communities: 4713:100 Accepted Multipath Localpref: 100 Router ID: 10.0.0.20 BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0ec10 Next-hop reference count: 4 Source: 10.0.0.30 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.13.2 via lt-1/0/10.9, selected Session Id: 0x0 Protocol next hop: 10.0.0.30 Indirect next hop: 0xc409520 1048575 INH Session ID: 0x0 State: <NotBest Int Ext> Inactive reason: Not Best in its group - Router ID Local AS: 64501 Peer AS: 64501 Age: 4:03:29 Metric2: 1 Validation State: unverified Task: BGP_1.10.0.0.30 Announcement bits (1): 3-BGP_RT_Background AS path: 2 I Communities: 4713:100 Accepted MultipathContrib Localpref: 100 Router ID: 10.0.0.30 BGP Preference: 170/-101 Next hop type: Router, Next hop index: 1105 Address: 0xae0e970 Next-hop reference count: 5 Source: 10.0.15.2 Next hop: 10.0.15.2 via lt-1/0/10.6, selected Session Id: 0x0 State: <Ext> Inactive reason: AS path Local AS: 1 Peer AS: 2 Age: 4:05:01 Validation State: unverified Task: BGP_2.10.0.15.2 AS path: 2 2 I Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.50
含义
在路由器 RR1 上启用了选择性播发多路径功能,路由 199.1.1.1/32 有不止一个下一跳可用。路由 199.1.1.1/32 的两个可用下一跃点是 10.0.0.20 和 10.0.0.30。
验证多路径路由是否已从路由器 RR1 播发到路由器 RR4
目的
验证路由器 RR1 是否正在播发多路径路由。
行动
在操作模式下,在 show route advertising-protocol bgp 10.0.0.40 路由器 RR1 上运行命令。
user@RR1> show route advertising-protocol bgp 10.0.0.40 inet.0: 22 destinations, 26 routes (22 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 198.1.1.1/32 10.0.0.20 100 2 I * 199.1.1.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I
user@RR1> show route advertising-protocol bgp 10.0.0.40 detail inet.0: 22 destinations, 26 routes (22 active, 0 holddown, 0 hidden) * 10.0.0.50/32 (1 entry, 1 announced) BGP group rr_rr type Internal Nexthop: 10.0.15.2 Localpref: 100 AS path: [1] 2 2 I Communities: 4713:100 Addpath Path ID: 1 ….* 199.1.1.1/32 (3 entries, 2 announced) BGP group rr_rr type Internal Nexthop: 10.0.0.20 Localpref: 100 AS path: [1] 2 I Communities: 4713:100 Cluster ID: 10.0.0.10 Originator ID: 10.0.0.20 Addpath Path ID: 1 BGP group rr_rr type Internal Nexthop: 10.0.0.30 Localpref: 100 AS path: [1] 2 I Communities: 4713:100 Cluster ID: 10.0.0.10 Originator ID: 10.0.0.30 Addpath Path ID: 2
含义
路由器 RR1 正在向路由器 RR4 广告路由 199.1.1.1.1/32 两个下一跃点 10.0.0.20 和 10.0.30。
验证路由器 RR4 是否将 199.1.1.1/32 的一个路由播发至路由器 R8
目的
未在路由器 RR4 上配置多路径,因此路由 199.1.1.1/32 不符合添加路径的条件。验证路由器 RR4 是否仅向路由器 R8 播发 199.1.1.1/32 的一个路由。
行动
在操作模式下,在 show route advertising-protocol bgp 10.0.0.80 路由器 RR4 上运行命令。
user@RR4> show route advertising-protocol bgp 10.0.0.80 detail inet.0: 20 destinations, 21 routes (20 active, 0 holddown, 0 hidden) * 10.0.0.50/32 (1 entry, 1 announced) BGP group rr_client type Internal Nexthop: 10.0.15.2 Localpref: 100 AS path: [1] 2 2 I Communities: 4713:100 Cluster ID: 10.0.0.40 Originator ID: 10.0.0.10 Addpath Path ID: 1 … * 198.1.1.1/32 (1 entry, 1 announced) BGP group rr_client type Internal Nexthop: 10.0.0.20 Localpref: 100 AS path: [1] 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.20 Communities: 4713:100 Cluster ID: 10.0.0.40 Addpath Path ID: 1 * 199.1.1.1/32 (2 entries, 1 announced) BGP group rr_client type Internal Nexthop: 10.0.0.20 Localpref: 100 AS path: [1] 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.20 Communities: 4713:100 Cluster ID: 10.0.0.40 Addpath Path ID: 1
含义
由于路由器 RR4 上未启用多路径,因此只会向路由器 R8 播发一个路径 10.0.0.20。
示例:配置路由策略以根据 BGP 社区值选择和播发多路径
公布所有可用的多个路径可能会导致设备内存处理开销很大。如果您希望在预先不知道前缀的情况下播发有限的前缀子集,可以使用 BGP 社区值来识别需要播发给 BGP 邻接方的前缀路由。此示例说明如何定义路由策略,以基于已知的 BGP 社区值过滤和播发多个路径。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
八个路由器,可以是 M 系列、MX 系列或 T 系列路由器的组合
设备上的 Junos OS 16.1R2 或更高版本
概述
从 Junos OS 16.1R2 开始,您可以定义一个策略来根据社区值识别符合条件的多路径前缀。除了活动路径之外,BGP 还将这些社区标记的路由播发到给定目标。如果路由的社区值与策略中定义的社区值不匹配,则 BGP 不会播发该路由。此功能允许 BGP 向给定目标播发不超过 20 个路径。您可以限制和配置 BGP 在多个路径中考虑的前缀数量,而无需提前知道前缀。相反,一个已知的 BGP 社区值可以决定是否播发前缀。
拓扑
在 图 8中,RR1 和 RR4 是路由反射器。路由器 R2 和 R3 是路由反射器 RR1 的客户端。路由器 R8 是用于路由反射器 RR4 的客户端。路由器 R5、R6 和路由器 R7 将静态路由重新分配到 BGP 中。路由器 R5 播发静态路由 199.1.1.1/32 和 198.1.1.1/32,社区值 4713:100。
路由器 RR1 配置为向路由器 RR4 发送最多六个路径(每个目标)。路由器 RR4 配置为向路由器 R8 发送最多 6 条路径。路由器 R8 配置为接收来自路由器 RR4 的多个路径。add-path 社区配置限制路由器 RR4 为仅包含 4713:100 社区值的路由发送多个路径。路由器 RR4 会过滤并播发仅包含 4714:100 社区值的多路径。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入提交。
路由器 RR1
set interfaces ge-1/0/10 unit 0 description RR1->R2 set interfaces ge-1/0/10 unit 0 family inet address 10.0.12.1/24 set interfaces ge-1/0/11 unit 0 description RR1->RR4 set interfaces ge-1/0/11 unit 0 family inet address 10.0.14.1/24 set interfaces ge-1/0/12 unit 0 description RR1->R5 set interfaces ge-1/0/12 unit 0 family inet address 10.0.15.1/24 set interfaces ge-1/0/13 unit 0 description RR1->R3 set interfaces ge-1/0/13 unit 0 family inet address 10.0.13.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.10/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.10 set protocols bgp group rr cluster 10.0.0.10 set protocols bgp group rr multipath set protocols bgp group rr neighbor 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.30 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.2 local-address 10.0.15.1 set protocols bgp group e1 neighbor 10.0.15.2 peer-as 64502 set protocols bgp group rr_rr type internal set protocols bgp group rr_rr local-address 10.0.0.10 set protocols bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6 set protocols ospf area 0.0.0.0 interface lo0.10 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/13 set protocols ospf area 0.0.0.0 interface ge-1/0/11 set protocols ospf area 0.0.0.0 interface ge-1/0/12 set routing-options router-id 10.0.0.10 set routing-options autonomous-system 64501
路由器 R2
set interfaces ge-1/0/10 unit 0 description R2->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.12.2/24 set interfaces ge-1/0/11 unit 0 description R2->R6 set interfaces ge-1/0/11 unit 0 family inet address 10.0.26.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.20/32 set protocols bgp group rr local-address 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.2 peer-as 64502 set protocols ospf area 0.0.0.0 interface lo0.20 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/11 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 64501
路由器 R3
set interfaces ge-1/0/10 unit 0 description R3->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.13.2/24 set interfaces ge-1/0/11 unit 0 description R3->R7 set interfaces ge-1/0/11 unit 0 family inet address 10.0.37.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.30/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.30 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.2 peer-as 64502 set protocols ospf area 0.0.0.0 interface lo0.30 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/13 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 64501
路由器 RR4
set interfaces ge-1/0/10 unit 0 description RR4->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.14.2/24 set interfaces ge-1/0/11 unit 0 description RR4->R8 set interfaces ge-1/0/11 unit 0 family inet address 10.0.48.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.40/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.40 set protocols bgp group rr family inet unicast add-path receive set protocols bgp group rr neighbor 10.0.0.10 set protocols bgp group rr_client type internal set protocols bgp group rr_client local-address 10.0.0.40 set protocols bgp group rr_client cluster 10.0.0.40 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy addpath-communities-send-4713-100 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6 set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface lo0.40 passive set protocols ospf area 0.0.0.0 interface ge-1/0/11 set policy-options community addpath-community-members 4713:100 set policy-options community addpath-communities-send-4713:100 set policy-options policy-statement addpath-communitiesunities-send-4713-100 term term1 from protocol bgp set policy-options policy-statement addpath-communities-send-4713-100 term term1 from community addpath-4713-100-community set policy-options policy-statement addpath-communitiesunities-send-4713-100 term term1 then add-path send-count 6 set policy-options policy-statement addpath-communities-send-4713-100 term term1 then add-path accept set routing-options autonomous-system 64501
路由器 R5
set interfaces ge-1/0/10 unit 0 description R5->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.15.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.50/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.1 export s2b set protocols bgp group e1 neighbor 10.0.15.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then as-path-expand 2 set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options static route 198.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R6
set interfaces ge-1/0/10 unit 0 description R6->R2 set interfaces ge-1/0/10 unit 0 family inet address 10.0.26.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.60/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.1 export s2b set protocols bgp group e1 neighbor 10.0.26.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options static route 198.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R7
set interfaces ge-1/0/10 unit 0 description R7->R3 set interfaces ge-1/0/10 unit 0 family inet address 10.0.37.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.70/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.1 export s2b set protocols bgp group e1 neighbor 10.0.37.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R8
set interfaces ge-1/0/10 unit 0 description R8->RR4 set interfaces ge-1/0/10 unit 0 family inet address 10.0.48.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.80/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.80 set protocols bgp group rr neighbor 10.0.0.40 family inet unicast add-path receive set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10.8 set routing-options autonomous-system 64501 set chassis fpc 1 pic 0 tunnel-services bandwidth 1g
配置路由器 RR4
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用CLI 编辑器。
要配置路由器 RR4:
修改相应的接口名称、地址和其他参数后,对其他路由器重复此过程。
使用 IPv4 地址配置接口。
[edit interfaces] user@RR4# set ge-1/0/10 unit 0 description RR4->RR1 user@RR4# set ge-1/0/10 unit 0 family inet address 10.0.14.2/24 user@RR4# set ge-1/0/11 unit 0 description RR4->R8 user@RR4# set ge-1/0/11 unit 0 family inet address 10.0.48.1/24
配置环路地址。
[edit interfaces] user@RR4# set lo0 unit 0 family inet address 10.0.0.40/32
配置 OSPF 或任何其他内部网关协议 (IGP)。
[edit protocols] user@RR4# set ospf area 0.0.0.0 interface lo0.40 passive user@RR4# set ospf area 0.0.0.0 interface ge-1/0/10 user@RR4# set ospf area 0.0.0.0 interface ge-1/0/11
为路由反射器配置两个 IBGP 组 rr,为路由反射器客户端配置rr_client。
[edit protocols] user@RR4# set bgp group rr type internal user@RR4# set bgp group rr local-address 10.0.0.40 user@RR4# set bgp group rr family inet unicast add-path receive user@RR4# set bgp group rr neighbor 10.0.0.10 user@RR4# set bgp group rr_client type internal user@RR4# set bgp group rr_client local-address 10.0.0.40 user@RR4# set bgp group rr_client cluster 10.0.0.40
配置此功能以发送仅包含 4713:100 社区值的多个路径,并将播发的多路径数量限制为 6。
[edit protocols] user@RR4# set bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy addpath-communities-send-4713-100 user@RR4# set bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6
定义一个策略
addpath-community-members 4713:100
以过滤社区值 4713:100 的前缀,并限制设备向路由器 R8 发送多达 16 条路径。此限制将覆盖之前在 BGP 组层次结构级别上配置的 add-path 发送路径计数 6。[edit policy-options] user@RR4# set community addpath-community-members 4713:100 user@RR4# set community addpath-communities-send-4713:100 user@RR4# set policy-statement addpath-communitiesunities-send-4713-100 term term1 from protocol bgp user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 from community addpath-4713-100-community user@RR4# set policy-statement addpath-communitiesunities-send-4713-100 term term1 then add-path send-count 16 user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 then add-path accept
为 BGP 主机配置路由器 ID 和自治系统。
[edit routing-options] user@RR4# set router-id 10.0.0.40 user@RR4# set autonomous-system 64501
结果
在配置模式下,输入 show interfaces、 show protocols、 show routing-options和 show policy-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit] user@RR4# show interfaces ge-1/0/10 { unit 0 { description RR4->RR1; family inet { address 10.0.14.2/24; } } } ge-1/0/11 { unit 0 { description RR4->R8; family inet { address 10.0.48.1/24; } } } lo0 { unit 0 { family inet { address 10.0.0.10/32; } } }
[edit] user@RR4# show protocols bgp { group rr { type internal; local-address 10.0.0.40; family inet { unicast { add-path { receive; } } } neighbor 10.0.0.10; } group rr_client { type internal; local-address 10.0.0.40; cluster 10.0.0.40; neighbor 10.0.0.80 { family inet { unicast { add-path { send { prefix-policy addpath-communities-send-4713-100; path-count 6; } } } } } } } ospf { area 0.0.0.0 { interface ge-1/0/10.0; interface lo0.40 { passive; } interface ge-1/0/11.0; } }
[edit] user@RR4# show policy-options policy-options { policy-statement addpath-communities-send-4713-100 { term term1 { from community addpath-4713-100-community; } } policy-statement addpath-communitiesunities-send-4713-100 { term term1 { from protocol bgp; then { add-path send-count 16; } } } }
[edit] user@RR4# show routing-options router-id 10.0.0.40; autonomous-system 64501;
完成设备配置后,提交配置。
user@RR4# commit
验证
确认配置工作正常。
- 验证多路径路由是否已从路由器 RR4 播发到路由器 R8
- 验证路由器 R8 是否接收路由器 RR4 播发的多路径路由
- 验证路由器 RR4 是否仅向路由器 R8 播发社区值 4713:100 的多路径路由
验证多路径路由是否已从路由器 RR4 播发到路由器 R8
目的
验证路由器 RR4 是否可以向路由器 R8 发送多个路径。
行动
在操作模式下,在 show route advertising-protocol bgp neighbor-address 路由器 RR4 上运行命令。
user@RR4> show route advertising-protocol bgp 10.0.0.80 inet.0: 20 destinations, 23 routes (20 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 198.1.1.1/32 10.0.0.20 100 2 I 10.0.15.2 100 2 2 I * 199.1.1.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I
含义
路由器 RR4 正在向路由器 R8 传播多个路径 10.0.0.20、10.0.0.30 和 10.0.15.2。
验证路由器 R8 是否接收路由器 RR4 播发的多路径路由
目的
验证路由器 R8 是否从路由器 RR4 接收多路径路由。
行动
在操作模式下,在 show route receive-protocol bgp neighbor-address 路由器 R8 上运行命令。
user@R8> show route receive-protocol bgp 10.0.0.40 inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 198.1.1.1/32 10.0.0.20 100 2 I 10.0.15.2 100 2 2 I * 199.1.1.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I
含义
路由器 R8 从路由器 RR4 接收路由 10.0.0.20、10.0.0.30 和 10.0.15.2 的多个下一跃点。
验证路由器 RR4 是否仅向路由器 R8 播发社区值 4713:100 的多路径路由
目的
路由器 RR4 必须将社区值为 4713:100 的多路径路由播发至路由器 R8。
行动
在操作模式下,在 show route 199.1.1.1/32 detail 路由器 RR4 上运行命令。
user@RR4> show route 199.1.1.1/32 detail inet.0: 20 destinations, 23 routes (20 active, 0 holddown, 0 hidden) 199.1.1.1/32 (3 entries, 3 announced) *BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0ea90 Next-hop reference count: 6 Source: 10.0.0.10 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.14.1 via ge-1/0/10.4, selected Session Id: 0x0 Protocol next hop: 10.0.0.20 Indirect next hop: 0xc4091f0 1048581 INH Session ID: 0x0 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 4d 20:56:53 Metric2: 2 Validation State: unverified Task: BGP_1.10.0.0.10 Announcement bits (3): 2-KRT 3-BGP_RT_Background 4-Resolve tree 2 AS path: 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.20 Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 1 BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0eb50 Next-hop reference count: 3 Source: 10.0.0.10 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.14.1 via lt-1/0/10.4, selected Session Id: 0x0 Protocol next hop: 10.0.0.30 Indirect next hop: 0xc409300 1048582 INH Session ID: 0x0 State: <NotBest Int Ext> Inactive reason: Not Best in its group - Router ID Local AS: 1 Peer AS: 1 Age: 4d 20:56:53 Metric2: 2 Validation State: unverified Task: BGP_1.10.0.0.10 Announcement bits (1): 3-BGP_RT_Background AS path: 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.30 Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 2 BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0e9d0 Next-hop reference count: 4 Source: 10.0.0.10 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.14.1 via lt-1/0/10.4, selected Session Id: 0x0 Protocol next hop: 10.0.15.2 Indirect next hop: 0xc4090e0 1048580 INH Session ID: 0x0 State: <Int Ext> Inactive reason: AS path Local AS: 1 Peer AS: 1 Age: 4d 20:56:53 Metric2: 2 Validation State: unverified Task: BGP_1.10.0.0.10 Announcement bits (1): 3-BGP_RT_Background AS path: 2 2 I Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 3
含义
路由器 RR4 正在向路由器 R8 广告三条路径,其社区值为 4713:100。
通过 BGP 多路径配置递归解析
从 Junos OS 17.3R1 版开始,当具有单个协议下一跃点的 BGP 前缀通过具有多个解析路径(单列表)的另一个 BGP 前缀解析时,所有路径均被选中用于协议下一跃点解析。在早期 Junos OS 版本中,只有一条路径被选择用于协议下一跃点解析,因为解析器不支持跨 IBGP 多路径路由的所有路径进行负载平衡。路由协议进程 (rpd) 中的解析器将协议下一跃点地址 (PNH) 解析为立即转发的下一跃点。BGP 递归解析功能增强了解析器,以解析 IBGP 多路径路由上的路由,并将所有可行路径用作下一跃点。此功能有利于密集连接的网络,其中 BGP 用于建立基础架构连接,例如采用高等价多路径和无缝 MPLS 拓扑的 WAN 网络。
开始配置 BGP 多路径的递归解析之前,必须请执行以下操作:
配置设备接口。
配置 OSPF 或任何其他 IGP 协议。
配置 MPLS 和 LDP。
配置 BGP。
要配置多路径的递归解析
另请参阅
为 RSVP 和 LDP LSP 配置 ECMP 下一跳,以实现负载平衡
Junos OS 通过增强型 CFEB、M320、M120、MX 系列和 T 系列路由器以及路由设备,支持在 M10i 路由器上为 RSVP 和 LDP LSP 配置 16、32 或 64 个等价多路径 (ECMP) 下一跃点。对于具有大容量流量的网络,这提供了更大的灵活性,可以跨多达 64 个 LSP 实现流量负载均衡。
要配置 ECMP 下一跃点的最大限制,请在 maximum-ecmp next-hops
层级添加语句 [edit chassis]
:
[edit chassis] maximum-ecmp next-hops;
您可以使用此语句配置 ECMP 下一跃点的最大限制 16、32 或 64。默认限制为 16。
MX 系列路由器具有一个或多个模块化端口集中器 (MPC) 卡,并且安装了 Junos OS 11.4 或更低版本,仅支持 16 个下一跃点来支持语句的配置 maximum-ecmp
。不应为maximum-ecmp
语句配置 32 个或 64 个下一跃点。使用 32 个或 64 个下一跃点提交配置时,将显示以下警告消息:
Error: Number of members in Unilist NH exceeds the maximum supported 16 on Trio.
以下类型的路由支持多达 64 个 ECMP 网关的 ECMP 最大下一跃点配置:
带有直接和间接下一跳 ECMP 的静态 IPv4 和 IPv6 路由
通过关联的 IGP 路由学习的 LDP 入口和传输路由
为 LSP 创建的 RSVP ECMP 下一跳
OSPF IPv4 和 IPv6 路由 ECMP
IS-IS IPv4 和 IPv6 路由 ECMP
EBGP IPv4 和 IPv6 路由 ECMP
IBGP(通过 IGP 路由解析)IPv4 和 IPv6 路由 ECMP
最多 64 个 ECMP 下一跃点的增强型 ECMP 限制也适用于通过 MPLS 路由解析的第 3 层 VPN、第 2 层 VPN、第 2 层电路和 VPLS 服务,因为 MPLS 路由中的可用 ECMP 路径也可供此类流量使用。
M320、T640 和 T1600 路由器上的以下 FPC 仅支持 16 个 ECMP 下一跃点:
(仅限 M320、T640 和 T1600 路由器)增强型 II FPC1
(仅限 M320、T640 和 T1600 路由器)增强型 II FPC2
(仅限 M320 和 T640 路由器)增强型 II FPC3
(仅限 T640 和 T1600 路由器)FPC2
(仅限 T640 和 T1600 路由器)FPC3
如果安装了 M320、T640 或 T1600 路由器上的最大 ECMP 下一跃点限制 32
或 64
配置了其中任何一个 FPC,则这些 FPC 上的数据包转发引擎仅使用前 16 个 ECMP 下一跃点。对于仅支持 16 个 ECMP 下一跃点的 FPC 上的数据包转发引擎,如果 ECMP 下一跃点的最大限制 32
或 64
配置了 Junos OS 将生成系统日志消息。但是,对于路由器上安装的其他 FPC 上的数据包转发引擎,则适用配置的最大 ECMP 限制 32
或 64
ECMP 下一跃点数。
如果为 RSVP LSP 配置了带宽分配,则对于包含超过 16 个 LSP 的 ECMP 下一跃点,流量不会根据配置的带宽进行优化分布。分配带宽较小的 LSP 接收的流量比配置带宽较高的 LSP 更多的流量。流量分配未严格遵守配置的带宽分配。此警告适用于以下路由器:
具有增强型扩展 FPC1、增强型 FPC2、增强型扩展 FPC3、增强型扩展 FPC 4 和所有 4 类 FPC 的 T1600 和 T640 路由器
具有增强型 III FPC1、增强型 III FPC2 和增强型 III FPC3 的 M320 路由器
具有所有类型的 FPC 和 DPC 的 MX 系列路由器,不包括 MPC。此警告 不适用于 具有基于 Junos Trio 芯片组的线卡的 MX 系列路由器。
具有 1 类、2 类和 3 类 FPC 的 M120 路由器
具有增强型 CFEB 的 M10i 路由器
支持增强负载平衡功能的 T 系列 FPC(增强型扩展 FPC1、增强型扩展 FPC2、增强型扩展 FPC3 和增强型扩展 FPC 4)的 T 系列路由器上禁用下一跳克隆和排列。因此,在 ECMP 或聚合接口上具有大量下一跃点的高规模系统中,内存利用率得到了降低。带有 4 类 FPC 的 T 系列路由器上也禁用下一跳克隆和排列。
要查看 ECMP 下一跃点的详细信息,请发出 show route
命令。还会 show route summary command
显示 ECMP 最大限制的当前配置。要查看 ECMP LDP 路径的详细信息,请发出 traceroute mpls ldp
命令。
另请参阅
为 ECMP 组配置一致的负载平衡
基于数据包的负载平衡允许您跨多个等价路径传播流量。默认情况下,当一个或多个路径发生故障时,散列算法会重新计算所有路径的下一跃点,通常会导致所有流的重新分配。通过一致的负载平衡 ,您可以覆盖此行为,以便仅重定向非活动链路的流。所有现有活动流均得到维护,不会中断。在数据中心环境中,链路发生故障时重新分配所有流量可能会导致大量流量丢失或服务损失,这些服务器的链路保持活动。一致的负载平衡可维护所有活动链路,而只会重新映射受一个或多个链路故障影响的流。此功能可确保连接到保持活动链路的流继续不中断。
此功能适用于等价多路径 (ECMP) 组的成员是单跳 BGP 会话中外部 BGP 邻接方拓扑。当您添加新 ECMP 路径或以任何方式修改现有路径时,一致的负载平衡都不适用。要尽可能减少新路径的中断,请定义一个新的 ECMP 组,而无需修改现有路径。这样,客户端就可以逐渐移动到新的组,而无需终止现有连接。
(在 MX 系列上)仅支持模块化端口集中器 (MPC)。
同时支持 IPv4 和 IPv6 路径。
此外,还支持属于虚拟路由和转发 (VRF) 实例或其他路由实例的 ECMP 组。
不支持组播流量。
支持聚合接口,但不支持在链路聚合 (LAG) 捆绑包的成员之间实现一致的负载平衡。当一个或多个成员链路出现故障时,LAG 捆绑包中活动成员的流量可能会移动到另一个活动成员。当一个或多个 LAG 成员链路出现故障时,流被重新加密。
我们强烈建议将一致的负载平衡应用于每个路由器或交换机最多 1,000 个 IP 前缀。
支持集成路由和桥接 (IRB) 接口上的第 3 层邻接。
您可以配置 BGP add-path 功能,当 ECMP 组中的一个或多个路径出现故障时,可以使用新的活动路径替换故障路径。配置故障路径替换可确保仅重定向失败路径上的流量。活动路径上的流量将保持不变。
在通用路由封装 (GRE) 隧道接口上配置一致负载平衡时,必须指定远端 GRE 接口的 inet 地址,以便转发表中正确安装 GRE 隧道接口上的第 3 层邻接。但是,在一致的负载平衡期间,不支持通过 GRE 隧道接口实现 ECMP 快速重新路由 (FRR)。您可以指定在层次结构级别上配置了一致负载平衡的
[edit interfaces interface name unit unit name family inet address address]
路由器上的目标地址。例如:[edit interfaces] user@host# set interfaces gr-4/0/0 unit 21 family inet address 10.10.31.2/32 destination 10.10.31.1
有关通用路由封装的详细信息,请参阅 配置通用路由封装隧道。
一致的负载平衡不支持 EBGP 邻接方采用 BGP 多跳。因此,请勿在
multihop
配置了一致负载平衡的设备上启用选项。
要为 ECMP 组配置一致的负载平衡:
另请参阅
了解 BGP 标记的单播 LSP 的平均信息量标签
什么是平均信息量标签?
平均信息量标签是一种特殊的负载平衡标签,可增强路由器跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 实现流量负载平衡的能力。平均信息量标签允许路由器仅使用标签堆栈而非深度包检测 (DPI) 有效地平衡流量负载。DPI 需要更多路由器的处理能力,并不是所有路由器共享的功能。
当一个 IP 数据包有多个路径要到达其目标时,Junos OS 会使用数据包标头的某些字段将数据包散列到确定性路径。数据包的源或目标地址和端口号用于散列,以避免对给定流进行数据包重新排序。如果核心标签交换路由器 (LSR) 无法执行 DPI 来识别流,或者无法以线速这样做,则标签堆栈单独用于 ECMP 散列。这需要一个平均信息标签,这是一个特殊的负载平衡标签,可以承载流信息。与传输 LSR 相比,入口 LSR 具有更多的有关传入数据包的上下文和信息。因此,入口标签边缘路由器 (LER) 可以检查数据包的流信息,将其映射到平均信息量标签,并将其插入标签堆栈中。核心中的 LSR 只需使用平均信息量标签作为密钥,即可将数据包散列到正确的路径。
平均信息量标签可以是 16 到 1048575(常规 20 位标签范围)之间的任意标签值。由于此范围与现有常规标签范围重叠,因此在平均信息量标签之前插入一个名为平均信息量标签指示 (ELI) 的特殊标签。ELI 是 IANA 分配的一个特殊标签,值为 7。
图 9 对 RSVP 标签交换路径 (LSP) 数据包标签堆栈中的平均信息量标签进行了说明。标签堆栈由平均信息量标签指示器 (ELI)、平均信息量标签和 IP 数据包组成。

BGP 标记单播的平均信息量标签
BGP 标记的单播跨多个内部网关协议 (IGP) 区域或多个自治系统(间 AS LSP)连接 RSVP 或 LDP LSP。当入口 ES 和出口 E 位于不同的 IGP 区域时,区域间 BGP 标记的单播 LSP 通常携带 VPN 和 IP 流量。当 BGP 标记的单播连接 RSVP 或 LDP LSP 时,Junos OS 会将平均信息量标签插入到 BGP 标记的单播 LSP 入口处,以实现端到端平均信息量标签负载平衡。这是因为,RSVP 或 LDP 平均信息量标签通常与 RSVP 或 LDP 标签一起在倒数第二跃点弹出,拼接点上没有平均信息量标签,即两个区域或两个 AS 之间的路由器。因此,在没有平均信息量标签的情况下,拼接点上的路由器使用 BGP 标签转发数据包。 图 10 展示了在 RSVP 标签堆栈中带有平均信息量标签的 BGP 标记单播数据包标签堆栈。RSVP 标签堆栈由平均信息量标签指示 (ELI)、平均信息量标签、BGP 标签和 IP 数据包组成。RSVP 平均信息量标签在倒数第二跃点节点上弹出。

BGP 标签单播拼接节点不能使用平均信息量标签来实现负载平衡,除非拼接节点在 BGP 出口处发出平均信息量标签功能的信号。如果 BGP 标记的单播拼接节点向提供商边缘路由器发出 BGP 平均信息量标签功能 (ELC),则 BGP 标记的单播 LSP 入口会知道 BGP 标记的单播 LSP 出口可以处理平均信息量标签,并在 BGP 标签下插入平均信息量标签指示和平均信息量标签。所有 LSR 都能够使用平均信息量标签来实现负载平衡。BGP 标签单播 LSP 可能会跨越不同区域和 AS 中的许多路由器,但某些分段可能支持平均信息量标签,而其他分段可能不支持。 图 11 展示了 BGP 标签堆栈中的平均信息量标签。拼接节点的标签堆栈由 ELI、平均信息量标签和 IP 数据包组成。

要对出口节点上的 BGP 标记单播禁用平均信息量标签功能,请在层次结构级别使用选项no-entropy-label-capability
[edit policy-options policy-statement policy-name then]
定义一个策略。
[edit policy-options policy-statement policy-name then]
user@PE#no-entropy-label-capability
默认情况下,支持平均信息量标签的路由器在[edit forwarding-options]
层次结构级别上配置了 load-balance-label-功能语句,以便按 per-LSP 向标签发出信号。如果对等路由器无法处理负载平衡标签,则可以通过在层次结构级别配置 no-load-balance-label-capability
语句 [edit forwarding-options]
来防止平均信息量标签功能的信令。
[edit forwarding-options]
user@PE#no-load-balance-label-capability
支持和不支持的功能
Junos OS 在以下情况下支持 BGP 标记单播的平均信息量标签:
LSP 的所有节点都有平均信息量标签功能。
LSP 的某些节点具有平均信息量标签功能。
通过另一运营商 VPN 的 LSP 隧道。
定义入口策略以选择 BGP 标记的单播 LSP 子集,在入口处插入平均信息量标签。
定义出口策略以禁用平均信息量标签功能播发。
Junos OS 不支持 BGP 标记单播的平均信息量标签的以下功能:
当 BGP 标签单播 LSP 通过其他运营商的 VPN 建立隧道时,不存在真正的端到端平均信息量标签,因为 Junos OS 不会在运营商网络的 VPN 标签下插入平均信息量标签指示符或平均信息量标签。
目前,Junos OS 不支持 IPv6 BGP 标记的单播 LSP 及其自己的平均信息量标签。但是,IPv6 BGP 标记的单播 LSP 可能会使用来自底层 RSVP、LDP 或 BGP LSP 的平均信息量标签。
另请参阅
为 BGP 标记的单播 LSP 配置平均信息量标签
为 BGP 标记的单播 LSP 配置平均信息量标签,以实现端到端平均信息量标签负载平衡。平均信息量标签是一个特殊的负载平衡标签,可以承载数据包的流信息。BGP 标记的单播通常跨多个 IGP 区域或多个自治系统 (AS) 连接 RSVP 或 LDP LSP。RSVP 或 LDP 平均信息量标签与 RSVP 或 LDP 标签一起在倒数第二跃点节点上弹出。此功能允许在拼接点(即两个区域或 AS 之间的路由器)使用平均信息量标签,以实现 BGP 流量的端到端平均信息量标签负载平衡。此功能允许在 BGP 标记的单播 LSP 入口处插入平均信息量标签。
平均信息量标签可以是 16 到 1048575(常规 20 位标签范围)之间的任意标签值。由于此范围与现有常规标签范围重叠,因此在平均信息量标签之前插入一个名为平均信息量标签指示 (ELI) 的特殊标签。ELI 是 IANA 分配的一个特殊标签,值为 7。
为 BGP 标记的单播配置平均信息量标签之前,请确保您:
配置设备接口。
配置 OSPF 或任何其他 IGP 协议。
配置 BGP。
配置 LDP。
配置 RSVP。
配置 MPLS。
要为 BGP 标记的单播 LSP 配置平均信息量标签:
另请参阅
示例:为 BGP 标记的单播 LSP 配置平均信息量标签
此示例说明如何为 BGP 标记的单播配置平均信息量标签,以便使用平均信息量标签实现端到端负载平衡。当一个 IP 数据包有多个路径要到达其目标时,Junos OS 会使用数据包标头的某些字段将数据包散列到确定性路径。这需要一个平均信息标签,这是一个特殊的负载平衡标签,可以承载流信息。核心中的 LSR 只需使用平均信息量标签作为密钥,即可将数据包散列到正确的路径。平均信息量标签可以是 16 到 1048575(常规 20 位标签范围)之间的任意标签值。由于此范围与现有常规标签范围重叠,因此在平均信息量标签之前插入一个名为平均信息量标签指示 (ELI) 的特殊标签。ELI 是 IANA 分配的一个特殊标签,值为 7。
BGP 标记的单播通常跨多个 IGP 区域或多个自治系统连接 RSVP 或 LDP LSP。RSVP 或 LDP 平均信息量标签与 RSVP 或 LDP 标签一起在倒数第二跃点节点上弹出。此功能允许在拼接点使用平均信息量标签,以弥合倒数第二跳节点与拼接点之间的差距,以实现 BGP 流量的端到端平均信息量标签负载平衡。
要求
此示例使用以下硬件和软件组件:
7 个带有 MPC 的 MX 系列路由器
在所有设备上运行的 Junos OS 15.1 或更高版本
为 BGP 标记的单播配置平均信息量标签之前,请确保您:
配置设备接口。
配置 OSPF 或任何其他 IGP 协议。
配置 BGP。
配置 RSVP。
配置 MPLS。
概述
当 BGP 标记的单播跨多个 IGP 区域或多个自治系统连接 RSVP 或 LDP LSP 时,RSVP 或 LDP 平均信息量标签会与 RSVP 或 LDP 标签一起在倒数第二跃点节点上弹出。但是,拼接点(即两个区域之间的路由器)没有平均信息量标签。因此,拼接点的路由器使用 BGP 标签来转发数据包。
从 Junos OS 15.1 版开始,您可以为 BGP 标记的单播配置平均信息量标签,以实现端到端平均信息量标签负载平衡。此功能允许在拼接点使用平均信息量标签,以实现 BGP 流量的端到端平均信息量标签负载平衡。Junos OS 允许在 BGP 标记的单播 LSP 入口处插入平均信息量标签。
默认情况下,支持平均信息量标签的路由器在[edit forwarding-options]
层次结构级别上配置语句load-balance-label-capability
,以便按每 LSP 向标签发出信号。如果对等路由器未配备来处理负载平衡标签的能力,则可以通过在[edit forwarding-options]
层次结构级别上配置no-load-balance-label-capability
平均信息量标签功能来防止信令发出。
[edit forwarding-options]
user@PE#no-load-balance-label-capability
您可以使用层次结构级别的选项[edit policy-options policy-statement policy name then]
在策略no-entropy-label-capability
中指定的路由的出口处显式禁用广告平均信息量标签功能。
[edit policy-options policy-statement policy-name then]
user@PE#no-entropy-label-capability
拓扑
在 图 12 中,路由器 PE1 是入口路由器,路由器 PE2 是出口路由器。路由器 P1 和 P2 是传输路由器。路由器 ABR 是区域 0 和区域 1 之间的区域网桥路由器。在提供商路由器上配置 LAG,以平衡流量负载。入口路由器 PE1 上启用了 BGP 标记单播的平均信息量标签功能。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit] CLI 中,然后从配置模式进入 commit
。
路由器 PE1
set interfaces ge-0/0/0 unit 0 family inet address 1.5.0.1/24 set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/0 unit 0 family inet6 address 2000::1:5:0:1/120 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 family inet address 1.1.0.1/24 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family inet6 address 2000::1:1:0:1/120 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 unit 0 family inet address 50.0.1.1/24 set interfaces ge-0/0/2 unit 0 family inet6 address 2000::1:34:0:2/120 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 520 set interfaces ge-0/0/3 unit 0 family inet address 1.0.0.2/16 set interfaces lo0 unit 0 family inet address 10.255.101.100/32 primary set routing-options router-id 10.255.101.100 set routing-options autonomous-system 1 set protocols rsvp interface all set protocols mpls icmp-tunneling set protocols mpls no-cspf set protocols mpls label-switched-path r0-r2 to 10.255.102.102 set protocols mpls label-switched-path r0-r2 entropy-label set protocols mpls interface all set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 10.255.101.100 set protocols bgp group ibgp family inet labeled-unicast entropy-label set protocols bgp group ibgp neighbor 10.255.102.102 family inet labeled-unicast rib inet.3 set protocols bgp group ibgp neighbor 10.255.101.200 family inet-vpn unicast set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface fxp0.0 disable set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options prefix-list el-fec 10.255.101.200/32 set policy-options prefix-list el-fec-2 10.255.102.102/32 set policy-options policy-statement EL from prefix-list el-fec set policy-options policy-statement EL then accept set policy-options policy-statement EL-2 from prefix-list el-fec-2 set policy-options policy-statement EL-2 then accept set policy-options policy-statement bgp-to-ospf from protocol bgp set policy-options policy-statement bgp-to-ospf then accept set policy-options policy-statement ospf-to-bgp from protocol ospf set policy-options policy-statement ospf-to-bgp then accept set policy-options policy-statement stat-to-bgp from protocol static set policy-options policy-statement stat-to-bgp then accept set policy-options community VPN members target:100:1 set routing-instances VPN-l3vpn instance-type vrf set routing-instances VPN-l3vpn interface ge-0/0/2.0 set routing-instances VPN-l3vpn interface ge-0/0/3.0 set routing-instances VPN-l3vpn route-distinguisher 100.100.100.100:100 set routing-instances VPN-l3vpn vrf-target target:100:1 set routing-instances VPN-l3vpn routing-options static route 5.0.0.0/16 next-hop 1.0.0.1 set routing-instances VPN-l3vpn protocols ospf export bgp-to-ospf set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface ge-0/0/2.0
路由器 P1
set interfaces ge-0/0/0 unit 0 family inet address 1.5.0.2/24 set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/0 unit 0 family inet6 address 2000::1:5:0:2/120 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 gigether-options 802.3ad ae0 set interfaces ge-0/0/2 unit 0 family inet address 1.1.0.2/24 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family inet6 address 2000::1:1:0:2/120 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 gigether-options 802.3ad ae0 set interfaces ae0 unit 0 family inet address 1.12.0.1/24 set interfaces ae0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.102.101/32 primary set forwarding-options hash-key family mpls label-1 set forwarding-options hash-key family mpls label-2 set forwarding-options hash-key family mpls label-3 set forwarding-options enhanced-hash-key family mpls no-payload set routing-options router-id 10.255.102.101 set routing-options autonomous-system 1 set routing-options forwarding-table export pplb set protocols rsvp interface all set protocols mpls icmp-tunneling set protocols mpls interface all set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface fxp0.0 disable set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 set policy-options policy-statement pplb then load-balance per-packet
路由器 ABR
set interfaces ge-0/0/0 gigether-options 802.3ad ae0 set interfaces ge-0/0/1 gigether-options 802.3ad ae1 set interfaces ge-0/0/2 gigether-options 802.3ad ae0 set interfaces ge-0/0/3 gigether-options 802.3ad ae1 set interfaces ae0 unit 0 family inet address 1.12.0.2/24 set interfaces ae0 unit 0 family mpls set interfaces ae1 unit 0 family inet address 1.23.0.1/24 set interfaces ae1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.102.102/32 primary set forwarding-options hash-key family mpls label-1 set forwarding-options hash-key family mpls label-2 set forwarding-options hash-key family mpls label-3 set forwarding-options enhanced-hash-key family mpls no-payload set routing-options router-id 10.255.102.102 set routing-options autonomous-system 1 set routing-options forwarding-table export pplb set protocols rsvp interface all set protocols mpls icmp-tunneling set protocols mpls label-switched-path r2-r0 to 10.255.101.100 set protocols mpls label-switched-path r2-r0 entropy-label set protocols mpls label-switched-path r2-r4 to 10.255.101.200 set protocols mpls label-switched-path r2-r4 entropy-label set protocols mpls interface all set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 10.255.102.102 set protocols bgp group ibgp family inet labeled-unicast rib inet.3 set protocols bgp group ibgp neighbor 10.255.101.100 export send-inet3-R4 set protocols bgp group ibgp neighbor 10.255.101.200 export send-inet3-R0 set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface ae0.0 set protocols ospf area 0.0.0.0 interface fxp0.0 disable set protocols ospf area 0.0.0.1 interface ge-0/0/3.0 set protocols ospf area 0.0.0.1 interface ge-0/0/1.0 set protocols ospf area 0.0.0.1 interface ae1.0 set protocols ldp interface all set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement send-inet3-R0 from route-filter 10.255.101.100/32 exact set policy-options policy-statement send-inet3-R0 then accept set policy-options policy-statement send-inet3-R4 from route-filter 10.255.101.200/32 exact set policy-options policy-statement send-inet3-R4 then accept
路由器 P2
set chassis aggregated-devices ethernet device-count 3 set interfaces ge-0/0/0 gigether-options 802.3ad ae0 set interfaces ge-0/0/1 unit 0 family inet address 1.34.0.1/24 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family inet6 address 2000::1:34:0:1/120 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 gigether-options 802.3ad ae0 set interfaces ae1 unit 0 family inet address 1.23.0.2/24 set interfaces ae1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.102.103/32 primary set forwarding-options enhanced-hash-key family mpls no-payload set routing-options router-id 10.255.102.103 set routing-options autonomous-system 1 set routing-options forwarding-table export pplb set protocols rsvp interface all set protocols mpls icmp-tunneling set protocols mpls interface all set protocols ospf traffic-engineering set protocols ospf area 0.0.0.1 interface lo0.0 passive set protocols ospf area 0.0.0.1 interface fxp0.0 disable set protocols ospf area 0.0.0.1 interface all set policy-options policy-statement pplb then load-balance per-packet
路由器 PE2
set interfaces ge-0/0/0 unit 0 family inet address 1.34.0.2/24 set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/0 unit 0 family inet6 address 2000::1:34:0:2/120 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 520 set interfaces ge-0/0/1 unit 0 family inet address 2.0.0.2/16 set interfaces ge-0/0/2 unit 0 family inet address 50.4.1.1/24 set interfaces ge-0/0/2 unit 0 family inet6 address 2000::1:34:0:2/120 set interfaces lo0 unit 0 family inet address 10.255.101.200/32 primary set routing-options router-id 10.255.101.200 set routing-options autonomous-system 1 set protocols rsvp interface all set protocols mpls icmp-tunneling set protocols mpls no-cspf set protocols mpls label-switched-path r4-r2 to 10.255.102.102 set protocols mpls label-switched-path r4-r2 entropy-label set protocols mpls interface all set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 10.255.101.200 set protocols bgp group ibgp neighbor 10.255.102.102 family inet labeled-unicast rib inet.3 set protocols bgp group ibgp neighbor 10.255.101.100 family inet-vpn unicast set protocols ospf traffic-engineering set protocols ospf area 0.0.0.1 interface all set protocols ospf area 0.0.0.1 interface fxp0.0 disable set protocols ospf area 0.0.0.1 interface lo0.0 passive set policy-options prefix-list el-fec 10.255.101.100/32 set policy-options policy-statement EL term el from prefix-list el-fec set policy-options policy-statement EL term el then accept set policy-options policy-statement bgp-to-ospf from protocol bgp set policy-options policy-statement bgp-to-ospf then accept set policy-options policy-statement ospf-to-bgp from protocol ospf set policy-options policy-statement ospf-to-bgp then accept set policy-options policy-statement stat-to-bgp from protocol static set policy-options policy-statement stat-to-bgp then accept set policy-options community VPN members target:100:1 set routing-instances VPN-l3vpn instance-type vrf set routing-instances VPN-l3vpn interface ge-0/0/1.0 set routing-instances VPN-l3vpn interface ge-0/0/2.0 set routing-instances VPN-l3vpn route-distinguisher 100.100.100.100:104 set routing-instances VPN-l3vpn vrf-target target:100:1 set routing-instances VPN-l3vpn routing-options static route 6.0.0.0/16 next-hop 2.0.0.1 set routing-instances VPN-l3vpn protocols ospf export bgp-to-ospf set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface ge-0/0/2.0 set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface ge-0/0/1.0
配置路由器 PE1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用CLI 编辑器。
要配置路由器 PE1:
修改相应的接口名称、地址和其他参数后,对路由器 PE2 重复此过程。
使用 IPv4 和 IPv6 地址配置接口。
[edit interfaces] user@PE1# set ge-0/0/0 unit 0 family inet address 1.5.0.1/24 user@PE1# set ge-0/0/0 unit 0 family iso user@PE1# set ge-0/0/0 unit 0 family inet6 address 2000::1:5:0:1/120 user@PE1# set ge-0/0/0 unit 0 family mpls user@PE1# set ge-0/0/1 unit 0 family inet address 1.1.0.1/24 user@PE1# set ge-0/0/1 unit 0 family iso user@PE1# set ge-0/0/1 unit 0 family inet6 address 2000::1:1:0:1/120 user@PE1# set ge-0/0/1 unit 0 family mpls user@PE1# set ge-0/0/2 unit 0 family inet address 50.0.1.1/24 user@PE1# set ge-0/0/2 unit 0 family inet6 address 2000::1:34:0:2/120 user@PE1# set ge-0/0/3 vlan-tagging user@PE1# set ge-0/0/3 unit 0 vlan-id 520 user@PE1# set ge-0/0/3 unit 0 family inet address 1.0.0.2/16
配置环路接口。
[edit interfaces] user@PE1# set lo0 unit 0 family inet address 10.255.101.100/32 primary
设置路由器 ID 和自治系统编号。
[edit routing-options] user@PE1# set router-id 10.255.101.100 user@PE1# set autonomous-system 1
为所有接口配置 RSVP 协议。
[edit protocols] user@PE1# set protocols rsvp interface all
在路由器 PE1 的所有接口上启用 MPLS 并指定 LSP。
[edit protocols] user@PE1# set mpls icmp-tunneling user@PE1# set mpls no-cspf user@PE1# set mpls label-switched-path r0-r2 to 10.255.102.102 user@PE1# set mpls label-switched-path r0-r2 entropy-label user@PE1# set mpls interface all
在内部路由器上配置 IBGP。
[edit protocols] user@PE1# set bgp group ibgp type internal user@PE1# set bgp group ibgp local-address 10.255.101.100
为内部 BGP 组 ibgp 的 BGP 标记单播启用平均信息量标签功能。
user@PE1# set bgp group ibgp family inet labeled-unicast entropy-label user@PE1# set bgp group ibgp neighbor 10.255.102.102 family inet labeled-unicast rib inet.3 user@PE1# set bgp group ibgp neighbor 10.255.101.200 family inet-vpn unicast
在区域边界路由器 (ABR) 的所有接口上启用 OSPF 协议。
[edit protocols] user@PE1# set ospf traffic-engineering user@PE1# set ospf area 0.0.0.0 interface all user@PE1# set ospf area 0.0.0.0 interface fxp0.0 disable user@PE1# set ospf area 0.0.0.0 interface lo0.0 passive
定义前缀列表以指定具有平均信息量标签功能的路由。
[edit policy-options ] user@PE1# set policy-options prefix-list el-fec 10.255.101.200/32 user@PE1# set policy-options prefix-list el-fec-2 10.255.102.102/32
定义策略 EL 以指定具有平均信息量标签功能的路由。
[edit policy-options ] user@PE1# set policy-statement EL from prefix-list el-fec user@PE1# set policy-statement EL then accept
定义另一个策略 EL-2 以指定具有平均信息量标签功能的路由。
[edit policy-options ] user@PE1# set policy-statement EL-2 from prefix-list el-fec-2 user@PE1# set policy-statement EL-2 then accept
定义将 BGP 路由导出到 OSPF 路由表的策略。
[edit policy-options ] user@PE1# set policy-statement bgp-to-ospf from protocol bgp user@PE1# set policy-statement bgp-to-ospf then accept
定义将 OSPF 路由导出到 BGP 路由表的策略。
[edit policy-options ] user@PE1# set policy-statement ospf-to-bgp from protocol ospf user@PE1# set policy-statement ospf-to-bgp then accept
定义将静态路由导出到 BGP 路由表的策略。
[edit policy-options ] user@PE1# set policy-statement stat-to-bgp from protocol static user@PE1# set policy-statement stat-to-bgp then accept
为 VPN 社区配置 VPN 目标。
[edit policy-options ] user@PE1# set community VPN members target:100:1
配置第 3 层 VPN 路由实例 VPN-l3vpn。
[edit routing-instances] user@PE1# set VPN-l3vpn instance-type vrf
为 VPN-l3vpn 路由实例分配接口。
[edit routing-instances] user@PE1# set VPN-l3vpn interface ge-0/0/2.0 user@PE1# set VPN-l3vpn interface ge-0/0/3.0
为 VPN-l3vpn 路由实例配置路由识别器。
[edit routing-instances] user@PE1# set VPN-l3vpn route-distinguisher 100.100.100.100:100
为 VPN-l3vpn 路由实例配置 VPN 路由和转发 (VRF) 目标。
[edit routing-instances] user@PE1# set VPN-l3vpn vrf-target target:100:1
使用 VPN-l3vpn 路由实例的第 3 层 VPN 协议,配置到设备 CE1 的静态路由。
[edit routing-instances] user@PE1# set VPN-l3vpn routing-options static route 5.0.0.0/16 next-hop 1.0.0.1
将 BGP 路由导出到 VPN-l3vpn 路由实例的 OSPF 路由表。
[edit routing-instances] user@PE1# set VPN-l3vpn protocols ospf export bgp-to-ospf
为 VPN-l3vpn 路由实例分配 OSPF 接口。
[edit routing-instances] user@PE1# set VPN-l3vpn protocols ospf area 0.0.0.0 interface ge-0/0/2.0
配置路由器 P1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用CLI 编辑器。
要配置路由器 P1:
修改相应的接口名称、地址和其他参数后,对路由器 P2 重复此过程。
使用 IPv4 和 IPv6 地址配置接口。
[edit interfaces] user@P1# set ge-0/0/0 unit 0 family inet address 1.5.0.2/24 user@P1# set ge-0/0/0 unit 0 family iso user@P1# set ge-0/0/0 unit 0 family inet6 address 2000::1:5:0:2/120 user@P1# set ge-0/0/0 unit 0 family mpls user@P1# set ge-0/0/2 unit 0 family inet address 1.1.0.2/24 user@P1# set ge-0/0/2 unit 0 family iso user@P1# set ge-0/0/2 unit 0 family inet6 address 2000::1:1:0:2/120 user@P1# set ge-0/0/2 unit 0 family mpls user@P1# set ge-0/0/1 gigether-options 802.3ad ae0 user@P1# set ge-0/0/3 gigether-options 802.3ad ae0
在接口上配置链路聚合。
user@P1# set ae0 unit 0 family inet address 1.12.0.1/24 user@P1# set ae0 unit 0 family mpls
配置环路接口。
[edit interfaces] user@P1# set lo0 unit 0 family inet address 10.255.102.101/32 primary
配置路由器用于将数据包散列到其目标位置以实现负载平衡的 MPLS 标签。
[edit forwarding-options] user@P1# set hash-key family mpls label-1 user@P1# set hash-key family mpls label-2 user@P1# set hash-key family mpls label-3 user@P1# set enhanced-hash-key family mpls no-payload
设置路由器 ID 和自治系统编号。
[edit routing-options] user@P1# set router-id 10.255.102.101 user@P1# set autonomous-system 1
按数据包启用负载平衡。
[edit routing-options] user@P1# set forwarding-table export pplb
为所有接口配置 RSVP 协议。
[edit protocols] user@P1# set protocols rsvp interface all
在路由器 P1 的所有接口上启用 MPLS 并指定 LSP。
[edit protocols] user@P1# set protocols mpls icmp-tunneling user@P1# set protocols mpls interface all
在路由器 P1 的所有接口(不包括管理接口)上启用 OSPF 协议。
[edit protocols] user@P1# set protocols ospf traffic-engineering user@P1# set protocols ospf area 0.0.0.0 interface lo0.0 passive user@P1# set protocols ospf area 0.0.0.0 interface fxp0.0 disable user@P1# set protocols ospf area 0.0.0.0 interface all user@P1# set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 user@P1# set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
为每个数据包负载平衡定义一个策略。
[edit policy-options]] user@P1# set policy-statement pplb then load-balance per-packet
配置路由器 ABR
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用CLI 编辑器。
要配置路由器 ABR:
使用 IPv4 和 IPv6 地址配置接口。
[edit interfaces] user@ABR# set ge-0/0/0 gigether-options 802.3ad ae0 user@ABR# set ge-0/0/1 gigether-options 802.3ad ae1 user@ABR# set ge-0/0/2 gigether-options 802.3ad ae0 user@ABR# set ge-0/0/3 gigether-options 802.3ad ae1
配置环路接口。
[edit interfaces] user@ABR# set lo0 unit 0 family inet address 10.255.102.102/32 primary
在接口上配置链路聚合。
[edit interfaces] user@ABR# set ae0 unit 0 family inet address 1.12.0.2/24 user@ABR# set ae0 unit 0 family mpls user@ABR# set ae1 unit 0 family inet address 1.23.0.1/24 user@ABR# set ae1 unit 0 family mpls
配置路由器用于将数据包散列到其目标位置以实现负载平衡的 MPLS 标签。
[edit forwarding-options] user@ABR# set hash-key family mpls label-1 user@ABR# set hash-key family mpls label-2 user@ABR# set hash-key family mpls label-3 user@ABR# set enhanced-hash-key family mpls no-payload
设置路由器 ID 和自治系统编号。
[edit routing-options] user@ABR# set router-id 10.255.102.102 user@ABR# set autonomous-system 1
按数据包启用负载平衡。
[edit routing-options] user@ABR# set forwarding-table export pplb
为所有接口配置 RSVP 协议。
[edit protocols] user@ABR# set protocols rsvp interface all
在路由器 P1 的所有接口上启用 MPLS 并指定 LSP。
[edit protocols] user@ABR# set mpls icmp-tunneling user@ABR# set mpls label-switched-path r2-r0 to 10.255.101.100 user@ABR# set mpls label-switched-path r2-r0 entropy-label user@ABR# set mpls label-switched-path r2-r4 to 10.255.101.200 user@ABR# set mpls label-switched-path r2-r4 entropy-label user@ABR# set mpls interface all
在内部路由器上配置 IBGP。
[edit protocols ] user@ABR# set bgp group ibgp type internal user@ABR# set bgp group ibgp local-address 10.255.102.102 user@ABR# set bgp group ibgp family inet labeled-unicast rib inet.3 user@ABR# set bgp group ibgp neighbor 10.255.101.100 export send-inet3-R4 user@ABR# set bgp group ibgp neighbor 10.255.101.200 export send-inet3-R0
在 ABR 的所有接口上启用 OSPF 协议。
[edit protocols ] user@ABR# set ospf traffic-engineering user@ABR# set ospf area 0.0.0.0 interface lo0.0 passive user@ABR# set ospf area 0.0.0.0 interface ge-0/0/2.0 user@ABR# set ospf area 0.0.0.0 interface ge-0/0/0.0 user@ABR# set ospf area 0.0.0.0 interface ae0.0 user@ABR# set ospf area 0.0.0.0 interface fxp0.0 disable user@ABR# set ospf area 0.0.0.1 interface ge-0/0/3.0 user@ABR# set ospf area 0.0.0.1 interface ge-0/0/1.0 user@ABR# set ospf area 0.0.0.1 interface ae1.0
定义一个策略以指定具有平均平均标签功能的路由。
[edit policy-options ] user@ABR# set policy-statement pplb then load-balance per-packet user@ABR# set policy-statement send-inet3-R0 from route-filter 10.255.101.100/32 exact user@ABR# set policy-statement send-inet3-R0 then accept user@ABR# set policy-statement send-inet3-R4 from route-filter 10.255.101.200/32 exact user@ABR# set policy-statement send-inet3-R4 then accept
结果
在配置模式下,输入 、 show interfacesshow protocols、 show routing-options、 show forwarding options和show policy-options命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit] user@ABR# show interfaces ge-0/0/0 { gigether-options { 802.3ad ae0; } } ge-0/0/1 { gigether-options { 802.3ad ae1; } } ge-0/0/2 { gigether-options { 802.3ad ae0; } } ge-0/0/3 { gigether-options { 802.3ad ae1; } } ae0 { unit 0 { family inet { address 1.12.0.2/24; } family mpls; } } ae1 { unit 0 { family inet { address 1.23.0.1/24; } family mpls; } } lo0 { unit 0 { family inet { address 10.255.102.102/32 { primary; } } } }
[edit] user@ABR# show protocols rsvp { interface all; } mpls { icmp-tunneling; label-switched-path r2-r0 { to 10.255.101.100; entropy-label; } label-switched-path r2-r4 { to 10.255.101.200; entropy-label; } interface all; } bgp { group ibgp { type internal; local-address 10.255.102.102; family inet { labeled-unicast { rib { inet.3; } } } neighbor 10.255.101.100 { export send-inet3-R4; } neighbor 10.255.101.200 { export send-inet3-R0; } } } ospf { traffic-engineering; area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/2.0; interface ge-0/0/0.0; interface ae0.0; interface fxp0.0 { disable; } } area 0.0.0.1 { interface ge-0/0/3.0; interface ge-0/0/1.0; interface ae1.0; } }
[edit] user@ABR# show routing-options router-id 10.255.102.102; autonomous-system 1; forwarding-table { export pplb; }
[edit] user@ABR# show forwarding-options hash-key { family mpls { label-1; label-2; label-3; } } enhanced-hash-key { family mpls { no-payload; } }
[edit] user@ABR# show policy-options policy-statement pplb { then { load-balance per-packet; } } policy-statement send-inet3-R0 { from { route-filter 10.255.101.100/32 exact; } then accept; } policy-statement send-inet3-R4 { from { route-filter 10.255.101.200/32 exact; } then accept; }
验证
确认配置工作正常。
验证平均信息量标签功能是否是从路由器 PE2 播发的
目的
验证出口处的平均信息量标签功能路径属性是否从上游路由器 PE2 播发。
行动
在操作模式下,在 show route 10.255.101.200 advertising-protocol bgp 10.255.102.102 路由器 PE2 上运行命令。
user@PE2> show route 10.255.101.200 advertising-protocol bgp 10.255.102.102 inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) * 10.255.101.200/32 (1 entry, 1 announced) BGP group ibgp type Internal Route Label: 299920 Nexthop: Self Flags: Nexthop Change MED: 2 Localpref: 4294967294 AS path: [1] I Entropy label capable
含义
输出显示 IP 地址为 10.255.101.200 的主机 PE2 具有平均信息量标签功能。主机正在向其 BGP 邻接方播发平均信息量标签功能。
验证路由器 ABR 是否接收平均信息量标签播发
目的
验证路由器 ABR 在入口处是否从路由器 PE2 接收平均信息量标签播发。
行动
在操作模式下,在 show route 10.255.101.200 receiving-protocol bgp 10.255.101.200 路由器 ABR 上运行命令。
user@ABR> show route 10.255.101.200 receiving-protocol bgp 10.255.101.200 inet.0: 63 destinations, 63 routes (63 active, 0 holddown, 0 hidden) inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) * 10.255.101.100/32 (1 entry, 1 announced) Accepted Route Label: 299920 Nexthop: 10.255.102.102 MED: 2 Localpref: 4294967294 AS path: I Entropy label capable VPN-l3vpn.inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) iso.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) mpls.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) bgp.l3vpn.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) inet6.0: 7 destinations, 7 routes (7 active, 0 holddown, 0 hidden) VPN-l3vpn.inet6.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden) user@PE1> show route protocol bgp detail inet.0: 64 destinations, 64 routes (64 active, 0 holddown, 0 hidden) inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) 10.255.101.200/32 (1 entry, 1 announced) *BGP Preference: 170/1 Next hop type: Indirect, Next hop index: 0 Address: 0xa533c10 Next-hop reference count: 2 Source: 10.255.102.102 Next hop type: Router, Next hop index: 0 Next hop: 1.1.0.2 via ge-0/0/1.0, selected Label-switched-path r0-r2 Label operation: Push 299904, Push 300096(top) Label TTL action: prop-ttl, prop-ttl(top) Load balance label: Label 299904: Entropy label; Label 300096: None; Label element ptr: 0xa5335a0 Label parent element ptr: 0xa5338a0 Label element references: 2 Label element child references: 1 Label element lsp id: 0 Session Id: 0x0 Protocol next hop: 10.255.102.102 Label operation: Push 299904 Label TTL action: prop-ttl Load balance label: Label 299904: Entropy label; Indirect next hop: 0xaa18540 - INH Session ID: 0x0 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 12:39 Metric: 2 Metric2: 2 Validation State: unverified Task: BGP_1.10.255.102.102 Announcement bits (2): 0-Resolve tree 1 3-Resolve_IGP_FRR task AS path: I Accepted Route Label: 299904 Localpref: 4294967294 Router ID: 10.255.102.102 VPN-l3vpn.inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden)
含义
路由器 ABR 从其 BGP 邻接方 PE2 接收平均信息量标签功能通告。
验证平均信息量标签标志是否已设置
目的
验证是否为入口处的标签元素设置了平均信息量标签标志。
行动
在操作模式下,在 show route protocol bgp detail 路由器 PE1 上运行命令。
user@PE1> show route protocol bgp detail inet.0: 64 destinations, 64 routes (64 active, 0 holddown, 0 hidden) inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) 10.255.101.200/32 (1 entry, 1 announced) *BGP Preference: 170/1 Next hop type: Indirect, Next hop index: 0 Address: 0xa533c10 Next-hop reference count: 2 Source: 10.255.102.102 Next hop type: Router, Next hop index: 0 Next hop: 1.1.0.2 via ge-0/0/1.0, selected Label-switched-path r0-r2 Label operation: Push 299904, Push 300096(top) Label TTL action: prop-ttl, prop-ttl(top) Load balance label: Label 299904: Entropy label; Label 300096: None; Label element ptr: 0xa5335a0 Label parent element ptr: 0xa5338a0 Label element references: 2 Label element child references: 1 Label element lsp id: 0 Session Id: 0x0 Protocol next hop: 10.255.102.102 Label operation: Push 299904 Label TTL action: prop-ttl Load balance label: Label 299904: Entropy label; Indirect next hop: 0xaa18540 - INH Session ID: 0x0 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 12:39 Metric: 2 Metric2: 2 Validation State: unverified Task: BGP_1.10.255.102.102 Announcement bits (2): 0-Resolve tree 1 3-Resolve_IGP_FRR task AS path: I Accepted Route Label: 299904 Localpref: 4294967294 Router ID: 10.255.102.102 VPN-l3vpn.inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden)
含义
路由器 PE1 上启用了平均信息量标签。输出显示,平均信息量标签正用于 BGP 标记的单播,以实现端到端负载平衡。
Inet、Inet6 或标记单播的 BGP 前缀无关融合用例
如果发生路由器故障,BGP 网络可能需要几秒钟到几分钟的时间才能恢复,具体取决于网络大小或路由器性能等参数。在路由器上启用 BGP 前缀无关融合 (PIC) 功能时,除了计算出的目标最佳路径外,BGP 还安装到数据包转发引擎的第二个最佳路径。当网络中的出口路由器出现故障时,路由器会使用此备份路径,从而显著缩短中断时间。如果出口路由器出现故障,您可以启用此功能来减少网络停机时间。
当无法访问网络中的出口路由器时,IGP 会检测到此中断,并且链路状态将此信息传播到整个网络中,并将该前缀的 BGP 下一跃点播发为无法访问。BGP 会重新评估备用路径,如果备用路径可用,会将此备用下一跃点重新安装到数据包转发引擎中。这种出口故障通常同时影响多个前缀,BGP 必须一次更新所有这些前缀。在入口路由器上,IGP 完成最短路径优先 (SPF) 并更新下一跃点。然后,Junos OS 会确定无法访问的前缀,并向协议发出信号,表明需要更新这些前缀。BGP 接收通知,并为现在无效的每个前缀更新下一跃点。此过程可能会影响连接,可能需要几分钟时间才能从中断中恢复。BGP PIC 可以缩短这种停机时间,因为备份路径已安装在数据包转发引擎中。
从 Junos OS 15.1 版开始,最初支持第 3 层 VPN 路由器的 BGP PIC 功能已扩展到 BGP,其中的多个路由位于全局表中,例如 inet 和 inet6 单播,以及 inet 和 inet6 标记的单播。在支持 BGP PIC 的路由器上,Junos OS 在路由 引擎上为间接下一跃点安装备份路径,并将此路由提供给数据包转发引擎和 IGP。当 IGP 无法访问包含一个或多个路由的前缀时,在更新路由表之前,它用一条消息向路由引擎发出信号。路由引擎向数据包转发引擎发出信号,表明间接的下一跃点已失败,并且必须使用备份路径重新路由流量。即使在 BGP 开始重新计算 BGP 前缀的新下一跃点之前,也会继续使用备份路径路由到受影响的目标前缀。路由器使用此备份路径来减少流量损失,直到通过 BGP 的全局融合得到解决。
发生中断的时间,直到发出可访问性丧失信号的时间实际上取决于最近路由器的故障检测时间和 IGP 融合时间。一旦本地路由器检测到中断,如果不启用 BGP PIC 功能的路由融合,将在很大程度上取决于受影响的前缀数量和路由器的性能,因为需要重新计算每个受影响的前缀。但是,启用 BGP PIC 功能后,即使在 BGP 为这些受影响的前缀重新计算最佳路径之前,路由引擎也会向数据平面发出信号,以便切换到备用的下一个最佳路径。因此,流量损失降至最低。即使流量被转发,这些新路由也会被推送到数据平面,从而计算新路由。因此,受影响的 BGP 前缀数量不会影响从发生流量中断到 BGP 发出可访问性丧失信号的时间点所需的时间。
另请参阅
为 Inet 配置 BGP 前缀无关融合
在支持 BGP 前缀无关融合 (PIC) 的路由器上,Junos OS 在路由引擎上为间接下一跃点安装备份路径,并将此路由提供给数据包转发引擎和 IGP。当 IGP 无法访问包含一个或多个路由的前缀时,在更新路由表之前,它用一条消息向路由引擎发出信号。路由引擎向数据包转发引擎发出信号,表明间接的下一跃点已失败,并且必须使用备份路径重新路由流量。即使在 BGP 开始重新计算 BGP 前缀的新下一跃点之前,也会继续使用备份路径路由到受影响的目标前缀。路由器使用此备份路径来减少流量损失,直到通过 BGP 的全局融合得到解决。BGP PIC 功能最初支持第 3 层 VPN 路由器,现已扩展到 BGP,在全局表中具有多个路由,例如 inet 和 inet6 单播,inet 和 inet6 标记的单播。
开始之前:
配置设备接口。
配置 OSPF 或任何其他 IGP 协议。
配置 MPLS 和 LDP。
配置 BGP。
BGP PIC 功能仅在具有 MPC 接口的路由器上受支持。
在配备模块化端口集中器 (MPC) 的路由器上,启用增强型 IP 网络服务,如下所示:
[edit chassis network-services] user@host# set enhanced-ip
要为 inet 配置 BGP PIC:
另请参阅
示例:为 Inet 配置 BGP 前缀无关融合
此示例说明如何为 inet 配置 BGP PIC。如果发生路由器故障,BGP 网络可能需要几秒钟到几分钟的时间才能恢复,具体取决于网络大小或路由器性能等参数。在路由器上启用 BGP 前缀无关融合 (PIC) 功能时,包含多个路由的 BGP(如 inet 和 inet6 单播,以及 inet 和 inet6 标记的单播)将安装到数据包转发引擎,除了计算出的目标最佳路径之外。当网络中的出口路由器出现故障时,路由器会使用此备份路径,从而显著缩短中断时间。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
一个 MX 系列路由器,带有 MPC,用于配置 BGP PIC 功能
七个路由器,可以是 M 系列、MX 系列、T 系列或 PTX 系列路由器的组合
配置了 BGP PIC 的设备上的 Junos OS 15.1 或更高版本
概述
从 Junos OS 15.1 版开始,最初支持第 3 层 VPN 路由器的 BGP PIC 已扩展到 BGP,其中的多个路由位于全局表中,例如 inet 和 inet6 单播,以及 inet 和 inet6 标记的单播。除了计算到目标的最佳路径之外,BGP 还安装到数据包转发引擎的第二最佳路径。当 IGP 无法访问前缀时,路由器使用此备份路径来减少流量损失,直到解决通过 BGP 的全局融合,从而缩短中断持续时间。
BGP PIC 功能仅在具有 MPC 的路由器上受支持。
拓扑
此示例显示了三个客户边缘 (CE) 路由器、设备 CE0、CE1 和 CE2。路由器 PE0、PE1 和 PE2 是提供商边缘 (PE) 路由器。路由器 P0 和 P1 是提供商核心路由器。路由器 PE0 上配置了 BGP PIC。为了测试,地址 192.168.1.5 会添加为设备 CE1 上的第二个环路接口地址。地址将通告路由器 PE1 和 PE2,并由内部 BGP (IBGP) 中继到路由器 PE0。在路由器 PE0 上,有两条通往 192.168.1.5 网络的路径。这些是主路径和备份路径。 图 13 显示了示例网络。

配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入提交。
路由器 PE0
set chassis network-services enhanced-ip set interfaces ge-0/0/0 unit 0 description PE0->P0 set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.5/24 set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8::1/32 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 description PE0->P1 set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.1/24 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family inet6 address 2001:db8::2/32 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set interfaces ge-0/0/2 unit 0 description PE0->CE0 set interfaces ge-0/0/2 unit 0 family inet address 172.16.0.1/30 set interfaces ge-0/0/2 unit 0 family inet6 address 2001:db8::10/32 set interfaces ge-0/0/2 unit 0 family mpls set protocols mpls ipv6-tunneling set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 192.168.0.1 set protocols bgp group ibgp family inet labeled-unicast per-prefix-label set protocols bgp group ibgp family inet6 labeled-unicast explicit-null set protocols bgp group ibgp export nhself set protocols bgp group ibgp neighbor 192.168.0.4 description PE1 set protocols bgp group ibgp neighbor 192.168.0.5 description PE2 set protocols bgp group ebgp type external set protocols bgp group ebgp local address 192.168.0.1 set protocols bgp group ebgp family inet labeled-unicast set protocols bgp group ebgp family inet6 labeled-unicast set protocols bgp group ebgp peer-as 64497 set protocols bgp group ebgp neighbor 172.16.0.2 description CE0 set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface fxp0.0 disable 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 1000 set protocols ospf3 area 0.0.0.0 interface all set protocols ospf3 area 0.0.0.0 interface fxp0.0 disable set protocols ospf3 area 0.0.0.0 interface lo0.0 passive set protocols ospf3 area 0.0.0.0 interface ge-0/0/1.0 metric 1000 set protocols ldp track-igp-metric set protocols ldp interface all set protocols ldp interface fxp0.0 disable set policy-options policy-statement lb then load-balance per-packet set policy-options policy-statement nhself then next-hop self set routing-options protect core set routing-options forwarding-table export lb set routing-options router-id 192.168.0.1 set routing-options autonomous-system 64496
路由器 P0
set chassis network-services enhanced-ip set interfaces ge-0/0/0 unit 0 description P0->PE0 set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.6/24 set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8::3/32 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 description P0->PE1 set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.9/24 set interfaces ge-0/0/1 unit 0 family inet6 address 2001:db8::4/32 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface fxp0.0 disable set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols bgp group ibgp type internal set protocols bgp group ibgp local address 192.168.0.1 set protocols bgp group ibgp neighbor 192.168.0.4 description PE1 set protocols bgp group ibgp neighbor 192.168.0.5 description PE2 set routing-options router-id 192.168.0.2 set routing-options autonomous-system 64496
路由器 P1
set chassis network-services enhanced-ip set interfaces ge-0/0/1 unit 0 description P1->PE0 set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.2/24 set interfaces ge-0/0/1 unit 0 family inet6 address 2001:db8::5/32 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/0 unit 0 description P1->PE2 set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.13/24 set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8::6/32 set interfaces ge-0/0/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface fxp0.0 disable set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols bgp group ibgp type internal set protocols bgp group ibgp local address 192.168.0.3 set protocols bgp group ibgp neighbor 192.168.0.1 description PE0 set protocols bgp group ibgp neighbor 192.168.0.5 description PE2 set routing-options router-id 192.168.0.3 set routing-options autonomous-system 64496
路由器 PE1
set chassis network-services enhanced-ip set interfaces ge-0/0/0 unit 0 description PE1->P0 set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.10/24 set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8::7/32 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/1 unit 0 description PE1->CE1 set interfaces ge-0/0/1 unit 0 family inet address 172.16.1.1/30 set interfaces ge-0/0/1 unit 0 family inet6 address 2001:db8::12/32 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.4/32 set protocols bgp group ibgp type internal set protocols bgp group ibgp local address 192.168.0.4 set protocols bgp group ibgp family inet labeled-unicast per-prefix-label set protocols bgp group ibgp family inet6 labeled-unicast explicit-null set protocols bgp group ibgp export nhself set protocols bgp group ibgp neighbor 192.168.0.1 description PE0 set protocols bgp group ibgp neighbor 192.168.0.5 description PE2 set protocols bgp group ebgp type external set protocols bgp group ebgp local address 192.168.0.4 set protocols bgp group ebgp peer-as 64497 set protocols bgp group ebgp neighbor 172.16.1.2 description CE1 set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface fxp0.0 disable 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 1000 set protocols ospf3 area 0.0.0.0 interface all set protocols ospf3 area 0.0.0.0 interface fxp0.0 disable set protocols ospf3 area 0.0.0.0 interface lo0.0 passive set protocols ospf3 area 0.0.0.0 interface ge-0/0/0.0 metric 1000 set protocols ldp track-igp-metric set protocols ldp interface all set protocols ldp interface fxp0.0 disable set policy-options policy-statement PE1-v6-nh_CE1 from family inet6 set policy-options policy-statement PE1-v6-nh_CE1 then next-hop 2001:DB8::13 set policy-options policy-statement nhself then next-hop self set routing-options router-id 192.168.0.4 set routing-options autonomous-system 64496 set routing-options static route 192.168.1.2 next-hop 172.16.1.2
路由器 PE2
set chassis network-services enhanced-ip set interfaces ge-0/0/0 unit 0 description PE2->P1 set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.14/24 set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8::8/32 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/0 unit 0 family iso set interfaces ge-0/0/1 unit 0 description PE2->CE2 set interfaces ge-0/0/1 unit 0 family inet address 172.16.2.1/30 set interfaces ge-0/0/1 unit 0 family inet6 address 2001:db8::14/32 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.0.5/32 set protocols mpls ipv6-tunneling set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols bgp group ibgp type internal set protocols bgp group ibgp local address 192.168.0.5 set protocols bgp group ibgp family inet labeled-unicast per-prefix-label set protocols bgp group ibgp family inet6 labeled-unicast explicit-null set protocols bgp group ibgp export nhself set protocols bgp group ibgp neighbor 192.168.0.4 description PE1 set protocols bgp group ibgp neighbor 192.168.0.1 description PE0 set protocols bgp group ebgp type external set protocols bgp group ebgp local address 192.168.0.5 set protocols bgp group ebgp peer-as 64497 set protocols bgp group ebgp family inet labeled-unicast set protocols bgp group ebgp family inet6 labeled-unicast set protocols bgp group ebgp neighbor 172.16.2.2 description CE2 set protocols ospf area 0.0.0.0 interface all set protocols ospf area 0.0.0.0 interface fxp0.0 disable 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 1000 set protocols ospf3 area 0.0.0.0 interface all set protocols ospf3 area 0.0.0.0 interface fxp0.0 disable set protocols ospf3 area 0.0.0.0 interface lo0.0 passive set protocols ospf3 area 0.0.0.0 interface ge-0/0/0.0 metric 1000 set protocols ldp track-igp-metric set protocols ldp interface all set protocols ldp interface fxp0.0 disable set policy-options policy-statement nhself then next-hop self set routing-options router-id 192.168.0.5 set routing-options autonomous-system 64496 set routing-options static route 192.168.1.3 next-hop 172.16.2.2
设备 CE0
set chassis network-services enhanced-ip set interfaces ge-0/0/2 unit 0 description CE0->PE0 set interfaces ge-0/0/2 unit 0 family inet address 172.16.0.2/30 set interfaces ge-0/0/2 unit 0 family inet6 address 2001:db8::11/32 set interfaces lo0 unit 0 family inet address 192.168.1.1/32 set protocols mpls interface all set protocols bgp group ebgp type external set protocols bgp group ebgp peer-as 64496 set protocols bgp group ebgp family inet labeled-unicast set protocols bgp group ebgp family inet6 labeled-unicast set protocols bgp group ebgp neighbor 172.16.0.1 description PE0 set protocols bgp group ebgp local-address 192.168.1.1 set routing-options autonomous-system 64497 set routing-options router-id 192.168.1.1
设备 CE1
set chassis network-services enhanced-ip set interfaces ge-0/0/2 unit 0 description CE1->PE1 set interfaces ge-0/0/2 unit 0 family inet address 172.16.1.2/30 set interfaces ge-0/0/2 unit 0 family inet6 address 2001:db8::13/32 set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.1.2/32 set interfaces lo0 unit 0 family inet address 192.168.1.5/24 set protocols mpls interface all set protocols bgp group ebgp type external set protocols bgp group ebgp peer-as 64496 set protocols bgp group ebgp family inet labeled-unicast set protocols bgp group ebgp family inet6 labeled-unicast set protocols bgp group ebgp export send-direct set protocols bgp group ebgp neighbor 172.16.1.1 description PE1 set policy-options policy statement send-direct from protocol direct then accept set routing-options autonomous-system 64497 set routing-options router-id 192.168.1.2
设备 CE2
set chassis network-services enhanced-ip set interfaces ge-0/0/2 unit 0 description CE2->PE2 set interfaces ge-0/0/2 unit 0 family inet address 172.16.2.2/30 set interfaces ge-0/0/2 unit 0 family inet6 address 2001:db8::15/32 set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.1.3/32 set protocols mpls interface all set protocols bgp group ebgp type external set protocols bgp group ebgp peer-as 64496 set protocols bgp group ebgp family inet labeled-unicast set protocols bgp group ebgp family inet6 labeled-unicast set protocols bgp group ebgp export send-direct set protocols bgp group ebgp neighbor 172.16.2.1 description PE2 set policy-options policy statement send-direct from protocol direct then accept set routing-options autonomous-system 64497 set routing-options router-id 192.168.1.3
配置设备 PE0
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 PE0:
在配备模块化端口集中器 (MPC) 的路由器上,启用增强型 IP 网络服务。
[edit chassis] usr@PE0# set network-services enhanced-ip
配置设备接口。
[edit interfaces] user@PE0# set ge-0/0/0 unit 0 description PE0->P0 user@PE0# set ge-0/0/0 unit 0 family inet address 10.0.0.5/24 user@PE0# set ge-0/0/0 unit 0 family iso user@PE0# set ge-0/0/0 unit 0 family inet6 address 2001:db8::1/32 user@PE0# set ge-0/0/0 unit 0 family mpls user@PE0# set ge-0/0/1 unit 0 description PE0->P1 user@PE0# set ge-0/0/1 unit 0 family inet address 10.0.0.1/24 user@PE0# set ge-0/0/1 unit 0 family iso user@PE0# set ge-0/0/1 unit 0 family inet6 address 2001:db8::2/32 user@PE0# set ge-0/0/1 unit 0 family mpls user@PE0# set ge-0/0/2 unit 0 description PE0->CE0 user@PE0# set ge-0/0/2 unit 0 family inet address 172.16.0.1/30 user@PE0# set ge-0/0/2 unit 0 family inet6 address 2001:db8::10/32 user@PE0# set ge-0/0/2 unit 0 family mpls
配置环路接口。
[edit interfaces] user@PE0# set lo0 unit 0 family inet address 192.168.0.1/32
在所有接口(不包括管理接口)上配置 MPLS 和 LDP。
[edit protocols] user@PE0# set mpls ipv6-tunneling user@PE0# set mpls interface all user@PE0# set mpls interface fxp0.0 disable user@PE0# set ldp track-igp-metric user@PE0# set ldp interface all user@PE0# set ldp interface fxp0.0 disable
在面向核心的接口上配置 IGP。
[edit protocols] user@PE0# set ospf area 0.0.0.0 interface all user@PE0# set ospf area 0.0.0.0 interface fxp0.0 disable user@PE0# set ospf area 0.0.0.0 interface lo0.0 passive user@PE0# set ospf area 0.0.0.0 interface ge-0/0/1.0 metric 1000 user@PE0# set ospf3 area 0.0.0.0 interface all user@PE0# set ospf3 area 0.0.0.0 interface fxp0.0 disable user@PE0# set ospf3 area 0.0.0.0 interface lo0.0 passive user@PE0# set ospf3 area 0.0.0.0 interface ge-0/0/1.0 metric 1000
配置与其他 PE 设备的 IBGP 连接。
[edit protocols] user@PE0# set bgp group ibgp type internal user@PE0# set bgp group ibgp local-address 192.168.0.1 user@PE0# set bgp group ibgp family inet labeled-unicast per-prefix-label user@PE0# set bgp group ibgp family inet6 labeled-unicast explicit-null user@PE0# set bgp group ibgp export nhself user@PE0# set bgp group ibgp neighbor 192.168.0.4 description PE1 user@PE0# set bgp group ibgp neighbor 192.168.0.5 description PE2
配置与客户设备的 EBGP 连接。
[edit protocols] user@PE0# set bgp group ebgp type external user@PE0# set bgp group ebgp local address 192.168.0.1 user@PE0# set bgp group ebgp family inet labeled-unicast user@PE0# set bgp group ebgp family inet6 labeled-unicast user@PE0# set bgp group ebgp peer-as 64497 user@PE0# set bgp group ebgp neighbor 172.16.0.2 description CE0
配置负载平衡策略。
[edit policy-options] user@PE0# set policy-statement lb then load-balance per-packet
配置下一跃点自我策略。
[edit policy-options] user@PE0# set policy-statement nhself then next-hop self
启用 BGP PIC 边缘功能。
[edit routing-options] user@PE0# set protect core
应用负载平衡策略。
[edit routing-options] user@PE0# set forwarding-table export lb
分配路由器 ID 和自治系统 (AS) 编号。
[edit routing-options] user@PE0# set router-id 192.168.0.2 user@PE0# set autonomous-system 64496
结果
在配置模式下,输入 、 show chassis
show interfaces
、 show protocols
、 show policy-options
和show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit] user@PE0# show chassis network-services enhanced-ip;
[edit] user@PE0# show interfaces ge-0/0/0 { unit 0 { description PE0->P0; family inet { address 10.0.0.5/24; } family iso; family inet6 { address 2001:db8::1/32; } family mpls; } } ge-0/0/1 { unit 0 { description PE0->P1; family inet { address 10.0.0.1/24; } family iso; family inet6 { address 2001:db8::2/32; } family mpls; } } ge-0/0/2 { unit 0 { description PE0->CE0; family inet { address 172.16.0.1/30; } family inet6 { address 2001:db8::10/32; } family mpls; } } lo0 { unit 0 { family inet { address 192.168.0.1/32; } } }
[edit] user@PE0# show protocols mpls { ipv6-tunneling; interface all; interface fxp0.0 { disable; } } bgp { group ibgp { type internal; local-address 192.168.0.1; family inet { labeled-unicast { per-prefix-label; } } family inet6 { labeled-unicast { explicit-null; } } export nhself; neighbor 192.168.0.4 { description PE1; } neighbor 192.168.0.5 { description PE2; } } group ebgp { type external; local-address 192.168.0.1; family inet { labeled-unicast; } family inet6 { labeled-unicast; } peer-as 64497; neighbor 172.16.0.2 { description CE0; } } } ospf { area 0.0.0.0 { interface all; interface lo0.0 { passive; } interface ge-0/0/1.0 { metric 1000; } interface fxp0.0 { disable; } } } ospf3 { area 0.0.0.0 { interface all; interface lo0.0 { passive; } interface ge-0/0/1.0 { metric 1000; } interface fxp0.0 { disable; } } } ldp { track-igp-metric; interface all; interface fxp0.0 { disable; } }
[edit] user@PE1# show policy-options policy-statement lb { then { load-balance per-packet; } } policy-statement nhself { then { next-hop self; } }
[edit] user@PE0# show routing-options protect core; router-id 192.168.0.1; autonomous system 64496 forwarding-table { export lb; }
验证
确认配置工作正常。
显示广泛的路由信息
目的
确认 BGP PIC 边缘正常工作。
行动
从设备 PE0 运行 show route extensive
命令。
user@PE0> show route 192.168.1.5 extensive
inet.0: 236941 destinations, 630411 routes (236940 active, 0 holddown, 1 hidden)
20.1.1.1/32 (3 entries, 2 announced)
State: <CalcForwarding>
TSI:
KRT in-kernel 192.168.1.5/24 -> {indirect(1048574), indirect(1048575)}
@BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0xafd09d0
Next-hop reference count: 236886
Source: 192.168.0.4
Next hop type: Router, Next hop index: 623
Next hop: 10.0.0.2 via ge-0/0/1.0, selected
Session Id: 0x140
Protocol next hop: 192.168.0.4
Indirect next hop: 0xab3b980 1048574 INH Session ID: 0x144
State: <Active Int Ext ProtectionPath ProtectionCand>
Local AS: 64496 Peer AS: 64496
Age: 1:11 Metric2: 2
Validation State: unverified
Task: BGP_100.192.168.0.5
Announcement bits (1): 6-Resolve tree 2
AS path: 64497 I
Accepted MultipathUnequal
Localpref: 100
Router ID: 192.168.0.5
Indirect next hops: 1
Protocol next hop: 192.168.0.5 Metric: 2
Indirect next hop: 0xab3b980 1048574 INH Session ID: 0x144
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.0.0.2 via ge-0/0/1.0
Session Id: 0x140
192.168.0.5/32 Originating RIB: inet.0
Metric: 2 Node path count: 1
Forwarding nexthops: 1
Nexthop: 10.0.0.2 via ge-0/0/1.0
BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0xafd0970
Next-hop reference count: 196735
Source: 192.168.0.4
Next hop type: Router, Next hop index: 624
Next hop: 10.0.0.6 via ge-0/0/0.0, selected
Session Id: 0x141
Protocol next hop: 192.168.0.4
Indirect next hop: 0xab3c240 1048575 INH Session ID: 0x145
State: <NotBest Int Ext ProtectionCand>
Inactive reason: Not Best in its group - IGP metric
Local AS: 100 Peer AS: 100
Age: 1:05 Metric2: 1001
Validation State: unverified
Task: BGP_100.192.168.0.4
AS path: 200 400 I
Accepted
Localpref: 100
Router ID: 192.168.0.4
Indirect next hops: 1
Protocol next hop: 192.168.0.4 Metric: 1001
Indirect next hop: 0xab3c240 1048575 INH Session ID: 0x145
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.0.0.6 via ge-0/0/0.0
Session Id: 0x141
192.168.0.4/32 Originating RIB: inet.0
Metric: 1001 Node path count: 1
Forwarding nexthops: 1
Nexthop: 10.0.0.6 via ge-0/0/0.0
#Multipath Preference: 255
Next hop type: Indirect, Next hop index: 0
Address: 0xd330f90
Next-hop reference count: 304062
Next hop type: Router, Next hop index: 623
Next hop: 10.0.0.6 via ge-0/0/0.0, selected
Session Id: 0x140
Next hop type: Router, Next hop index: 624
Next hop: 10.0.0.2 via ge-0/0/1.0
Session Id: 0x141
Protocol next hop: 192.168.0.4
Indirect next hop: 0xab3b980 1048574 INH Session ID: 0x144 Weight 0x1
Protocol next hop: 192.168.0.5
Indirect next hop: 0xab3c240 1048575 INH Session ID: 0x145 Weight 0x4000
State: <ForwardinOnly Int Ext>
Inactive reason: Forwarding use only
Local AS: 64496
Age: 1:05 Metric2: 2
Validation State: unverified
Task: RT
Announcement bits (1): 0-KRT
AS path: 64497 I
含义
当发生链路故障时,Junos OS 使用下一跃点和 weight
值来选择备份路径。下一跃点权重具有以下值之一:
0x1表示具有活动下一跃点的主路径。
0x4000表示具有被动下一跃点的备份路径。
显示转发表
目的
使用 show route forwarding-table
命令检查转发和内核路由表状态。
行动
从设备 PE0 运行 show route forwarding-table destination 192.168.1.5 extensive
命令。
user@PE0> show route forwarding-table destination 192.168.1.5 extensive
Routing table: default.inet [Index 0]
Internet:
Destination: 192.168.1.5/24
Route type: user
Route reference: 0 Route interface-index: 0
Multicast RPF nh index: 0
Flags: sent to PFE
Next-hop type: unilist Index: 1048576 Reference: 7401
Next-hop type: indirect Index: 1048574 Reference: 2 Weight: 0x1
Nexthop: 10.0.0.6
Next-hop type: unicast Index: 623 Reference: 8
Next-hop interface: ge-0/0/0.0 Weight: 0x1
Next-hop type: indirect Index: 1048575 Reference: 2 Weight: 0x4000
Nexthop: 10.0.0.2
Next-hop type: unicast Index: 624 Reference: 8
Next-hop interface: ge-0/0/1.0 Weight: 0x4000
含义
当发生链路故障时,Junos OS 使用下一跃点和 weight
值来选择备份路径。下一跃点权重具有以下值之一:
0x1表示具有活动下一跃点的主路径。
0x4000表示具有被动下一跃点的备份路径。
使用 BGP 标记的单播的 BGP PIC 边缘概述
本节讨论使用 BGP 标记单播作为传输协议的 BGP PIC Edge 的优势和概述。
使用 BGP 标记单播的 BGP PIC 边缘的优势
此功能具有以下优势:
在多域网络中出现边界(ABR 和 ASBR)节点故障时提供流量保护。
加快恢复网络连接的速度,并在主路径不可用时减少流量损失。
BGP 前缀无关融合的工作原理是什么?
BGP 前缀无关融合 (PIC) 改善了网络节点故障时 BGP 融合。BGP PIC 在路由引擎上为间接下一跃点创建并存储主路径和备份路径,同时还向数据包转发引擎提供间接下一跃点路由信息。发生网络节点故障时,路由引擎会向数据包转发引擎发出信号,表明间接下一跃点已失败,并将流量重新路由到预先计算的等价或备份路径,而无需修改 BGP 前缀。将流量路由到目标前缀,继续使用备份路径来减少流量丢失,直到通过 BGP 解决全局融合。
BGP 融合适用于核心和边缘网络节点故障。对于 BGP PIC 核心,会因节点或核心链路故障而对转发链进行调整。对于 BGP PIC Edge,会因边缘节点或边缘链路故障而对转发链进行调整。
使用 BGP 标记的单播作为传输协议的 BGP PIC 边缘
当多域网络中发生边界节点(ABR 和 ASBR) 故障时,使用 BGP 标记的单播传输协议的 BGP PIC Edge 有助于保护和重新路由流量。多域网络通常用于城域以太网聚合和移动回传网络设计。
在瞻博网络 MX 系列、EX 系列和 PTX 系列设备上,BGP PIC Edge 支持使用 BGP 标记的单播作为传输协议的第 3 层服务。此外,在瞻博网络 MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备上,BGP PIC Edge 支持使用 BGP 标记的单播作为传输协议的第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务。这些 BGP 服务是多路径(从多个 PES 获知)通过 BGP 标记的单播路由解析,这同样可能是从其他 ABER 获知的多路径。BGP PIC Edge 支持的传输协议包括 RSVP、LDP、OSPF 和 ISIS。从 Junos OS 20.2R1 版、MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备,支持将 BGP 标记单播作为传输协议的第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务的 BGP PIC 边缘保护。
在瞻博网络 MX 系列、EX 系列和 PTX 系列设备上,支持以 BGP 标记单播作为传输方式的 BGP PIC 边缘保护,从而支持以下服务:
IPv4 BGP 标记单播的 IPv4 服务
通过 IPv4 BGP 标记单播的 IPv6 BGP 标记单播服务
IPv4 BGP 标记单播的 IPv4 第 3 层 VPN 服务
IPv4 BGP 标记单播的 IPv6 3 层 VPN 服务
在瞻博网络 MX 系列和 EX 系列设备上,以下服务支持以 BGP 标记单播作为传输的 BGP PIC 边缘保护:
IPv4 BGP 标记单播的第 2 层电路服务
IPv4 BGP 标记单播的第 2 层 VPN 服务
IPv4 BGP 标记单播的 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务
使用 BGP 标记的单播为 2 层服务配置 BGP PIC 边缘
MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备将 BGP 标记单播作为传输协议,可为第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务提供 BGP PIC 边缘保护。使用 BGP 标记的单播传输协议的 BGP PIC Edge 有助于保护多域网络中边界节点(ABR 和 ASBR) 上的流量故障。多域网络通常用于城域聚合和移动回传网络设计。
BGP PIC 边缘保护的先决条件是使用扩展的下一跃点层次结构对数据包转发引擎 (PFE) 进行编程。
要为 BGP 标记的单播系列启用扩展的下一跳层次结构,需要在 [edit protocols
] 层次结构级别配置以下 CLI 配置语句:
[edit protocols] user@host#set bgp group group-name family inet labeled-unicast nexthop-resolution preserve-nexthop-hierarchy;
要为 MPLS 负载平衡下一个ops 启用 BGP PIC,您需要在 [edit routing-options
] 层次结构级别配置以下 CLI 配置语句:
[edit routing-options] user@host#set rib routing-table-name protect core;
要为第 2 层服务实现快速融合,需要在 [edit protocols
] 层次结构级别配置以下 CLI 配置语句:
对于 2 层电路和 LDP VPLS:
[edit protocols] user@host#set l2circuit resolution preserve-nexthop-heirarchy;
对于第 2 层 VPN、BGP VPLS 和 FEC129:
[edit protocols] user@host#set l2vpn resolution preserve-nexthop-heirarchy;
示例:保护运行 BGP 标记单播的第 3 层 VPN 的 IPv4 流量
此示例说明如何配置 BGP 前缀无关融合 (PIC) 边缘标记单播以及保护第 3 层 VPN 上 IPv4 流量。当 CE 路由器的 IPv4 流量发送至 PE 路由器时,IPv4 流量通过第 3 层 VPN 进行路由,其中 BGP 标记的单播配置为传输协议。
要求
此示例使用以下硬件和软件组件:
-
MX 系列路由器。
-
在所有设备上运行的 Junos OS 19.4R1 或更高版本。
概述
只要主路径不可用,将流量切换到备份路径,则以下拓扑同时提供 ABR 和 ASBR 保护。
拓扑
图 14 展示了运行 BGP 标记的单播作为域间传输协议的第 3 层 VPN。

下表介绍了拓扑中使用的组件:
主要组件 |
设备类型 |
位置 |
---|---|---|
CE1 |
MX 系列 |
连接到客户网络。 |
PE1 |
MX 系列 |
配置了主路由路径和备用路由路径,以保护从 CE1 到 CE2 的流量并重新路由。 |
P1-P3 |
MX 系列 |
用于传输流量的核心路由器。 |
ABR1-ABR2 |
MX 系列 |
区域边界路由器 |
ABSR1-ABSR4 |
MX 系列 |
自治系统边界路由器 |
RR1-RR3 |
MX 系列 |
路由反射器 |
PE2-PE3 |
MX 系列 |
连接到客户边缘路由器 (CE2) 的 PE 路由器。 |
CE2 |
MX 系列 |
连接到客户网络。 |
从 ABR1 和 ABR2 中学习 PE2 和 PE3 设备地址作为标记的单播路由。这些路由通过 IGP/LDP 协议解析。PE1 从 PE2 和 PE3 设备学习 CE2 路由。
配置
要使用 BGP 标签单播和 LDP 作为传输协议配置 BGP PIC 边缘,请执行以下操作:
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入 commit
。
设备 CE1
set interfaces ge-0/0/1 description CE1-to-PE1-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.0/31 set interfaces ge-0/0/2 description CE1-to-PE1-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.2/31 set interfaces lo0 unit 0 family inet address 10.4.4.4/32 set policy-options policy-statement nhs term 1 from interface lo0.0 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set routing-options router-id 10.4.4.4 set routing-options autonomous-system 65004 set protocols bgp path-selection external-router-id set protocols bgp group toAs2 export nhs set protocols bgp group toAs2 peer-as 65002 set protocols bgp group toAs2 neighbor 192.168.0.1 set protocols bgp group toAs2 neighbor 192.168.0.3
设备 PE1
set interfaces ge-0/0/1 description PE1-to-CE1-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.1/31 set interfaces ge-0/0/2 description PE1-to-CE1-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.3/31 set interfaces ge-0/0/3 description PE1-to-P1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.4/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.2.2.5/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0005.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement mp-resolv term 1 from route-filter 10.1.1.0/24 orlonger set policy-options policy-statement mp-resolv term 1 then accept set policy-options policy-statement mp-resolv term 1 then multipath-resolve set policy-options policy-statement mp-resolv term 2 from route-filter 10.2.2.0/24 orlonger set policy-options policy-statement mp-resolv term 2 then accept set policy-options policy-statement mp-resolv term 2 then multipath-resolve set policy-options policy-statement mp-resolv term def then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then local-preference 65200 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement vrf-export-red term 1 then community add leak2red set policy-options policy-statement vrf-export-red term 1 then accept set policy-options policy-statement vrf-import-red term 1 from community leak2red set policy-options policy-statement vrf-import-red term 1 then accept set policy-options community leak2red members target:100:100 set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-instances red routing-options multipath preserve-nexthop-hierarchy set routing-instances red routing-options protect core set routing-instances red protocols bgp group toCE1 peer-as 4 set routing-instances red protocols bgp group toCE1 neighbor 192.168.0.2 set routing-instances red instance-type vrf set routing-instances red interface ge-0/0/2.0 set routing-instances red vrf-import vrf-import-red set routing-instances red vrf-export vrf-export-red set routing-options rib inet.3 protect core set routing-options route-distinguisher-id 10.2.2.5 set routing-options forwarding-table export pplb set routing-options resolution preserve-nexthop-hierarchy set routing-options resolution rib inet.0 import mp-resolv set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.2.2.5 set routing-options autonomous-system 2 set routing-options protect core set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface ge-0/0/3.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/3.0 set protocols ldp interface ge-0/0/3.0 set protocols mpls label-switched-path toABR1-gold to 10.2.2.3 set protocols mpls label-switched-path toABR1-bronze to 10.2.2.3 set protocols mpls label-switched-path toABR2-gold to 10.2.2.4 set protocols bgp path-selection external-router-id set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.5 set protocols bgp group toAs2RR family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs2RR family inet labeled-unicast add-path receive set protocols bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2RR family inet labeled-unicast nexthop-resolution preserve-nexthop-hierarchy set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR export export-inet3 set protocols bgp group toAs2RR neighbor 10.2.2.6 set protocols bgp group toAs4 peer-as 65004 set protocols bgp group toAs4 neighbor 192.168.0.0 set protocols bgp group toAs1PEs multihop no-nexthop-change set protocols bgp group toAs1PEs local-address 10.2.2.5 set protocols bgp group toAs1PEs family inet unicast set protocols bgp group toAs1PEs family inet-vpn unicast set protocols bgp group toAs1PEs family inet6 unicast set protocols bgp group toAs1PEs family inet6-vpn unicast set protocols bgp group toAs1PEs export nhs set protocols bgp group toAs1PEs peer-as 65001 set protocols bgp group toAs1PEs neighbor 10.1.1.1 set protocols bgp group toAs1PEs neighbor 10.1.1.2 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp multipath
设备 P1
set interfaces ge-0/0/1 description P1-to-RR1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.6/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description P1-to-ABR1 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.8/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description P1-to-PE1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.5/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description P1-to-ABR2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.10/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.8/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0008.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set routing-options router-id 10.2.2.8 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all
设备 RR1
set interfaces ge-0/0/1 description RR1-to-P1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.7/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.2.2.6/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0006.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement pplb then load-balance per-packet set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.2.2.6 set routing-options autonomous-system 2 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-rib inet6.3 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all set protocols bgp path-selection external-router-id set protocols bgp group toAs2Reg2BNs type internal set protocols bgp group toAs2Reg2BNs family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs2Reg2BNs family inet labeled-unicast add-path receive set protocols bgp group toAs2Reg2BNs family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2Reg2BNs family inet labeled-unicast rib inet.3 set protocols bgp group toAs2Reg2BNs export export-inet3 set protocols bgp group toAs2Reg2BNs neighbor 10.2.2.3 set protocols bgp group toAs2Reg2BNs neighbor 10.2.2.4 set protocols bgp group toAs2Reg2BNs neighbor 10.2.2.5 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp local-address 10.2.2.6 set protocols bgp cluster 10.2.2.6
设备 ABR1
set interfaces ge-0/0/1 description ABR1-to-P2 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.12/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ABR1-to-P1 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.9/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.3/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0003.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.3 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls label-switched-path toASBR2-gold to 10.2.2.2 set protocols mpls label-switched-path toASBR1-bronze to 10.2.2.1 set protocols mpls label-switched-path toASBR2-bronze to 10.2.2.2 set protocols mpls interface all set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.3 set protocols bgp group toAs2RR advertise-inactive set protocols bgp group toAs2RR family inet labeled-unicast add-path receive set protocols bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR cluster 10.2.2.3 set protocols bgp group toAs2RR neighbor 10.2.2.6 set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ABR2
set interfaces ge-0/0/2 description ABR2-to-P2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.14/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/4 description ABR2-to-P1 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.11/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.4/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0004.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.4 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls label-switched-path toASBR1-bronze to 10.2.2.1 set protocols mpls interface all set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.4 set protocols bgp group toAs2RR advertise-inactive set protocols bgp group toAs2RR family inet labeled-unicast add-path receive set protocols bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR cluster 10.2.2.4 set protocols bgp group toAs2RR neighbor 10.2.2.6 set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 P2
set interfaces ge-0/0/1 description P2-to-ABR1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.13/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description P2-to-ABR2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.15/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description P2-to-RR2 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.16/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description P2-to-ASBR1 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.18/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description P2-to-ASBR2 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.20/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.9/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0009.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set routing-options router-id 10.2.2.9 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all
设备 RR2
set interfaces ge-0/0/3 description RR2-to-P2 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.17/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.2.2.7/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0007.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.2.2.7 set routing-options autonomous-system 65002 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all set protocols bgp path-selection external-router-id set protocols bgp group toAs2Reg1BNs type internal set protocols bgp group toAs2Reg1BNs family inet labeled-unicast add-path receive set protocols bgp group toAs2Reg1BNs family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2Reg1BNs family inet labeled-unicast rib inet.3 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.1 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.2 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.3 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.4 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp local-address 10.2.2.7 set protocols bgp cluster 10.2.2.7
设备 ASBR1
set interfaces ge-0/0/2 description ASBR1-to-ASBR3 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.22/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description ASBR1-to-ASBR4 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.24/31 set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description ASBR1-to-P2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.19/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.1/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0001.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.1 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface ge-0/0/4.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/4.0 set protocols ldp interface ge-0/0/4.0 set protocols mpls interface ge-0/0/4.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs1-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs1-T peer-as 1 set protocols bgp group toAs1-T neighbor 192.168.0.23 set protocols bgp group toAs1-T neighbor 192.168.0.27 set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.1 set protocols bgp group toAs2RR advertise-external set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ASBR2
set interfaces ge-0/0/1 description ASBR2-to-ASBR3 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.28/31 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ASBR2-to-ASBR4 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.26/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/5 description ASBR2-to-P2 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.21/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.2/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0002.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.2 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface ge-0/0/5.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/5.0 set protocols ldp interface ge-0/0/5.0 set protocols mpls interface ge-0/0/5.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs1-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs1-T peer-as 1 set protocols bgp group toAs1-T neighbor 192.168.0.29 set protocols bgp group toAs1-T neighbor 192.168.0.25 set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.2 set protocols bgp group toAs2RR advertise-external set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ASBR3
set interfaces ge-0/0/1 description ASBR3-to-ASBR2 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.29/31 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ASBR3-to-ASBR1 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.23/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/4 description ASBR3-to-P3 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.30/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.1.3/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0003.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.1.1.3 set routing-options autonomous-system 65001 set protocols isis level 1 disable set protocols isis interface ge-0/0/4.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/4.0 set protocols ldp interface ge-0/0/4.0 set protocols mpls label-switched-path toPE2-gold to 10.1.1.1 set protocols mpls interface ge-0/0/4.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs2-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs2-T peer-as 65002 set protocols bgp group toAs2-T neighbor 192.168.0.22 set protocols bgp group toAs2-T neighbor 192.168.0.28 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.3 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ASBR4
set interfaces ge-0/0/1 description ASBR4-to-P3 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.32/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ASBR4-to-ASBR2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.27/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description ASBR4-to-ASBR1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.25/31 set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.1.4/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0004.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.1.1.4 set routing-options autonomous-system 65001 set protocols isis level 1 disable set protocols isis interface ge-0/0/1.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/1.0 set protocols ldp interface ge-0/0/1.0 set protocols mpls label-switched-path toPE2-bronze to 10.1.1.1 set protocols mpls label-switched-path toPE3-bronze to 10.1.1.2 set protocols mpls interface ge-0/0/1.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs2-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs2-T peer-as 2 set protocols bgp group toAs2-T neighbor 192.168.0.26 set protocols bgp group toAs2-T neighbor 192.168.0.24 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.4 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 RR3
set interfaces ge-0/0/2 description RR3-to-P3 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.35/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.1.1.6/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0006.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement pplb then load-balance per-packet set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.1.1.6 set routing-options autonomous-system 1 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all set protocols bgp path-selection external-router-id set protocols bgp group toAs1BNs type internal set protocols bgp group toAs1BNs family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs1BNs family inet labeled-unicast add-path receive set protocols bgp group toAs1BNs family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs1BNs family inet labeled-unicast rib inet.3 set protocols bgp group toAs1BNs export export-inet3 set protocols bgp group toAs1BNs neighbor 10.1.1.3 set protocols bgp group toAs1BNs neighbor 10.1.1.4 set protocols bgp group toAs1BNs neighbor 10.1.1.2 set protocols bgp group toAs1BNs neighbor 10.1.1.1 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp local-address 10.1.1.6 set protocols bgp cluster 10.1.1.6
设备 P3
set interfaces ge-0/0/1 description P3-to-ASBR4 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.33/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description P3-to-RR3 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.34/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description P3-to-PE2 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.36/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description P3-to-ASBR3 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.31/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description P3-to-PE3 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.38/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.1.5/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0005.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set routing-options router-id 10.1.1.5 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all
设备 PE2
set interfaces ge-0/0/1 description PE2-to-CE2-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.40/31 set interfaces ge-0/0/2 description PE2-to-CE2-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.42/31 set interfaces ge-0/0/3 description PE2-to-P3 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.37/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.1.1.1/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0001.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then metric add 0 set policy-options policy-statement nhs term 1 then local-preference 200 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement vrf-export-red term 1 then community add leak2red set policy-options policy-statement vrf-export-red term 1 then accept set policy-options policy-statement vrf-import-red term 1 from community leak2red set policy-options policy-statement vrf-import-red term 1 then accept set policy-options community leak2red members target:100:100 set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-instances red protocols bgp group toCE2 peer-as 65003 set routing-instances red protocols bgp group toCE2 neighbor 192.168.0.43 set routing-instances red instance-type vrf set routing-instances red interface ge-0/0/2.0 set routing-instances red vrf-import vrf-import-red set routing-instances red vrf-export vrf-export-red set routing-options route-distinguisher-id 10.1.1.1 set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.1.1.1 set routing-options autonomous-system 1 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface ge-0/0/3.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/3.0 set protocols ldp interface ge-0/0/3.0 set protocols mpls interface ge-0/0/3.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs3-1 peer-as 65003 set protocols bgp group toAs3-1 neighbor 192.168.0.41 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.1 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs1RR family inet labeled-unicast add-path receive set protocols bgp group toAs1RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR family inet6-vpn unicast set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR export export-inet3 set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp group toAs2PEs multihop no-nexthop-change set protocols bgp group toAs2PEs local-address 10.1.1.1 set protocols bgp group toAs2PEs family inet unicast set protocols bgp group toAs2PEs family inet-vpn unicast set protocols bgp group toAs2PEs family inet6 unicast set protocols bgp group toAs2PEs family inet6-vpn unicast set protocols bgp group toAs2PEs export nhs set protocols bgp group toAs2PEs peer-as 65002 set protocols bgp group toAs2PEs neighbor 10.2.2.5 set protocols bgp group toAs2PEs vpn-apply-export set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 PE3
set interfaces ge-0/0/3 description PE3-to-CE2-Link1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.44/31 set interfaces ge-0/0/4 description PE3-to-CE2-Link2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.46/31 set interfaces ge-0/0/5 description PE3-to-P3 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.39/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.1.1.2/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0002.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then metric add 0 set policy-options policy-statement nhs term 1 then local-preference 200 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement vrf-export-red term 1 then community add leak2red set policy-options policy-statement vrf-export-red term 1 then accept set policy-options policy-statement vrf-import-red term 1 from community leak2red set policy-options policy-statement vrf-import-red term 1 then accept set policy-options community leak2red members target:100:100 set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-instances red protocols bgp group toCE2 peer-as 65003 set routing-instances red protocols bgp group toCE2 neighbor 192.168.0.47 set routing-instances red instance-type vrf set routing-instances red interface ge-0/0/4.0 set routing-instances red vrf-import vrf-import-red set routing-instances red vrf-export vrf-export-red set routing-options route-distinguisher-id 10.1.1.2 set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.1.1.2 set routing-options autonomous-system 1 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface ge-0/0/5.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/5.0 set protocols ldp interface ge-0/0/5.0 set protocols mpls interface ge-0/0/5.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs3 peer-as 65003 set protocols bgp group toAs3 neighbor 192.168.0.45 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.2 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR export export-inet3 set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp group toAs2PEs multihop no-nexthop-change set protocols bgp group toAs2PEs local-address 10.1.1.2 set protocols bgp group toAs2PEs family inet unicast set protocols bgp group toAs2PEs family inet-vpn unicast set protocols bgp group toAs2PEs family inet6 unicast set protocols bgp group toAs2PEs family inet6-vpn unicast set protocols bgp group toAs2PEs export nhs set protocols bgp group toAs2PEs peer-as 65002 set protocols bgp group toAs2PEs neighbor 10.2.2.5 set protocols bgp group toAs2PEs vpn-apply-export set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 CE2
set interfaces ge-0/0/1 description CE2-to-PE2-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.41/31 set interfaces ge-0/0/2 description CE2-to-PE2-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.43/31 set interfaces ge-0/0/3 description CE2-to-PE3-Link1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.45/31 set interfaces ge-0/0/4 description CE2-to-PE3-Link2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.47/31 set interfaces lo0 unit 0 family inet address 10.3.3.3/32 set policy-options policy-statement nhs term 1 from interface lo0.0 set policy-options policy-statement nhs term 1 then metric 50 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement nhsMED100 term 1 from interface lo0.0 set policy-options policy-statement nhsMED100 term 1 then metric 100 set policy-options policy-statement nhsMED100 term 1 then next-hop self set policy-options policy-statement nhsMED100 term 1 then accept set policy-options community map2bronze members 100:200 set policy-options community map2gold members 100:100 set policy-options community map2gold_bronze_plain members 300:400 set routing-options router-id 10.3.3.3 set routing-options autonomous-system 65003 set protocols bgp path-selection external-router-id set protocols bgp group toAs1Internet export nhs set protocols bgp group toAs1Internet peer-as 65001 set protocols bgp group toAs1Internet neighbor 192.168.0.40 set protocols bgp group toAs1Internet neighbor 192.168.0.44 export nhsMED100 set protocols bgp group toAs1L3VPN export nhs set protocols bgp group toAs1L3VPN peer-as 65001 set protocols bgp group toAs1L3VPN neighbor 192.168.0.46 set protocols bgp group toAs1L3VPN neighbor 192.168.0.42 export nhsMED100
配置 CE1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 CE1:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@CE1#set ge-0/0/1 description CE1-to-PE1-Link1 user@CE1#set ge-0/0/1 vlan-tagging user@CE1#set ge-0/0/1 unit 0 vlan-id 100 user@CE1#set ge-0/0/1 unit 0 family inet address 192.168.0.0/31 user@CE1#set ge-0/0/2 description CE1-to-PE1-Link2 user@CE1#set ge-0/0/2 vlan-tagging user@CE1#set ge-0/0/2 unit 0 vlan-id 100 user@CE1#set ge-0/0/2 unit 0 family inet address 192.168.0.2/31
-
将环路接口配置为用作 LDP 和 BGP 会话的路由器 ID 和终端接口。
[edit interfaces] user@CE1#set lo0 unit 0 family inet address 10.4.4.4/32
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@CE1#set policy-statement nhs term 1 from interface lo0.0 user@CE1#set policy-statement nhs term 1 then next-hop self user@CE1#set policy-statement nhs term 1 then accept
-
配置路由选项。
[edit routing-options] user@CE1#set router-id 10.4.4.4 user@CE1#set autonomous-system 65004
-
将 BGP 标记单播配置为 ABR,以便将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols bgp] user@CE1#set path-selection external-router-id user@CE1#set group toAs2 export nhs user@CE1#set group toAs2 peer-as 65002 user@CE1#set group toAs2 neighbor 192.168.0.1 user@CE1#set group toAs2 neighbor 192.168.0.3
结果
在配置模式下,输入 show interfaces
、 show policy-options
、 show routing-options
和 show protocols
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/1 { description CE1-to-PE1-Link1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.0/31; } } } ge-0/0/2 { description CE1-to-PE1-Link2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.2/31; } } } lo0 { unit 0 { family inet { address 10.4.4.4/32; } } } } policy-options { policy-statement nhs { term 1 { from interface lo0.0; then { next-hop self; accept; } } } } routing-options { router-id 10.4.4.4; autonomous-system 65004; } protocols { bgp { path-selection external-router-id; group toAs2 { export nhs; peer-as 65002; neighbor 192.168.0.1; neighbor 192.168.0.3; } } }
配置 PE1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 PE1:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@PE1#set ge-0/0/1 description PE1-to-CE1-Link1 user@PE1#set ge-0/0/1 vlan-tagging user@PE1#set ge-0/0/1 unit 0 vlan-id 100 user@PE1#set ge-0/0/1 unit 0 family inet address 192.168.0.1/31 user@PE1#set ge-0/0/2 description PE1-to-CE1-Link2 user@PE1#set ge-0/0/2 vlan-tagging user@PE1#set ge-0/0/2 unit 0 vlan-id 100 user@PE1#set ge-0/0/2 unit 0 family inet address 192.168.0.3/31 user@PE1#set ge-0/0/3 description PE1-to-P1 user@PE1#set ge-0/0/3 vlan-tagging user@PE1#set ge-0/0/3 unit 0 vlan-id 100 user@PE1#set ge-0/0/3 unit 0 family inet address 192.168.0.4/31 user@PE1#set ge-0/0/3 unit 0 family iso user@PE1#set ge-0/0/3 unit 0 family mpls
-
将环路接口配置为用作 LDP 和 BGP 会话的路由器 ID 和终端接口。
[edit interfaces] user@PE1#set lo0 unit 1 family inet address 10.2.2.5/32 user@PE1#set lo0 unit 1 family iso address 49.0000.0000.aaaa.0005.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@PE1#set policy-statement add-noexport term 1 then community add noexport user@PE1#set policy-statement allow-lo0 term 1 from interface lo0.1 user@PE1#set policy-statement allow-lo0 term 1 then accept user@PE1#set policy-statement allow-lo0 term 2 then reject user@PE1#set policy-statement export-inet3 term 1 from rib inet.3 user@PE1#set policy-statement export-inet3 term 1 then accept user@PE1#set policy-statement export-inet3 term 2 then reject user@PE1#set policy-statement mp-resolv term 1 from route-filter 10.1.1.0/24 orlonger user@PE1#set policy-statement mp-resolv term 1 then accept user@PE1#set policy-statement mp-resolv term 1 then multipath-resolve user@PE1#set policy-statement mp-resolv term 2 from route-filter 10.2.2.0/24 orlonger user@PE1#set policy-statement mp-resolv term 2 then accept user@PE1#set policy-statement mp-resolv term 2 then multipath-resolve user@PE1#set policy-statement mp-resolv term def then reject user@PE1#set policy-statement nhs term 1 from protocol bgp user@PE1#set policy-statement nhs term 1 then local-preference 200 user@PE1#set policy-statement nhs term 1 then next-hop self user@PE1#set policy-statement nhs term 1 then accept user@PE1#set policy-statement pplb then load-balance per-packet user@PE1#set policy-statement vrf-export-red term 1 then community add leak2red user@PE1#set policy-statement vrf-export-red term 1 then accept user@PE1#set policy-statement vrf-import-red term 1 from community leak2red user@PE1#set policy-statement vrf-import-red term 1 then accept user@PE1#set community leak2red members target:100:100 user@PE1#set community noexport members no-export user@PE1#set community noexport members no-advertise
-
配置第 3 层 VPN 路由实例以提供客户服务。
[edit routing-instances] user@PE1#set red routing-options multipath preserve-nexthop-hierarchy user@PE1#set red routing-options protect core user@PE1#set red protocols bgp group toCE1 peer-as 65004 user@PE1#set red protocols bgp group toCE1 neighbor 192.168.0.2 user@PE1#set red instance-type vrf user@PE1#set red interface ge-0/0/2.0 user@PE1#set red vrf-import vrf-import-red user@PE1#set red vrf-export vrf-export-red
-
配置解析器 RIB 导入策略和解析 RIB,为策略指定的选定第 3 层 VPN 前缀启用扩展的层次下一跳结构。
[edit routing-options] user@PE1#set rib inet.3 protect core user@PE1#set route-distinguisher-id 10.2.2.5 user@PE1#set forwarding-table export pplb user@PE1#set resolution preserve-nexthop-hierarchy user@PE1#set resolution rib inet.0 import mp-resolv user@PE1#set interface-routes rib-group inet inet0to3 user@PE1#set router-id 10.2.2.5 user@PE1#set autonomous-system 65002 user@PE1#set protect core user@PE1#set rib-groups inet0to3 import-rib inet.0 user@PE1#set rib-groups inet0to3 import-rib inet.3 user@PE1#set rib-groups inet0to3 import-policy allow-lo0 user@PE1#set rib-groups inet3to0 import-rib inet.3 user@PE1#set rib-groups inet3to0 import-rib inet.0 user@PE1#set rib-groups inet3to0 import-policy add-noexport
-
配置 OSPF 协议。
[edit protocols ospf] user@PE1#set protocols ospf area 0.0.0.0 interface all link-protection; user@PE1#set protocols ospf area 0.0.0.0 interface fxp0.0 disable; user@PE1#set protocols ospf area 0.0.0.0 interface lo0.0 passive;
-
配置路由协议以跨域建立 IP 和 MPLS 连接。
[edit protocols] user@PE1#set isis level 1 disable user@PE1#set isis interface ge-0/0/3.0 user@PE1#set isis export allow-lo0 user@PE1#set isis topologies ipv6-unicast user@PE1#set rsvp interface ge-0/0/3.0 user@PE1#set ldp interface ge-0/0/3.0 user@PE1#set mpls label-switched-path toABR1-gold to 10.2.2.3 user@PE1#set mpls label-switched-path toABR1-bronze to 10.2.2.3 user@PE1#set mpls label-switched-path toABR2-gold to 10.2.2.4
-
将 BGP 标记单播配置为 ABR,以便将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols bgp] user@PE1#set path-selection external-router-id user@PE1#set group toAs2RR type internal user@PE1#set group toAs2RR local-address 10.2.2.5 user@PE1#set group toAs2RR family inet labeled-unicast rib-group inet3to0 user@PE1#set group toAs2RR family inet labeled-unicast add-path receive user@PE1#set group toAs2RR family inet labeled-unicast add-path send path-count 4 user@PE1#set group toAs2RR family inet labeled-unicast nexthop-resolution preserve-nexthop-hierarchy user@PE1#set group toAs2RR family inet labeled-unicast rib inet.3 user@PE1#set group toAs2RR export nhs user@PE1#set group toAs2RR export export-inet3 user@PE1#set group toAs2RR neighbor 10.2.2.6 user@PE1#set group toAs4 peer-as 65004 user@PE1#set group toAs4 neighbor 192.168.0.0 user@PE1#set group toAs1PEs multihop no-nexthop-change user@PE1#set group toAs1PEs local-address 10.2.2.5 user@PE1#set group toAs1PEs family inet unicast user@PE1#set group toAs1PEs family inet-vpn unicast user@PE1#set group toAs1PEs family inet6 unicast user@PE1#set group toAs1PEs family inet6-vpn unicast user@PE1#set group toAs1PEs export nhs user@PE1#set group toAs1PEs peer-as 65001 user@PE1#set group toAs1PEs neighbor 10.1.1.1 user@PE1#set group toAs1PEs neighbor 10 .1.1.2 user@PE1#set traceoptions file bgp.log user@PE1#set traceoptions file size 100m user@PE1#set traceoptions flag state detail user@PE1#set traceoptions flag policy user@PE1#set multipath
结果
在配置模式下,输入 、 show chassis
show interfaces
、 show policy-options
、 show routing-instances
和show routing-options
show protocols
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/1 { description PE1-to-CE1-Link1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.1/31; } } } ge-0/0/2 { description PE1-to-CE1-Link2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.3/31; } } } ge-0/0/3 { description PE1-to-P1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.4/31; } family iso; family mpls; } } lo0 { unit 1 { family inet { address 10.2.2.5/32; } family iso { address 49.0000.0000.aaaa.0005.00; } } } } policy-options { policy-statement add-noexport { term 1 { then { community add noexport; } } } policy-statement allow-lo0 { term 1 { from interface lo0.1; then accept; } term 2 { then reject; } } policy-statement export-inet3 { term 1 { from rib inet.3; then accept; } term 2 { then reject; } } policy-statement mp-resolv { term 1 { from { route-filter 10.1.1.0/24 orlonger; } then { accept; multipath-resolve; } } term 2 { from { route-filter 10.2.2.0/24 orlonger; } then { accept; multipath-resolve; } } term def { then reject; } } policy-statement nhs { term 1 { from protocol bgp; then { local-preference 200; next-hop self; accept; } } } policy-statement pplb { then { load-balance per-packet; } } policy-statement vrf-export-red { term 1 { then { community add leak2red; accept; } } } policy-statement vrf-import-red { term 1 { from community leak2red; then accept; } } community leak2red members target:100:100; community noexport members [ no-export no-advertise ]; } routing-instances { red { routing-options { multipath preserve-nexthop-hierarchy; protect core; } protocols { bgp { group toCE1 { peer-as 65004; neighbor 192.168.0.2; } } } instance-type vrf; interface ge-0/0/2.0; vrf-import vrf-import-red; vrf-export vrf-export-red; } } routing-options { rib inet.3 { protect core; } route-distinguisher-id 10.2.2.5; forwarding-table { export pplb; } resolution { preserve-nexthop-hierarchy; rib inet.0 { import mp-resolv; } } interface-routes { rib-group inet inet0to3; } router-id 10.2.2.5; autonomous-system 65002; protect core; rib-groups { inet0to3 { import-rib [ inet.0 inet.3 ]; import-policy allow-lo0; } inet3to0 { import-rib [ inet.3 inet.0 ]; import-policy add-noexport; } } } protocols { isis { level 1 disable; interface ge-0/0/3.0; export allow-lo0; topologies ipv6-unicast; } rsvp { interface ge-0/0/3.0; } bgp { path-selection external-router-id; group toAs2RR { type internal; local-address 10.2.2.5; family inet { labeled-unicast { rib-group inet3to0; add-path { receive; send { path-count 4; } } nexthop-resolution { preserve-nexthop-hierarchy; } rib { inet.3; } } } export [ nhs export-inet3 ]; neighbor 10.2.2.6; } group toAs4 { peer-as 65004; neighbor 192.168.0.0; } group toAs1PEs { multihop { no-nexthop-change; } local-address 10.2.2.5; family inet { unicast; } family inet-vpn { unicast; } family inet6 { unicast; } family inet6-vpn { unicast; } export nhs; peer-as 65001; neighbor 10.1.1.1; neighbor 10.1.1.2; } traceoptions { file bgp.log size 100m; flag state detail; flag policy; } multipath; } ldp { interface ge-0/0/3.0; } mpls { label-switched-path toABR1-gold { to 10.2.2.3; } label-switched-path toABR1-bronze { to 10.2.2.3; } label-switched-path toABR2-gold { to 10.2.2.4; } } }
配置 P1 设备
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 P1:
-
配置接口。
[edit interfaces] user@P1#set ge-0/0/1 description P1-to-RR1 user@P1#set ge-0/0/1 vlan-tagging user@P1#set ge-0/0/1 unit 0 vlan-id 100 user@P1#set ge-0/0/1 unit 0 family inet address 192.168.0.6/31 user@P1#set ge-0/0/1 unit 0 family iso user@P1#set ge-0/0/1 unit 0 family mpls user@P1#set ge-0/0/2 description P1-to-ABR1 user@P1#set ge-0/0/2 vlan-tagging user@P1#set ge-0/0/2 unit 0 vlan-id 100 user@P1#set ge-0/0/2 unit 0 family inet address 192.168.0.8/31 user@P1#set ge-0/0/2 unit 0 family iso user@P1#set ge-0/0/2 unit 0 family mpls user@P1#set ge-0/0/3 description P1-to-PE1 user@P1#set ge-0/0/3 vlan-tagging user@P1#set ge-0/0/3 unit 0 vlan-id 100 user@P1#set ge-0/0/3 unit 0 family inet address 192.168.0.5/31 user@P1#set ge-0/0/3 unit 0 family iso user@P1#set ge-0/0/3 unit 0 family mpls user@P1#set ge-0/0/4 description P1-to-ABR2 user@P1#set ge-0/0/4 vlan-tagging user@P1#set ge-0/0/4 unit 0 vlan-id 100 user@P1#set ge-0/0/4 unit 0 family inet address 192.168.0.10/31 user@P1#set ge-0/0/4 unit 0 family iso user@P1#set ge-0/0/4 unit 0 family mpls
-
配置环路接口。
[edit interfaces] user@P1#set lo0 unit 0 family inet address 10.2.2.8/32 user@P1#set lo0 unit 0 family iso address 49.0000.0000.aaaa.0008.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@P1#set policy-statement allow-lo0 term 1 from interface lo0.0 user@P1#set policy-statement allow-lo0 term 1 then accept user@P1#set policy-statement allow-lo0 term 2 then reject
-
配置路由选项。
[edit routing-options] user@P1#set router-id 10.2.2.8
-
在接口上配置 ISIS、RSVP、LDP 和 MPLS 协议。
[edit protocols] user@P1#set isis level 1 disable user@P1#set isis interface all user@P1#set isis export allow-lo0 user@P1#set isis topologies ipv6-unicast user@P1#set rsvp interface all user@P1#set ldp interface all user@P1#set mpls interface all
结果
在配置模式下,输入 、 show policy-options
和show protocols
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/1 { description P1-to-RR1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.6/31; } family iso; family mpls; } } ge-0/0/2 { description P1-to-ABR1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.8/31; } family iso; family mpls; } } ge-0/0/3 { description P1-to-PE1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.5/31; } family iso; family mpls; } } ge-0/0/4 { description P1-to-ABR2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.10/31; } family iso; family mpls; } } lo0 { unit 0 { family inet { address 10.2.2.8/32; } family iso { address 49.0000.0000.aaaa.0008.00; } } } } policy-options { policy-statement allow-lo0 { term 1 { from interface lo0.0; then accept; } term 2 { then reject; } } } routing-options { router-id 10.2.2.8; } protocols { isis { level 1 disable; interface all; export allow-lo0; topologies ipv6-unicast; } rsvp { interface all; } ldp { interface all; } mpls { interface all; } }
配置 RR1 设备
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 RR1:
-
配置接口。
[edit interfaces] user@RR1#set ge-0/0/1 description RR1-to-P1 user@RR1#set ge-0/0/1 vlan-tagging user@RR1#set ge-0/0/1 unit 0 vlan-id 100 user@RR1#set ge-0/0/1 unit 0 family inet address 192.168.0.7/31 user@RR1#set ge-0/0/1 unit 0 family iso user@RR1#set ge-0/0/1 unit 0 family mpls
-
配置环路接口。
[edit interfaces] user@RR1#set lo0 unit 1 family inet address 10.2.2.6/32 user@RR1#set lo0 unit 1 family iso address 49.0000.0000.aaaa.0006.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@RR1#set policy-statement add-noexport term 1 then community add noexport user@RR1#set policy-statement allow-lo0 term 1 from interface lo0.1 user@RR1#set policy-statement allow-lo0 term 1 then accept user@RR1#set policy-statement allow-lo0 term 2 then reject user@RR1#set policy-statement export-inet3 term 1 from rib inet.3 user@RR1#set policy-statement export-inet3 term 1 then accept user@RR1#set policy-statement export-inet3 term 2 then reject user@RR1#set policy-statement pplb then load-balance per-packet user@RR1#set community noexport members no-export user@RR1#set community noexport members no-advertise
-
配置路由选项。
[edit routing-options] user@RR1#set forwarding-table export pplb user@RR1#set interface-routes rib-group inet inet0to3 user@RR1#set router-id 10.2.2.6 user@RR1#set autonomous-system 2 user@RR1#set rib-groups inet0to3 import-rib inet.0 user@RR1#set rib-groups inet0to3 import-rib inet.3 user@RR1#set rib-groups inet0to3 import-policy allow-lo0 user@RR1#set rib-groups inet3to0 import-rib inet.3 user@RR1#set rib-groups inet3to0 import-rib inet.0 user@RR1#set rib-groups inet3to0 import-rib inet6.3 user@RR1#set rib-groups inet3to0 import-policy add-noexport
-
在接口上配置 ISIS、RSVP、LDP 和 MPLS 协议。
[edit protocols] user@RR1#set isis level 1 disable user@RR1#set isis interface all user@RR1#set isis export allow-lo0 user@RR1#set isis topologies ipv6-unicast user@RR1#set rsvp interface all user@RR1#set ldp interface all user@RR1#set mpls interface all
-
配置 BGP 标记单播,以将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols bgp] user@RR1#set path-selection external-router-id user@RR1#set group toAs2Reg2BNs type internal user@RR1#set group toAs2Reg2BNs family inet labeled-unicast rib-group inet3to0 user@RR1#set group toAs2Reg2BNs family inet labeled-unicast add-path receive user@RR1#set group toAs2Reg2BNs family inet labeled-unicast add-path send path-count 4 user@RR1#set group toAs2Reg2BNs family inet labeled-unicast rib inet.3 user@RR1#set group toAs2Reg2BNs export export-inet3 user@RR1#set group toAs2Reg2BNs neighbor 10.2.2.3 user@RR1#set group toAs2Reg2BNs neighbor 10.2.2.4 user@RR1#set group toAs2Reg2BNs neighbor 10.2.2.5 user@RR1#set traceoptions file bgp.log user@RR1#set traceoptions file size 100m user@RR1#set traceoptions flag state detail user@RR1#set traceoptions flag policy user@RR1#set local-address 10.2.2.6 user@RR1#set cluster 10.2.2.6
结果
在配置模式下,输入 、 show policy-options
show routing-options
和show protocols
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/1 { description RR1-to-P1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.7/31; } family iso; family mpls; } } lo0 { unit 1 { family inet { address 10.2.2.6/32; } family iso { address 49.0000.0000.aaaa.0006.00; } } } } policy-options { policy-statement add-noexport { term 1 { then { community add noexport; } } } policy-statement allow-lo0 { term 1 { from interface lo0.1; then accept; } term 2 { then reject; } } policy-statement export-inet3 { term 1 { from rib inet.3; then accept; } term 2 { then reject; } } policy-statement pplb { then { load-balance per-packet; } } community noexport members [ no-export no-advertise ]; } routing-options { forwarding-table { export pplb; } interface-routes { rib-group inet inet0to3; } router-id 10.2.2.6; autonomous-system 2; rib-groups { inet0to3 { import-rib [ inet.0 inet.3 ]; import-policy allow-lo0; } inet3to0 { import-rib [ inet.3 inet.0 inet6.3 ]; import-policy add-noexport; } } } protocols { isis { level 1 disable; interface all; export allow-lo0; topologies ipv6-unicast; } rsvp { interface all; } bgp { path-selection external-router-id; group toAs2Reg2BNs { type internal; family inet { labeled-unicast { rib-group inet3to0; add-path { receive; send { path-count 4; } } rib { inet.3; } } } export export-inet3; neighbor 10.2.2.3; neighbor 10.2.2.4; neighbor 10.2.2.5; } traceoptions { file bgp.log size 100m; flag state detail; flag policy; } local-address 10.2.2.6; cluster 10.2.2.6; } ldp { interface all; } mpls { interface all; } }
配置 ABR1 设备
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 ABR1:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@ABR1#set ge-0/0/1 description ABR1-to-P2 user@ABR1#set ge-0/0/1 vlan-tagging user@ABR1#set ge-0/0/1 unit 0 vlan-id 100 user@ABR1#set ge-0/0/1 unit 0 family inet address 192.168.0.12/31 user@ABR1#set ge-0/0/1 unit 0 family iso user@ABR1#set ge-0/0/1 unit 0 family mpls user@ABR1#set ge-0/0/2 description ABR1-to-P1 user@ABR1#set ge-0/0/2 vlan-tagging user@ABR1#set ge-0/0/2 unit 0 vlan-id 100 user@ABR1#set ge-0/0/2 unit 0 family inet address 192.168.0.9/31 user@ABR1#set ge-0/0/2 unit 0 family iso user@ABR1#set ge-0/0/2 unit 0 family mpls
-
将环路接口配置为用作 LDP 和 BGP 会话的路由器 ID 和终端接口。
[edit interfaces] user@ABR1#set lo0 unit 0 family inet address 10.2.2.3/32 user@ABR1#set lo0 unit 0 family iso address 49.0000.0000.aaaa.0003.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@ABR1#set policy-statement allow-lo0 term 1 from interface lo0.0 user@ABR1#set policy-statement allow-lo0 term 1 then accept user@ABR1#set policy-statement allow-lo0 term 2 then reject user@ABR1#set policy-statement nhs term 1 from protocol bgp user@ABR1#set policy-statement nhs term 1 then next-hop self user@ABR1#set policy-statement nhs term 1 then accept user@ABR1#set policy-statement pplb then load-balance per-packet
-
按流应用负载平衡策略,以启用流量保护。
[edit routing-options] user@ABR1#set forwarding-table export pplb user@ABR1#set router-id 10.2.2.3 user@ABR1#set autonomous-system 65002
-
在接口上配置 ISIS、RSVP、MPLS 和 LDP 协议。
[edit protocols] user@ABR1#set isis level 1 disable user@ABR1#set isis interface all user@ABR1#set isis export allow-lo0 user@ABR1#set isis topologies ipv6-unicast user@ABR1#set rsvp interface all user@ABR1#set ldp interface all user@ABR1#set mpls label-switched-path toASBR2-gold to 10.2.2.2 user@ABR1#set mpls label-switched-path toASBR1-bronze to 10.2.2.1 user@ABR1#set mpls label-switched-path toASBR2-bronze to 10.2.2.2 user@ABR1#set mpls interface all
-
配置 BGP 标记单播,以将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols] user@ABR1#set bgp group toAs2RR type internal user@ABR1#set bgp group toAs2RR local-address 10.2.2.3 user@ABR1#set bgp group toAs2RR advertise-inactive user@ABR1#set bgp group toAs2RR family inet labeled-unicast add-path receive user@ABR1#set bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 user@ABR1#set bgp group toAs2RR family inet labeled-unicast rib inet.3 user@ABR1#set bgp group toAs2RR export nhs user@ABR1#set bgp group toAs2RR cluster 10.2.2.3 user@ABR1#set bgp group toAs2RR neighbor 10.2.2.6 user@ABR1#set bgp group toAs2RR neighbor 10.2.2.7 user@ABR1#set bgp traceoptions file bgp.log user@ABR1#set bgp traceoptions file size 100m user@ABR1#set bgp traceoptions flag state detail user@ABR1#set bgp traceoptions flag policy
结果
在配置模式下,输入 、 show policy-options
show routing-options
和show protocols
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/1 { description ABR1-to-P2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.12/31; } family iso; family mpls; } } ge-0/0/2 { description ABR1-to-P1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.9/31; } family iso; family mpls; } } lo0 { unit 0 { family inet { address 10.2.2.3/32; } family iso { address 49.0000.0000.aaaa.0003.00; } } } } policy-options { policy-statement allow-lo0 { term 1 { from interface lo0.0; then accept; } term 2 { then reject; } } policy-statement nhs { term 1 { from protocol bgp; then { next-hop self; accept; } } } policy-statement pplb { then { load-balance per-packet; } } } routing-options { forwarding-table { export pplb; } router-id 10.2.2.3; autonomous-system 65002; } protocols { isis { level 1 disable; interface all; export allow-lo0; topologies ipv6-unicast; } rsvp { interface all; } bgp { group toAs2RR { type internal; local-address 10.2.2.3; advertise-inactive; family inet { labeled-unicast { add-path { receive; send { path-count 4; } } rib { inet.3; } } } export nhs; cluster 10.2.2.3; neighbor 10.2.2.6; neighbor 10.2.2.7; } traceoptions { file bgp.log size 100m; flag state detail; flag policy; } } ldp { interface all; } mpls { label-switched-path toASBR2-gold { to 10.2.2.2; } label-switched-path toASBR1-bronze { to 10.2.2.1; } label-switched-path toASBR2-bronze { to 10.2.2.2; } interface all; } }
配置 ABR2 设备
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 ABR2:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@ABR2#set ge-0/0/2 description ABR2-to-P2 user@ABR2#set ge-0/0/2 vlan-tagging user@ABR2#set ge-0/0/2 unit 0 vlan-id 100 user@ABR2#set ge-0/0/2 unit 0 family inet address 192.168.0.14/31 user@ABR2#set ge-0/0/2 unit 0 family iso user@ABR2#set ge-0/0/2 unit 0 family mpls user@ABR2#set ge-0/0/4 description ABR2-to-P1 user@ABR2#set ge-0/0/4 vlan-tagging user@ABR2#set ge-0/0/4 unit 0 vlan-id 100 user@ABR2#set ge-0/0/4 unit 0 family inet address 192.168.0.11/31 user@ABR2#set ge-0/0/4 unit 0 family iso user@ABR2#set ge-0/0/4 unit 0 family mpls
-
将环路接口配置为用作 LDP 和 BGP 会话的路由器 ID 和终端接口。
[edit interfaces] user@ABR2#set lo0 unit 0 family inet address 2.2.2.4/32 user@ABR2#set lo0 unit 0 family iso address 49.0000.0000.aaaa.0004.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@ABR2#set policy-statement allow-lo0 term 1 from interface lo0.0 user@ABR2#set policy-statement allow-lo0 term 1 then accept user@ABR2#set policy-statement allow-lo0 term 2 then reject user@ABR2#set policy-statement nhs term 1 from protocol bgp user@ABR2#set policy-statement nhs term 1 then next-hop self user@ABR2#set policy-statement nhs term 1 then accept user@ABR2#set policy-statement pplb then load-balance per-packet
-
按流应用负载平衡策略,以启用流量保护。
[edit routing-options] user@ABR2#set forwarding-table export pplb user@ABR2#set router-id 2.2.2.4 user@ABR2#set autonomous-system 2
-
在接口上配置 ISIS、RSVP、MPLS 和 LDP 协议。
[edit protocols] user@ABR2#set isis level 1 disable user@ABR2#set isis interface all user@ABR2#set isis export allow-lo0 user@ABR2#set isis topologies ipv6-unicast user@ABR2#set rsvp interface all user@ABR2#set ldp interface all user@ABR2#set mpls label-switched-path toASBR1-bronze to 2.2.2.1 user@ABR2#set mpls interface all
-
配置 BGP 标记单播,以将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols] user@ABR2#set bgp group toAs2RR type internal user@ABR2#set bgp group toAs2RR local-address 2.2.2.4 user@ABR2#set bgp group toAs2RR advertise-inactive user@ABR2#set bgp group toAs2RR family inet labeled-unicast add-path receive user@ABR2#set bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 user@ABR2#set bgp group toAs2RR family inet labeled-unicast rib inet.3 user@ABR2#set bgp group toAs2RR export nhs user@ABR2#set bgp group toAs2RR cluster 2.2.2.4 user@ABR2#set bgp group toAs2RR neighbor 2.2.2.6 user@ABR2#set bgp group toAs2RR neighbor 2.2.2.7 user@ABR2#set bgp traceoptions file bgp.log user@ABR2#set bgp traceoptions file size 100m user@ABR2#set bgp traceoptions flag state detail user@ABR2#set bgp traceoptions flag policy
结果
在配置模式下,输入 、 show policy-options
show routing-options
和show protocols
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/2 { description ABR2-to-P2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.14/31; } family iso; family mpls; } } ge-0/0/4 { description ABR2-to-P1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.11/31; } family iso; family mpls; } } lo0 { unit 0 { family inet { address 2.2.2.4/32; } family iso { address 49.0000.0000.aaaa.0004.00; } } } } policy-options { policy-statement allow-lo0 { term 1 { from interface lo0.0; then accept; } term 2 { then reject; } } policy-statement nhs { term 1 { from protocol bgp; then { next-hop self; accept; } } } policy-statement pplb { then { load-balance per-packet; } } } routing-options { forwarding-table { export pplb; } router-id 2.2.2.4; autonomous-system 2; } protocols { isis { level 1 disable; interface all; export allow-lo0; topologies ipv6-unicast; } rsvp { interface all; } bgp { group toAs2RR { type internal; local-address 2.2.2.4; advertise-inactive; family inet { labeled-unicast { add-path { receive; send { path-count 4; } } rib { inet.3; } } } export nhs; cluster 2.2.2.4; neighbor 2.2.2.6; neighbor 2.2.2.7; } traceoptions { file bgp.log size 100m; flag state detail; flag policy; } } ldp { interface all; } mpls { label-switched-path toASBR1-bronze { to 2.2.2.1; } interface all; } }
配置 P2 设备
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 P2:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@P2#set ge-0/0/1 description P2-to-ABR1 user@P2#set ge-0/0/1 vlan-tagging user@P2#set ge-0/0/1 unit 0 vlan-id 100 user@P2#set ge-0/0/1 unit 0 family inet address 192.168.0.13/31 user@P2#set ge-0/0/1 unit 0 family iso user@P2#set ge-0/0/1 unit 0 family mpls user@P2#set ge-0/0/2 description P2-to-ABR2 user@P2#set ge-0/0/2 vlan-tagging user@P2#set ge-0/0/2 unit 0 vlan-id 100 user@P2#set ge-0/0/2 unit 0 family inet address 192.168.0.15/31 user@P2#set ge-0/0/2 unit 0 family iso user@P2#set ge-0/0/2 unit 0 family mpls user@P2#set ge-0/0/3 description P2-to-RR2 user@P2#set ge-0/0/3 vlan-tagging user@P2#set ge-0/0/3 unit 0 vlan-id 100 user@P2#set ge-0/0/3 unit 0 family inet address 192.168.0.16/31 user@P2#set ge-0/0/3 unit 0 family iso user@P2#set ge-0/0/3 unit 0 family mpls user@P2#set ge-0/0/4 description P2-to-ASBR1 user@P2#set ge-0/0/4 vlan-tagging user@P2#set ge-0/0/4 unit 0 vlan-id 100 user@P2#set ge-0/0/4 unit 0 family inet address 192.168.0.18/31 user@P2#set ge-0/0/4 unit 0 family iso user@P2#set ge-0/0/4 unit 0 family mpls user@P2#set ge-0/0/5 description P2-to-ASBR2 user@P2#set ge-0/0/5 vlan-tagging user@P2#set ge-0/0/5 unit 0 vlan-id 100 user@P2#set ge-0/0/5 unit 0 family inet address 192.168.0.20/31 user@P2#set ge-0/0/5 unit 0 family iso user@P2#set ge-0/0/5 unit 0 family mpls
-
将环路接口配置为用作 LDP 和 BGP 会话的路由器 ID 和终端接口。
[edit interfaces] user@P2#set lo0 unit 0 family inet address 2.2.2.9/32 user@P2#set lo0 unit 0 family iso address 49.0000.0000.aaaa.0009.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@P2#set policy-statement allow-lo0 term 1 from interface lo0.0 user@P2#set policy-statement allow-lo0 term 1 then accept user@P2#set policy-statement allow-lo0 term 2 then reject
-
配置路由选项。
[edit routing-options] user@P2#set router-id 2.2.2.9
-
在接口上配置 ISIS、RSVP、MPLS 和 LDP 协议。
[edit protocols] user@P2#set isis level 1 disable user@P2#set isis interface all user@P2#set isis export allow-lo0 user@P2#set isis topologies ipv6-unicast user@P2#set rsvp interface all user@P2#set ldp interface all user@P2#set mpls interface all
结果
在配置模式下,输入 、 show policy-options
show routing-options
和show protocols
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/1 { description P2-to-ABR1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.13/31; } family iso; family mpls; } } ge-0/0/2 { description P2-to-ABR2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.15/31; } family iso; family mpls; } } ge-0/0/3 { description P2-to-RR2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.16/31; } family iso; family mpls; } } ge-0/0/4 { description P2-to-ASBR1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.18/31; } family iso; family mpls; } } ge-0/0/5 { description P2-to-ASBR2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.20/31; } family iso; family mpls; } } lo0 { unit 0 { family inet { address 2.2.2.9/32; } family iso { address 49.0000.0000.aaaa.0009.00; } } } } policy-options { policy-statement allow-lo0 { term 1 { from interface lo0.0; then accept; } term 2 { then reject; } } } routing-options { router-id 2.2.2.9; } protocols { isis { level 1 disable; interface all; export allow-lo0; topologies ipv6-unicast; } rsvp { interface all; } ldp { interface all; } mpls { interface all; } }
配置 RR2 设备
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 RR2:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@RR2#set ge-0/0/3 description RR2-to-P2 user@RR2#set ge-0/0/3 vlan-tagging user@RR2#set ge-0/0/3 unit 0 vlan-id 100 user@RR2#set ge-0/0/3 unit 0 family inet address 192.168.0.17/31 user@RR2#set ge-0/0/3 unit 0 family iso user@RR2#set ge-0/0/3 unit 0 family mpls
-
将环路接口配置为用作 LDP 和 BGP 会话的路由器 ID 和终端接口。
[edit interfaces] user@RR2#set lo0 unit 1 family inet address 2.2.2.7/32 user@RR2#set lo0 unit 1 family iso address 49.0000.0000.aaaa.0007.00
-
配置多路径解析策略,将分层多路径安装到 PFE 中。
[edit policy-options] user@RR2#set policy-statement allow-lo0 term 1 from interface lo0.1 user@RR2#set policy-statement allow-lo0 term 1 then accept user@RR2#set policy-statement allow-lo0 term 2 then reject user@RR2#set policy-statement export-inet3 term 1 from rib inet.3 user@RR2#set policy-statement export-inet3 term 1 then accept user@RR2#set policy-statement export-inet3 term 2 then reject user@RR2#set policy-statement pplb then load-balance per-packet
-
按流应用负载平衡策略,以启用流量保护。
[edit routing-options] user@RR2#set forwarding-table export pplb user@RR2#set interface-routes rib-group inet inet0to3 user@RR2#set router-id 2.2.2.7 user@RR2#set autonomous-system 2 user@RR2#set rib-groups inet0to3 import-rib inet.0 user@RR2#set rib-groups inet0to3 import-rib inet.3 user@RR2#set rib-groups inet0to3 import-policy allow-lo0
-
在接口上配置 ISIS、RSVP、MPLS 和 LDP 协议。
[edit protocols] user@RR2#set isis level 1 disable user@RR2#set isis interface all user@RR2#set isis export allow-lo0 user@RR2#set isis topologies ipv6-unicast user@RR2#set rsvp interface all user@RR2#set ldp interface all user@RR2#set mpls interface all
-
配置 BGP 标记单播,以将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols] user@RR2#set bgp path-selection external-router-id user@RR2#set bgp group toAs2Reg1BNs type internal user@RR2#set bgp group toAs2Reg1BNs family inet labeled-unicast add-path receive user@RR2#set bgp group toAs2Reg1BNs family inet labeled-unicast add-path send path-count 4 user@RR2#set bgp group toAs2Reg1BNs family inet labeled-unicast rib inet.3 user@RR2#set bgp group toAs2Reg1BNs neighbor 2.2.2.1 user@RR2#set bgp group toAs2Reg1BNs neighbor 2.2.2.2 user@RR2#set bgp group toAs2Reg1BNs neighbor 2.2.2.3 user@RR2#set bgp group toAs2Reg1BNs neighbor 2.2.2.4 user@RR2#set bgp traceoptions file bgp.log user@RR2#set bgp traceoptions file size 100m user@RR2#set bgp traceoptions flag state detail user@RR2#set bgp traceoptions flag policy user@RR2#set bgp local-address 2.2.2.7 user@RR2#set bgp cluster 2.2.2.7
结果
在配置模式下,输入 、 show policy-options
show routing-options
和show protocols
命令,show interfaces
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
interfaces { ge-0/0/3 { description RR2-to-P2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.17/31; } family iso; family mpls; } } lo0 { unit 1 { family inet { address 2.2.2.7/32; } family iso { address 49.0000.0000.aaaa.0007.00; } } } } policy-options { policy-statement allow-lo0 { term 1 { from interface lo0.1; then accept; } term 2 { then reject; } } policy-statement export-inet3 { term 1 { from rib inet.3; then accept; } term 2 { then reject; } } policy-statement pplb { then { load-balance per-packet; } } } routing-options { forwarding-table { export pplb; } interface-routes { rib-group inet inet0to3; } router-id 2.2.2.7; autonomous-system 2; rib-groups { inet0to3 { import-rib [ inet.0 inet.3 ]; import-policy allow-lo0; } } } protocols { isis { level 1 disable; interface all; export allow-lo0; topologies ipv6-unicast; } rsvp { interface all; } bgp { path-selection external-router-id; group toAs2Reg1BNs { type internal; family inet { labeled-unicast { add-path { receive; send { path-count 4; } } rib { inet.3; } } } neighbor 2.2.2.1; neighbor 2.2.2.2; neighbor 2.2.2.3; neighbor 2.2.2.4; } traceoptions { file bgp.log size 100m; flag state detail; flag policy; } local-address 2.2.2.7; cluster 2.2.2.7; } ldp { interface all; } mpls { interface all; } }
验证
确认配置工作正常。
验证 Nexthops 是否已解决
目的
验证 PE2 和 PE3 下一个操作是否已在 PE1 上解析。
行动
在操作模式下,运行 show route forwarding-table destination
命令。
user@PE1> show route forwarding-table destination 10.3.3.3 extensive table default | match Weight Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x4000 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1
user@PE1> show route forwarding-table destination 10.3.3.3 extensive table red | match Weight Weight: 0x1 Weight: 0x1 Next-hop interface: ge-0/0/3.0 Weight: 0x1 Weight: 0x4000 Weight: 0x4000 Next-hop interface: ge-0/0/3.0 Weight: 0x4000
含义
您可以看到权重, 0x1
以及 0x4000
主要和备用下一个操作。
验证路由表中的下一跳条目
目的
在 PE1 验证活动的下一跳路由条目。
行动
在操作模式下,运行 show route extensive expanded-nh
命令。
user@PE1> show route 10.3.3.3 extensive expanded-nh inet.0: 36 destinations, 65 routes (36 active, 0 holddown, 0 hidden) 10.3.3.3/32 (2 entries, 1 announced) Installed-nexthop: List (0xd6ba4b8) Index:1048626 Indr (0xc593cac) 10.1.1.1 Krt_inh (0xcc14684) Index:1048614 List (0xc4cf7b4) Index:1048613 Frr_inh (0xc592730) Index:1048608 Chain (0xc59334c) Index:651 Push 300368 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc592604) Index:1048609 Chain (0xc5924d8) Index:649 Push 300384 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc592154) Index:1048611 Chain (0xc591bdc) Index:654 Push 300368 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 Frr_inh (0xc5921b8) Index:1048612 Chain (0xc591a4c) Index:655 Push 300384 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 Indr (0xc593ab8) 10.1.1.2 Krt_inh (0xcc14f84) Index:1048624 List (0xc4d0074) Index:1048623 Frr_inh (0xc5939f0) Index:1048619 Chain (0xc592ab4) Index:638 Push 300144 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc593a54) Index:1048620 Chain (0xc591efc) Index:637 Push 300160 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc59172c) Index:1048589 Chain (0xc5903a4) Index:640 Push 300144 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 Frr_inh (0xc59159c) Index:1048590 Chain (0xc58fa44) Index:639 Push 300160 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 TSI: <SNIP> Protocol next hop: 10.1.1.1 Indirect next hop: 0xcc14684 1048614 INH Session ID: 0x146 Weight 0x1 Protocol next hop: 10.1.1.2 Indirect next hop: 0xcc14f84 1048624 INH Session ID: 0x145 Weight 0x4000 State: >Active Ext> Local AS: 65002 Peer AS: 65001 <SNIP> Indirect next hops: 2 Protocol next hop: 10.1.1.1 Metric: 1 Indirect next hop: 0xcc14684 1048614 INH Session ID: 0x146 Weight 0x1 Indirect path forwarding next hops (Merged): 4 <SNIP> Protocol next hop: 10.1.1.2 Metric: 1 Indirect next hop: 0xcc14f84 1048624 INH Session ID: 0x145 Weight 0x4000 Indirect path forwarding next hops (Merged): 4
含义
您可以看到主要和0x4000
备用下一步的权重0x1
。
BGP L2VPN 和 VPLS 的 FAT 伪线支持概述
伪线是在 MPLS 数据包交换网络 (PSN) 上模拟电信服务(如 T1 线路)的基本属性的第 2 层电路或服务。伪线旨在提供最少的必要功能,以模拟符合给定服务定义所需弹性要求的线路。
在 MPLS 网络中,伪线流标签的流感知传输 (FAT) 用于在第 2 层虚拟专用网络 (L2VPN) 和虚拟专用 LAN 服务 (VPLS) 的 BGP 信号伪线之间负载均衡流量(如 draft-keyupdate-l2vpn-l2vpn)所述。
仅在标签边缘路由器 (LE) 上配置 FAT 流标签。这会使传输路由器或标签交换路由器 (LSR) 跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 对 MPLS 数据包执行负载平衡,而无需对有效负载进行深度包检测。
FAT 流标签可用于 VPWS 和 VPLS 伪线的 LDP 信号转发对等类(FEC 128 和 FEC 129) 伪线。接口参数(子TLV)可用于 FEC 128 和 FEC 129 伪线。为 LDP 定义的子TLV包含传输 (T) 位和接收 (R) 位。T 位播发推送流标签的能力。R 位播发弹出流标签的能力。默认情况下,对于任何一个伪线,提供商边缘 (PE) 路由器的信令行为是将标签集中的 T 和 R 位播发为 0。
和flow-label-transmit
flow-label-receive
配置语句提供了在子TLV字段中将 T 位和 R 位播发设置为 1 的能力,这是 LDP 标签映射消息 FEC 接口参数的一部分。您可以使用这些语句来控制将负载平衡标签推送给控制平面中的路由对等方,以用于 L2VPN 和 VPLS 等 BGP 信号伪线。
另请参阅
为 BGP L2VPN 配置 FAT 伪线支持,以平衡 MPLS 流量负载
仅在标签边缘路由器 (LE) 上配置的 BGP 信号伪线(如 L2VPN)支持流感知传输 (FAT) 或流标签。这使得传输路由器或标签交换路由器 (LSR) 能够跨等价多路径路径 (ECMP) 或链路聚合组 (LAG) 对 MPLS 数据包执行负载平衡,而无需对有效负载进行深度数据包检测。FAT 伪线或流标签可与具有转发同等等级(FEC128 和 FEC129) 的 LDP 信号 L2VPN 配合使用,并且扩展了对 BGP 信号伪线(用于点对点或点到多点 2 层服务)对流标签的支持。
为 BGP L2VPN 配置 FAT 伪线支持以均衡 MPLS 流量负载之前:
配置设备接口并在所有接口上启用 MPLS。
配置 RSVP。
配置 MPLS 和 LSP 到远程 PE 路由器。
配置 BGP 和 OSPF。
要为 BGP L2VPN 配置 FAT 伪线支持,以均衡 MPLS 流量的负载,您必须请执行以下操作:
另请参阅
示例:为 BGP L2VPN 配置 FAT 伪线支持,以平衡 MPLS 流量负载
此示例说明如何对 BGP L2VPN 实施 FAT 伪线支持,以帮助实现 MPLS 流量负载均衡。
要求
此示例使用以下硬件和软件组件:
五台 MX 系列路由器
在所有设备上运行的 Junos OS 16.1 或更高版本
为 BGP L2VPN 配置 FAT 伪线支持之前,请确保配置路由和信令协议。
概述
Junos OS 允许仅在标签边缘路由器 (LE) 上配置 BGP 信号伪线(如 L2VPN)支持的流感知传输 (FAT) 流标签。这会使传输路由器或标签交换路由器 (LSR) 跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 对 MPLS 数据包执行负载平衡,而无需对有效负载进行深度包检测。FAT 流标签可用于 VPWS 和 VPLS 伪线的 LDP 信号转发同等类(FEC 128 和 FEC 129) 伪线。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit] CLI 中,然后从配置模式进入 commit
。
CE1
set interfaces ge-0/0/0 vlan-tagging set interfaces ge-0/0/0 unit 600 vlan-id 600 set interfaces ge-0/0/0 unit 600 family inet address 10.1.1.1/24 set interfaces lo0 unit 0 family inet address 10.255.255.8/32
PE1
set interfaces ge-0/0/0 vlan-tagging set interfaces ge-0/0/0 mtu 1600 set interfaces ge-0/0/0 encapsulation vlan-ccc set interfaces ge-0/0/0 unit 300 encapsulation vlan-ccc set interfaces ge-0/0/0 unit 300 vlan-id 600 set interfaces ge-0/0/0 unit 600 encapsulation vlan-vpls set interfaces ge-0/0/0 unit 600 vlan-id 600 set interfaces ge-0/0/0 unit 600 family vpls set interfaces ge-0/0/1 unit 0 family inet address 1.0.0.1/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.255.1/32 set routing-options nonstop-routing set routing-options router-id 10.255.255.1 set routing-options autonomous-system 100 set routing-options forwarding-table export exp-to-frwd set protocols rsvp interface all set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols mpls label-switched-path to-pe2 to 10.255.255.4 set protocols mpls interface ge-0/0/1.0 set protocols bgp group vpls-pe type internal set protocols bgp group vpls-pe local-address 10.255.255.1 set protocols bgp group vpls-pe family l2vpn auto-discovery-only set protocols bgp group vpls-pe family l2vpn signaling set protocols bgp group vpls-pe neighbor 10.255.255.4 set protocols bgp group vpls-pe neighbor 10.255.255.2 set protocols ospf traffic-engineering 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 set policy-options policy-statement exp-to-frwd term 0 from community vpls-com set policy-options policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe2 set policy-options policy-statement exp-to-frwd term 0 then accept set policy-options community vpls-com members target:100:100 set routing-instances l2vpn-inst instance-type l2vpn set routing-instances l2vpn-inst interface ge-0/0/0.300 set routing-instances l2vpn-inst route-distinguisher 10.255.255.1:200 set routing-instances l2vpn-inst vrf-target target:100:100 set routing-instances l2vpn-inst protocols l2vpn encapsulation-type ethernet-vlan set routing-instances l2vpn-inst protocols l2vpn site pe1 site-identifier 1 set routing-instances l2vpn-inst protocols l2vpn site pe1 interface ge-0/0/0.300 remote-site-id 2 set routing-instances l2vpn-inst protocols l2vpn flow-label-transmit set routing-instances l2vpn-inst protocols l2vpn flow-label-receive set routing-instances vpl1 instance-type vpls set routing-instances vpl1 interface ge-0/0/0.600 set routing-instances vpl1 route-distinguisher 10.255.255.1:100 set routing-instances vpl1 vrf-target target:100:100 set routing-instances vpl1 protocols vpls site-range 10 set routing-instances vpl1 protocols vpls no-tunnel-services set routing-instances vpl1 protocols vpls site vpl1PE1 site-identifier 1 set routing-instances vpl1 protocols vpls flow-label-transmit set routing-instances vpl1 protocols vpls flow-label-receive
P
set interfaces ge-0/0/0 unit 0 family inet address 1.0.0.2/24 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 family inet address 2.0.0.1/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.255.2/32 set routing-options router-id 10.255.255.2 set routing-options autonomous-system 100 set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface lo0.0 set protocols mpls interface ge-0/0/0.0 set protocols mpls interface ge-0/0/1.0 set protocols bgp group vpls-pe type internal set protocols bgp group vpls-pe local-address 10.255.255.2 set protocols bgp group vpls-pe family l2vpn signaling set protocols bgp group vpls-pe neighbor 10.255.255.1 set protocols bgp group vpls-pe neighbor 10.255.255.4 deactivate protocols bgp set protocols ospf traffic-engineering 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 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
PE2
set interfaces ge-0/0/0 unit 0 family inet address 2.0.0.2/24 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 mtu 1600 set interfaces ge-0/0/1 encapsulation vlan-ccc set interfaces ge-0/0/1 unit 300 encapsulation vlan-ccc set interfaces ge-0/0/1 unit 300 vlan-id 600 set interfaces ge-0/0/1 unit 600 encapsulation vlan-vpls set interfaces ge-0/0/1 unit 600 vlan-id 600 set interfaces ge-0/0/1 unit 600 family vpls set interfaces lo0 unit 0 family inet address 10.255.255.4/32 set routing-options router-id 10.255.255.4 set routing-options autonomous-system 100 set routing-options forwarding-table export exp-to-frwd set protocols rsvp interface all set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols mpls label-switched-path to-pe1 to 10.255.255.1 set protocols mpls interface ge-0/0/0.0 set protocols bgp group vpls-pe type internal set protocols bgp group vpls-pe local-address 10.255.255.4 set protocols bgp group vpls-pe family l2vpn auto-discovery-only set protocols bgp group vpls-pe family l2vpn signaling set protocols bgp group vpls-pe neighbor 10.255.255.1 set protocols bgp group vpls-pe neighbor 10.255.255.2 set protocols ospf traffic-engineering 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 set policy-options policy-statement exp-to-frwd term 0 from community vpls-com set policy-options policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe1 set policy-options policy-statement exp-to-frwd term 0 then accept set policy-options community vpls-com members target:100:100 set routing-instances l2vpn-inst instance-type l2vpn set routing-instances l2vpn-inst interface ge-0/0/1.300 set routing-instances l2vpn-inst route-distinguisher 10.255.255.4:200 set routing-instances l2vpn-inst vrf-target target:100:100 set routing-instances l2vpn-inst protocols l2vpn encapsulation-type ethernet-vlan set routing-instances l2vpn-inst protocols l2vpn site pe2 site-identifier 2 set routing-instances l2vpn-inst protocols l2vpn site pe2 interface ge-0/0/1.300 remote-site-id 1 set routing-instances l2vpn-inst protocols l2vpn flow-label-transmit set routing-instances l2vpn-inst protocols l2vpn flow-label-receive set routing-instances vpl1 instance-type vpls set routing-instances vpl1 interface ge-0/0/1.600 set routing-instances vpl1 route-distinguisher 10.255.255.4:100 set routing-instances vpl1 vrf-target target:100:100 set routing-instances vpl1 protocols vpls site-range 10 set routing-instances vpl1 protocols vpls no-tunnel-services set routing-instances vpl1 protocols vpls site vpl1PE2 site-identifier 2 set routing-instances vpl1 protocols vpls flow-label-transmit set routing-instances vpl1 protocols vpls flow-label-receive deactivate routing-instances vpl1
CE2
set interfaces ge-0/0/0 vlan-tagging set interfaces ge-0/0/0 unit 600 vlan-id 600 set interfaces ge-0/0/0 unit 600 family inet address 10.1.1.2/24 set interfaces lo0 unit 0 family inet address 10.255.255.9/32
配置 PE1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 PE1:
配置接口。
[edit interfaces] user@PE1# set ge-0/0/0 vlan-tagging user@PE1# set ge-0/0/0 mtu 1600 user@PE1# set ge-0/0/0 encapsulation vlan-ccc user@PE1# set ge-0/0/0 unit 300 encapsulation vlan-ccc user@PE1# set ge-0/0/0 unit 300 vlan-id 600 user@PE1# set ge-0/0/0 unit 600 encapsulation vlan-vpls user@PE1# set ge-0/0/0 unit 600 vlan-id 600 user@PE1# set ge-0/0/0 unit 600 family vpls deactivate interfaces ge-0/0/0 unit 600 user@PE1# set ge-0/0/1 unit 0 family inet address 1.0.0.1/24 user@PE1# set ge-0/0/1 unit 0 family mpls user@PE1# set lo0 unit 0 family inet address 10.255.255.1/32
配置不间断路由并配置路由器 ID。
[edit routing-options] user@PE1# set nonstop-routing user@PE1# set router-id 10.255.255.1
配置自治系统 (AS) 编号,并使用导出语句将策略应用于本地路由器的转发表。
[edit routing-options] user@PE1# set autonomous-system 100 user@PE1# set forwarding-table export exp-to-frwd
在接口上配置 RSVP 协议。
[edit protocols rsvp] user@PE1# set interface all user@PE1# set interface ge-0/0/1.0 user@PE1# set interface lo0.0
将标签交换路径属性应用于 MPLS 协议,然后配置接口。
[edit protocols mpls] user@PE1# set label-switched-path to-pe2 to 10.255.255.4 user@PE1# set interface ge-0/0/1.0
定义一个对等组,并为对等组
vpls-pe
配置 BGP 会话本地端地址的地址。[edit protocols bgp group vpls-pe] user@PE1# set type internal user@PE1# set local-address 10.255.255.1
为更新中的 NLR 配置协议家族的属性。
[edit protocols bgp group vpls-pe] user@PE1# set family l2vpn auto-discovery-only user@PE1# set family l2vpn signaling
为对等组配置邻接方
vpls-pe
。[edit protocols bgp group vpls-pe] user@PE1# set neighbor 10.255.255.4 user@PE1# set neighbor 10.255.255.2
配置流量工程,并配置 OSPF 区域 0.0.0.0.0 的接口。
[edit protocols ospf] user@PE1# set traffic-engineering user@PE1# set area 0.0.0.0 interface lo0.0 passive user@PE1# set area 0.0.0.0 interface ge-0/0/1.0
配置路由策略和 BGP 社区信息。
[edit policy-options] user@PE1# set policy-statement exp-to-fwd term 0 from community vpls-com user@PE1# set policy-statement exp-to-fwd term 0 then install-nexthop lsp to-pe2 user@PE1# set policy-statement exp-to-fwd term 0 then accept user@PE1# set community vpls-com members target:100:100
配置路由实例类型,然后配置接口。
[edit routing-instances l2vpn-inst] user@PE1# set instance-type l2vpn user@PE1# set interface ge-0/0/0.300
例如
l2vpn-inst
,配置路由识别器,并配置 VRF 目标社区。[edit routing-instances l2vpn-inst] user@PE1# set route-distinguisher 10.255.255.1:200 user@PE1# set vrf-target target:100:100
配置 L2VPN 协议所需的封装类型。
[edit routing-instances l2vpn-inst protocols l2vpn] user@PE1# set encapsulation-type ethernet-vlan
配置连接到提供商设备的站点。
[edit routing-instances l2vpn-inst protocols l2vpn] user@PE1# set site pe1 site-identifier 1 user@PE1# set site pe1 interface ge-0/0/0.300 remote-site-id 2
配置路由实例的 L2VPN 协议,以提供广告功能,以将接收方向上的流标签弹出至远程 PE,并提供广告功能,将传输方向上的流标签推送到远程 PE。
[edit routing-instances l2vpn-inst protocols l2vpn] user@PE1# set flow-label-transmit user@PE1# set flow-label-receive
配置路由实例类型,然后配置接口。
[edit routing-instances vpl1] user@PE1# set instance-type vpls user@PE1# set interface ge-0/0/0.600
例如
vp1
,配置路由识别器,并配置 VRF 目标社区。[edit routing-instances vpl1] user@PE1# set route-distinguisher 10.255.255.1:100 user@PE1# set vrf-target target:100:100
分配 VPLS 域的最大站点标识符。
[edit routing-instances vpl1 protocols vpls] user@PE1# set site-range 10
配置为不使用 VPLS 实例的隧道服务,并将站点标识符分配给连接到提供商设备的站点。
[edit routing-instances vpl1 protocols vpls] user@PE1# set no-tunnel-services user@PE1# set site vpl1PE1 site-identifier 1
配置路由实例的 VPLS 协议,以提供广告功能,以将接收方向上的流标签弹出至远程 PE,并提供广告功能,将传输方向上的流标签推送到远程 PE。
[edit routing-instances vpl1 protocols vpls] user@PE1# set flow-label-transmit user@PE1# set flow-label-receive
结果
在配置模式下,输入 、 show interfacesshow protocols、 show policy-options、 show routing-instances和show routing-options命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@PE1# show interfaces ge-0/0/0 { vlan-tagging; mtu 1600; encapsulation vlan-ccc; unit 300 { encapsulation vlan-ccc; vlan-id 600; } unit 600 { encapsulation vlan-vpls; vlan-id 600; family vpls; } } ge-0/0/1 { unit 0 { family inet { address 1.0.0.1/24; } family mpls; } } lo0 { unit 0 { family inet { address 10.255.255.1/32; } } }
user@PE1# show protocols rsvp { interface all; interface ge-0/0/1.0; interface lo0.0; } mpls { label-switched-path to-pe2 { to 10.255.255.4; } interface ge-0/0/1.0; } bgp { group vpls-pe { type internal; local-address 10.255.255.1; family l2vpn { auto-discovery-only; signaling; } neighbor 10.255.255.4; neighbor 10.255.255.2; } } ospf { traffic-engineering; area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/1.0; } }
user@PE1# show policy-options policy-statement exp-to-frwd { term 0 { from community vpls-com; then { install-nexthop lsp to-pe2; accept; } } } community vpls-com members target:100:100;
user@PE1# show routing-instances l2vpn-inst { instance-type l2vpn; interface ge-0/0/0.300; route-distinguisher 10.255.255.1:200; vrf-target target:100:100; protocols { l2vpn { encapsulation-type ethernet-vlan; site pe1 { site-identifier 1; interface ge-0/0/0.300 { remote-site-id 2; } } flow-label-transmit; flow-label-receive; } } } vpl1 { instance-type vpls; interface ge-0/0/0.600; route-distinguisher 10.255.255.1:100; vrf-target target:100:100; protocols { vpls { site-range 10; no-tunnel-services; site vpl1PE1 { site-identifier 1; } flow-label-transmit; flow-label-receive; } } }
user@PE1# show routing-options nonstop-routing; router-id 10.255.255.1; autonomous-system 100; forwarding-table { export exp-to-frwd; }
验证
确认配置工作正常。
验证 BGP 摘要信息
目的
验证 BGP 摘要信息。
行动
在操作模式下,输入 show bgp summary
命令。
user@PE1> show bgp summary
Groups: 1 Peers: 2 Down peers: 1
Table Tot Paths Act Paths Suppressed History Damp State Pending
bgp.l2vpn.0
1 1 0 0 0 0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
10.255.255.2 100 0 0 0 0 2d 12:54:28 Active
10.255.255.4 100 8121 8093 0 0 2d 12:53:56 Establ
bgp.l2vpn.0: 1/1/1/0
l2vpn-inst.l2vpn.0: 1/1/1/0
含义
输出显示 BGP 摘要信息。
验证 L2VPN 连接信息
目的
验证第 2 层 VPN 连接信息。
行动
在操作模式下,运行 show l2vpn connections
命令以显示第 2 层 VPN 连接信息。
user@PE1> show l2vpn connections
Layer-2 VPN connections:
Legend for connection status (St)
EI -- encapsulation invalid NC -- interface encapsulation not CCC/TCC/VPLS
EM -- encapsulation mismatch WE -- interface and instance encaps not same
VC-Dn -- Virtual circuit down NP -- interface hardware not present
CM -- control-word mismatch -> -- only outbound connection is up
CN -- circuit not provisioned <- -- only inbound connection is up
OR -- out of range Up -- operational
OL -- no outgoing label Dn -- down
LD -- local site signaled down CF -- call admission control failure
RD -- remote site signaled down SC -- local and remote site ID collision
LN -- local site not designated LM -- local site ID not minimum designated
RN -- remote site not designated RM -- remote site ID not minimum designated
XX -- unknown connection status IL -- no incoming label
MM -- MTU mismatch MI -- Mesh-Group ID not available
BK -- Backup connection ST -- Standby connection
PF -- Profile parse failure PB -- Profile busy
RS -- remote site standby SN -- Static Neighbor
LB -- Local site not best-site RB -- Remote site not best-site
VM -- VLAN ID mismatch
Legend for interface status
Up -- operational
Dn -- down
Instance: l2vpn-inst
Edge protection: Not-Primary
Local site: pe1 (1)
connection-site Type St Time last up # Up trans
2 rmt Up Jun 22 14:46:50 2015 1
Remote PE: 10.255.255.4, Negotiated control-word: Yes (Null)
Incoming label: 800003, Outgoing label: 800002
Local interface: ge-0/0/0.300, Status: Up, Encapsulation: VLAN
Flow Label Transmit: Yes, Flow Label Receive: Yes
含义
输出显示第 2 层 VPN 连接信息以及流标签传输和流标签接收信息。
验证路由
目的
验证是否已学习到预期的路由。
行动
在操作模式下,运行 show route
命令以显示路由表中的路由。
user@PE1> show route
inet.0: 51 destinations, 51 routes (51 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
1.0.0.0/24 *[Direct/0] 2d 12:48:34
> via ge-0/0/1.0
1.0.0.1/32 *[Local/0] 2d 12:48:34
Local via ge-0/0/1.0
2.0.0.0/24 *[OSPF/10] 2d 12:48:24, metric 2
> to 1.0.0.2 via ge-0/0/1.0
10.4.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.5.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.6.128.0/17 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.9.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.10.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.13.4.0/23 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.13.10.0/23 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.82.0.0/15 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.84.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.85.12.0/22 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.92.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.94.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.99.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.102.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.102.160.0/19 *[Direct/0] 2d 12:48:34
> via fxp0.0
10.102.169.99/32 *[Local/0] 2d 12:48:34
Local via fxp0.0
10.150.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.155.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.157.64.0/19 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.160.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.204.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.205.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.206.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.207.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.209.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.212.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.213.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.214.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.215.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.216.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.218.13.0/24 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.218.14.0/24 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.218.16.0/20 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.218.32.0/20 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.227.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
10.255.255.1/32 *[Direct/0] 2d 12:48:34
> via lo0.0
10.255.255.2/32 *[OSPF/10] 2d 12:48:24, metric 1
> to 1.0.0.2 via ge-0/0/1.0
10.255.255.4/32 *[OSPF/10] 2d 12:48:24, metric 2
> to 1.0.0.2 via ge-0/0/1.0
128.102.161.191/32 *[OSPF/10] 2d 12:48:24, metric 1
> to 1.0.0.2 via ge-0/0/1.0
128.102.169.99/32 *[Direct/0] 2d 12:48:34
> via lo0.0
128.102.171.41/32 *[OSPF/10] 2d 12:48:24, metric 2
> to 1.0.0.2 via ge-0/0/1.0
172.16.0.0/12 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
192.168.0.0/16 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
192.168.102.0/23 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
207.17.136.0/24 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
207.17.136.192/32 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
207.17.137.0/24 *[Static/5] 2d 12:48:34
> to 10.102.191.254 via fxp0.0
224.0.0.5/32 *[OSPF/10] 2d 12:48:34, metric 1
MultiRecv
inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.255.255.4/32 *[RSVP/7/1] 2d 12:48:04, metric 2
> to 1.0.0.2 via ge-0/0/1.0, label-switched-path to-pe2
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
47.0005.80ff.f800.0000.0108.0001.1281.0216.9099/152
*[Direct/0] 2d 12:48:34
> via lo0.0
mpls.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0 *[MPLS/0] 2d 12:48:34, metric 1
Receive
1 *[MPLS/0] 2d 12:48:34, metric 1
Receive
2 *[MPLS/0] 2d 12:48:34, metric 1
Receive
13 *[MPLS/0] 2d 12:48:34, metric 1
Receive
800003 *[L2VPN/7] 2d 12:41:29
> via ge-0/0/0.300, Pop Offset: 4
ge-0/0/0.300 *[L2VPN/7] 2d 12:41:29, metric2 2
> to 1.0.0.2 via ge-0/0/1.0, label-switched-path to-pe2
inet6.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
abcd::128:102:169:99/128
*[Direct/0] 2d 12:48:34
> via lo0.0
fe80::5668:a60f:fc6b:eb97/128
*[Direct/0] 2d 12:48:34
> via lo0.0
bgp.l2vpn.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.255.255.4:200:2:1/96
*[BGP/170] 2d 12:41:35, localpref 100, from 10.255.255.4
AS path: I, validation-state: unverified
> to 1.0.0.2 via ge-0/0/1.0, label-switched-path to-pe2
l2vpn-inst.l2vpn.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.255.255.1:200:1:1/96
*[L2VPN/170/-101] 2d 12:41:29, metric2 1
Indirect
10.255.255.4:200:2:1/96
*[BGP/170] 2d 12:41:35, localpref 100, from 10.255.255.4
AS path: I, validation-state: unverified
> to 1.0.0.2 via ge-0/0/1.0, label-switched-path to-pe2
l2vpn-inst.l2id.0: 2 destinations, 3 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
1 *[L2VPN/170/-101] 2d 12:41:29, metric2 1
Indirect
[L2VPN/175] 2d 12:41:29
> via ge-0/0/0.300, Pop Offset: 4
2 *[BGP/170] 2d 12:41:35, localpref 100, from 10.255.255.4
AS path: I, validation-state: unverified
> to 1.0.0.2 via ge-0/0/1.0, label-switched-path to-pe2
含义
输出显示路由表中的所有路由。
配置 PE2
程序
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 PE2:
配置接口。
[edit interfaces] user@PE2# set ge-0/0/0 unit 0 family inet address 2.0.0.2/24 user@PE2# set ge-0/0/0 unit 0 family mpls user@PE2# set ge-0/0/1 vlan-tagging user@PE2# set ge-0/0/1 mtu 1600 user@PE2# set ge-0/0/1 encapsulation vlan-ccc user@PE2# set ge-0/0/1 unit 300 encapsulation vlan-ccc user@PE2# set ge-0/0/1 unit 300 vlan-id 600 user@PE2# set ge-0/0/1 unit 600 encapsulation vlan-vpls user@PE2# set ge-0/0/1 unit 600 vlan-id 600 user@PE2# set ge-0/0/1 unit 600 family vpls deactivate interfaces ge-0/0/1 unit 600 user@PE2# set lo0 unit 0 family inet address 10.255.255.4/32
配置路由器 ID。
[edit routing-options] user@PE2# set router-id 10.255.255.4
配置自治系统 (AS) 编号,并使用导出语句将策略应用于本地路由器的转发表。
[edit routing-options] user@PE2# set autonomous-system 100 user@PE2# set forwarding-table export exp-to-frwd
在接口上配置 RSVP 协议。
[edit protocols rsvp] user@PE2# set interface all user@PE2# set interface ge-0/0/1.0 user@PE2# set interface lo0.0
将标签交换路径属性应用于 MPLS 协议,然后配置接口。
[edit protocols mpls] user@PE2# set label-switched-path to-pe1 to 10.255.255.1 user@PE2# set interface ge-0/0/0.0
定义一个对等组,并为对等组
vpls-pe
配置 BGP 会话的本地端地址。[edit protocols bgp group vpls-pe] user@PE2# set type internal user@PE2# set local-address 10.255.255.4
在更新中为 NLR 配置协议家族的属性。
[edit protocols bgp group vpls-pe] user@PE2# set family l2vpn auto-discovery-only user@PE2# set family l2vpn signaling
为对等组配置邻接方
vpls-pe
。[edit protocols bgp group vpls-pe] user@PE2# set neighbor 10.255.255.1 user@PE2# set neighbor 10.255.255.2
配置流量工程,并配置 OSPF 区域 0.0.0.0.0 的接口。
[edit protocols ospf] user@PE2# set traffic-engineering user@PE2# set area 0.0.0.0 interface lo0.0 passive user@PE2# set area 0.0.0.0 interface ge-0/0/0.0
配置路由策略和 BGP 社区信息。
[edit policy-options] user@PE2# set policy-statement exp-to-frwd term 0 from community vpls-com user@PE2# set policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe1 user@PE2# set policy-statement exp-to-frwd term 0 then accept user@PE2# set community vpls-com members target:100:100
配置路由实例类型,然后配置接口。
[edit routing-instances l2vpn-inst] user@PE2# set instance-type l2vpn user@PE2# set interface ge-0/0/1.300
例如
l2vpn-inst
,配置路由识别器,并配置 VRF 目标社区。[edit routing-instances l2vpn-inst] user@PE2# set route-distinguisher 10.255.255.4:200 user@PE2# set vrf-target target:100:100
配置 L2VPN 协议所需的封装类型。
[edit routing-instances l2vpn-inst protocols l2vpn] user@PE2# set encapsulation-type ethernet-vlan
配置连接到提供商设备的站点。
[edit routing-instances l2vpn-inst protocols l2vpn] user@PE2# set site pe2 site-identifier 2 user@PE2# set site pe2 interface ge-0/0/1.300 remote-site-id 1
配置路由实例的 L2VPN 协议,以提供广告功能,以将接收方向上的流标签弹出至远程 PE,并提供广告功能,将传输方向上的流标签推送到远程 PE。
[edit routing-instances l2vpn-inst protocols l2vpn] user@PE2# set flow-label-transmit user@PE2# set flow-label-receive
配置路由实例类型,然后配置接口。
[edit routing-instances vpl1] user@PE2# set instance-type vpls user@PE2# set interface ge-0/0/1.600
例如
vpl1
,配置路由识别器,并配置 VRF 目标社区。[edit routing-instances vpl1] user@PE2# set route-distinguisher 10.255.255.4:100 user@PE2# set vrf-target target:100:100
分配 VPLS 域的最大站点标识符。
[edit routing-instances vpl1 protocols vpls] user@PE2# set site-range 10
配置为不使用 VPLS 实例的隧道服务,并将站点标识符分配给连接到提供商设备的站点。
[edit routing-instances vpl1 protocols vpls] user@PE2# set no-tunnel-services user@PE2# set site vpl1PE2 site-identifier 2
配置路由实例的 VPLS 协议,以提供广告功能,以将接收方向上的流标签弹出至远程 PE,以及向远程 PE 提供向传输方向的推送流标签的发发功能。
[edit routing-instances vpl1 protocols vpls] user@PE2# set flow-label-transmit user@PE2# set flow-label-receive
结果
在配置模式下,输入 、 show interfacesshow protocols、 show policy-options、 show routing-instances和show routing-options命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@PE2# show interfaces ge-0/0/0 { unit 0 { family inet { address 2.0.0.2/24; } family mpls; } } ge-0/0/1 { vlan-tagging; mtu 1600; encapsulation vlan-ccc; unit 300 { encapsulation vlan-ccc; vlan-id 600; } unit 600 { encapsulation vlan-vpls; vlan-id 600; family vpls; } } lo0 { unit 0 { family inet { address 10.255.255.4/32; } } }
user@PE2# show protocols rsvp { interface all; interface ge-0/0/1.0; interface lo0.0; } mpls { label-switched-path to-pe1 { to 10.255.255.1; } interface ge-0/0/0.0; } bgp { group vpls-pe { type internal; local-address 10.255.255.4; family l2vpn { auto-discovery-only; signaling; } neighbor 10.255.255.1; neighbor 10.255.255.2; } } ospf { traffic-engineering; area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/0.0; } }
user@PE2# show policy-options policy-statement exp-to-frwd { term 0 { from community vpls-com; then { install-nexthop lsp to-pe1; accept; } } } community vpls-com members target:100:100;
user@PE2# show routing-instances l2vpn-inst { instance-type l2vpn; interface ge-0/0/1.300; route-distinguisher 10.255.255.4:200; vrf-target target:100:100; protocols { l2vpn { encapsulation-type ethernet-vlan; site pe2 { site-identifier 2; interface ge-0/0/1.300 { remote-site-id 1; } } flow-label-transmit; flow-label-receive; } } } vpl1 { instance-type vpls; interface ge-0/0/1.600; route-distinguisher 10.255.255.4:100; vrf-target target:100:100; protocols { vpls { site-range 10; no-tunnel-services; site vpl1PE2 { site-identifier 2; } flow-label-transmit; flow-label-receive; } } }
user@PE2# show routing-options router-id 10.255.255.4; autonomous-system 100; forwarding-table { export exp-to-frwd; }
验证
确认配置工作正常。
验证 BGP 摘要信息
目的
验证 BGP 摘要信息。
行动
在操作模式下,输入 show bgp summary
命令。
user@PE2> show bgp summary
Groups: 1 Peers: 2 Down peers: 1
Table Tot Paths Act Paths Suppressed History Damp State Pending
bgp.l2vpn.0
1 1 0 0 0 0
Peer AS InPkt OutPkt OutQ Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...
10.255.255.1 100 8090 8119 0 1 2d 12:53:15 Establ
bgp.l2vpn.0: 1/1/1/0
l2vpn-inst.l2vpn.0: 1/1/1/0
10.255.255.2 100 0 0 0 0 2d 14:14:49 Active
含义
输出显示 BGP 摘要信息。
验证 L2VPN 连接信息
目的
验证第 2 层 VPN 连接信息。
行动
在操作模式下,运行 show l2vpn connections
命令以显示第 2 层 VPN 连接信息。
user@PE2> show l2vpn connections
Layer-2 VPN connections:
Legend for connection status (St)
EI -- encapsulation invalid NC -- interface encapsulation not CCC/TCC/VPLS
EM -- encapsulation mismatch WE -- interface and instance encaps not same
VC-Dn -- Virtual circuit down NP -- interface hardware not present
CM -- control-word mismatch -> -- only outbound connection is up
CN -- circuit not provisioned <- -- only inbound connection is up
OR -- out of range Up -- operational
OL -- no outgoing label Dn -- down
LD -- local site signaled down CF -- call admission control failure
RD -- remote site signaled down SC -- local and remote site ID collision
LN -- local site not designated LM -- local site ID not minimum designated
RN -- remote site not designated RM -- remote site ID not minimum designated
XX -- unknown connection status IL -- no incoming label
MM -- MTU mismatch MI -- Mesh-Group ID not available
BK -- Backup connection ST -- Standby connection
PF -- Profile parse failure PB -- Profile busy
RS -- remote site standby SN -- Static Neighbor
LB -- Local site not best-site RB -- Remote site not best-site
VM -- VLAN ID mismatch
Legend for interface status
Up -- operational
Dn -- down
Instance: l2vpn-inst
Edge protection: Not-Primary
Local site: pe2 (2)
connection-site Type St Time last up # Up trans
1 rmt Up Jun 22 14:46:50 2015 1
Remote PE: 10.255.255.1, Negotiated control-word: Yes (Null)
Incoming label: 800002, Outgoing label: 800003
Local interface: ge-0/0/1.300, Status: Up, Encapsulation: VLAN
Flow Label Transmit: Yes, Flow Label Receive: Yes
含义
输出显示第 2 层 VPN 连接信息以及流标签传输和流标签接收信息。
验证路由
目的
验证是否已学习到预期的路由。
行动
在操作模式下,运行 show route
命令以显示路由表中的路由。
user@PE2> show route
inet.0: 51 destinations, 51 routes (51 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
1.0.0.0/24 *[OSPF/10] 2d 14:09:33, metric 2
> to 2.0.0.1 via ge-0/0/0.0
2.0.0.0/24 *[Direct/0] 2d 14:10:18
> via ge-0/0/0.0
2.0.0.2/32 *[Local/0] 2d 14:10:20
Local via ge-0/0/0.0
10.4.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.5.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.6.128.0/17 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.9.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.10.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.13.4.0/23 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.13.10.0/23 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.82.0.0/15 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.84.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.85.12.0/22 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.92.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.94.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.99.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.102.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.102.160.0/19 *[Direct/0] 2d 14:12:18
> via fxp0.0
10.102.171.41/32 *[Local/0] 2d 14:12:18
Local via fxp0.0
10.150.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.155.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.157.64.0/19 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.160.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.204.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.205.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.206.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.207.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.209.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.212.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.213.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.214.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.215.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.216.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.218.13.0/24 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.218.14.0/24 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.218.16.0/20 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.218.32.0/20 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.227.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
10.255.255.1/32 *[OSPF/10] 2d 12:50:36, metric 2
> to 2.0.0.1 via ge-0/0/0.0
10.255.255.2/32 *[OSPF/10] 2d 14:09:33, metric 1
> to 2.0.0.1 via ge-0/0/0.0
10.255.255.4/32 *[Direct/0] 2d 14:11:51
> via lo0.0
128.102.161.191/32 *[OSPF/10] 2d 14:09:33, metric 1
> to 2.0.0.1 via ge-0/0/0.0
128.102.169.99/32 *[OSPF/10] 2d 12:50:36, metric 2
> to 2.0.0.1 via ge-0/0/0.0
128.102.171.41/32 *[Direct/0] 2d 14:12:18
> via lo0.0
172.16.0.0/12 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
192.168.0.0/16 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
192.168.102.0/23 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
207.17.136.0/24 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
207.17.136.192/32 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
207.17.137.0/24 *[Static/5] 2d 14:12:18
> to 10.102.191.254 via fxp0.0
224.0.0.5/32 *[OSPF/10] 2d 14:11:51, metric 1
MultiRecv
inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.255.255.1/32 *[RSVP/7/1] 2d 12:50:24, metric 2
> to 2.0.0.1 via ge-0/0/0.0, label-switched-path to-pe1
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
47.0005.80ff.f800.0000.0108.0001.1281.0217.1041/152
*[Direct/0] 2d 14:12:18
> via lo0.0
mpls.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0 *[MPLS/0] 2d 14:11:51, metric 1
Receive
1 *[MPLS/0] 2d 14:11:51, metric 1
Receive
2 *[MPLS/0] 2d 14:11:51, metric 1
Receive
13 *[MPLS/0] 2d 14:11:51, metric 1
Receive
800002 *[L2VPN/7] 2d 12:43:43
> via ge-0/0/1.300, Pop Offset: 4
ge-0/0/1.300 *[L2VPN/7] 2d 12:43:43, metric2 2
> to 2.0.0.1 via ge-0/0/0.0, label-switched-path to-pe1
inet6.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
abcd::128:102:171:41/128
*[Direct/0] 2d 14:12:18
> via lo0.0
fe80::5668:a60f:fc6b:ee28/128
*[Direct/0] 2d 14:12:18
> via lo0.0
bgp.l2vpn.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.255.255.1:200:1:1/96
*[BGP/170] 2d 12:43:43, localpref 100, from 10.255.255.1
AS path: I, validation-state: unverified
> to 2.0.0.1 via ge-0/0/0.0, label-switched-path to-pe1
l2vpn-inst.l2vpn.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.255.255.1:200:1:1/96
*[BGP/170] 2d 12:43:43, localpref 100, from 10.255.255.1
AS path: I, validation-state: unverified
> to 2.0.0.1 via ge-0/0/0.0, label-switched-path to-pe1
10.255.255.4:200:2:1/96
*[L2VPN/170/-101] 2d 12:43:50, metric2 1
Indirect
l2vpn-inst.l2id.0: 2 destinations, 3 routes (2 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
1 *[BGP/170] 2d 12:43:43, localpref 100, from 10.255.255.1
AS path: I, validation-state: unverified
> to 2.0.0.1 via ge-0/0/0.0, label-switched-path to-pe1
2 *[L2VPN/170/-101] 2d 12:43:50, metric2 1
Indirect
[L2VPN/175] 2d 12:43:43
> via ge-0/0/1.300, Pop Offset: 4
含义
输出显示路由表中的所有路由。
为 BGP VPLS 配置 FAT 伪线支持,以平衡 MPLS 流量负载
流感知传输 (FAT) 或流标签支持 BGP 信号伪线(例如 VPLS),并且仅在标签边缘路由器 (LE) 上进行配置。这使得传输路由器或标签交换路由器 (LSR) 能够跨等价多路径 (ECMP) 或链路聚合组 (LAG) 对 MPLS 数据包执行负载平衡,而无需对有效负载进行深度包检测。FAT 伪线或流标签可与具有转发同等等级(FEC128 和 FEC129)的 LDP 信号 VPLS 配合使用,并且扩展了 BGP 信号伪线(用于点对点或点到多点第 2 层服务)对流标签的支持。
为 BGP VPLS 配置 FAT 伪线支持以均衡 MPLS 流量负载之前:
配置设备接口并在所有接口上启用 MPLS。
配置 RSVP。
配置 MPLS 和 LSP 到远程 PE 路由器。
配置 BGP 和 OSPF。
要为 BGP VPLS 配置 FAT 伪线支持,以均衡 MPLS 流量负载,必须请执行以下操作:
另请参阅
示例:为 BGP VPLS 配置 FAT 伪线支持,以平衡 MPLS 流量负载
此示例说明如何对 BGP VPLS 实施 FAT 伪线支持,以帮助实现 MPLS 流量负载均衡。
要求
此示例使用以下硬件和软件组件:
五台 MX 系列路由器
在所有设备上运行的 Junos OS 16.1 或更高版本
为 BGP VPLS 配置 FAT 伪线支持之前,请确保配置路由和信令协议。
概述
Junos OS 允许仅在标签边缘路由器 (LE) 上配置 BGP 信号伪线(例如 VPLS)支持的流感知传输 (FAT) 流标签。这会使传输路由器或标签交换路由器 (LSR) 跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 对 MPLS 数据包执行负载平衡,而无需对有效负载进行深度数据包检测。FAT 流标签可用于 VPWS 和 VPLS 伪线的 LDP 信号转发同等类(FEC 128 和 FEC 129) 伪线。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit] CLI 中,然后从配置模式进入 commit
。
CE1
set interfaces ge-0/0/0 vlan-tagging set interfaces ge-0/0/0 unit 600 vlan-id 600 set interfaces ge-0/0/0 unit 600 family inet address 10.1.1.1/24 set interfaces lo0 unit 0 family inet address 10.255.255.8/32
PE1
set interfaces ge-0/0/0 vlan-tagging set interfaces ge-0/0/0 mtu 1600 set interfaces ge-0/0/0 encapsulation vlan-vpls set interfaces ge-0/0/0 unit 600 encapsulation vlan-vpls set interfaces ge-0/0/0 unit 600 vlan-id 600 set interfaces ge-0/0/0 unit 600 family vpls set interfaces ge-0/0/1 unit 0 family inet address 1.0.0.1/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.255.1/32 set routing-options nonstop-routing set routing-options router-id 10.255.255.1 set routing-options autonomous-system 100 set routing-options forwarding-table export exp-to-frwd set protocols rsvp interface all set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols mpls label-switched-path to-pe2 to 10.255.255.4 set protocols mpls interface ge-0/0/1.0 set protocols bgp group vpls-pe type internal set protocols bgp group vpls-pe local-address 10.255.255.1 set protocols bgp group vpls-pe family l2vpn auto-discovery-only set protocols bgp group vpls-pe family l2vpn signaling set protocols bgp group vpls-pe neighbor 10.255.255.4 set protocols bgp group vpls-pe neighbor 10.255.255.2 set protocols ospf traffic-engineering 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 set policy-options policy-statement exp-to-frwd term 0 from community vpls-com set policy-options policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe2 set policy-options policy-statement exp-to-frwd term 0 then accept set policy-options community vpls-com members target:100:100 set routing-instances vpl1 instance-type vpls set routing-instances vpl1 interface ge-0/0/0.600 set routing-instances vpl1 route-distinguisher 10.255.255.1:100 set routing-instances vpl1 vrf-target target:100:100 set routing-instances vpl1 protocols vpls site-range 10 set routing-instances vpl1 protocols vpls no-tunnel-services set routing-instances vpl1 protocols vpls site vpl1PE1 site-identifier 1 set routing-instances vpl1 protocols vpls flow-label-transmit set routing-instances vpl1 protocols vpls flow-label-receive
P
set interfaces ge-0/0/0 unit 0 family inet address 1.0.0.2/24 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 family inet address 2.0.0.1/24 set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.255.255.2/32 set routing-options router-id 10.255.255.2 set routing-options autonomous-system 100 set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface lo0.0 set protocols mpls interface ge-0/0/0.0 set protocols mpls interface ge-0/0/1.0 set protocols bgp group vpls-pe type internal set protocols bgp group vpls-pe local-address 10.255.255.2 set protocols bgp group vpls-pe family l2vpn signaling set protocols bgp group vpls-pe neighbor 10.255.255.1 set protocols bgp group vpls-pe neighbor 10.255.255.4 deactivate protocols bgp set protocols ospf traffic-engineering 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 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
PE2
set interfaces ge-0/0/0 unit 0 family inet address 2.0.0.2/24 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 mtu 1600 set interfaces ge-0/0/1 encapsulation vlan-vpls set interfaces ge-0/0/1 unit 600 encapsulation vlan-vpls set interfaces ge-0/0/1 unit 600 vlan-id 600 set interfaces ge-0/0/1 unit 600 family vpls set interfaces lo0 unit 0 family inet address 10.255.255.4/32 set routing-options router-id 10.255.255.4 set routing-options autonomous-system 100 set routing-options forwarding-table export exp-to-frwd set protocols rsvp interface all set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface lo0.0 set protocols mpls label-switched-path to-pe1 to 10.255.255.1 set protocols mpls interface ge-0/0/0.0 set protocols bgp group vpls-pe type internal set protocols bgp group vpls-pe local-address 10.255.255.4 set protocols bgp group vpls-pe family l2vpn auto-discovery-only set protocols bgp group vpls-pe family l2vpn signaling set protocols bgp group vpls-pe neighbor 10.255.255.1 set protocols bgp group vpls-pe neighbor 10.255.255.2 set protocols ospf traffic-engineering 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 set policy-options policy-statement exp-to-frwd term 0 from community vpls-com set policy-options policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe1 set policy-options policy-statement exp-to-frwd term 0 then accept set policy-options community vpls-com members target:100:100 set routing-instances vpl1 instance-type vpls set routing-instances vpl1 interface ge-0/0/1.600 set routing-instances vpl1 route-distinguisher 10.255.255.4:100 set routing-instances vpl1 vrf-target target:100:100 set routing-instances vpl1 protocols vpls site-range 10 set routing-instances vpl1 protocols vpls no-tunnel-services set routing-instances vpl1 protocols vpls site vpl1PE2 site-identifier 2 set routing-instances vpl1 protocols vpls flow-label-transmit set routing-instances vpl1 protocols vpls flow-label-receive
CE2
set interfaces ge-0/0/0 vlan-tagging set interfaces ge-0/0/0 unit 600 vlan-id 600 set interfaces ge-0/0/0 unit 600 family inet address 10.1.1.2/24 set interfaces lo0 unit 0 family inet address 10.255.255.9/32
配置 PE1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 PE1:
配置接口。
[edit interfaces] user@PE1# set ge-0/0/0 vlan-tagging user@PE1# set ge-0/0/0 mtu 1600 user@PE1# set ge-0/0/0 encapsulation vlan-vpls user@PE1# set ge-0/0/0 unit 600 encapsulation vlan-vpls user@PE1# set ge-0/0/0 unit 600 vlan-id 600 user@PE1# set ge-0/0/0 unit 600 family vpls user@PE1# set ge-0/0/1 unit 0 family inet address 1.0.0.1/24 user@PE1# set ge-0/0/1 unit 0 family mpls user@PE1# set lo0 unit 0 family inet address 10.255.255.1/32
配置不间断路由并配置路由器 ID。
[edit routing-options] user@PE1# set nonstop-routing user@PE1# set router-id 10.255.255.1
配置自治系统 (AS) 编号,并使用导出语句将策略应用于本地路由器的转发表。
[edit routing-options] user@PE1# set autonomous-system 100 user@PE1# set forwarding-table export exp-to-frwd
在接口上配置 RSVP 协议。
[edit protocols rsvp] user@PE1# set interface all user@PE1# set interface ge-0/0/1.0 user@PE1# set interface lo0.0
将标签交换路径属性应用于 MPLS 协议,然后配置接口。
[edit protocols mpls] user@PE1# set label-switched-path to-pe2 to 10.255.255.4 user@PE1# set interface ge-0/0/1.0
定义一个对等组,并为对等组
vpls-pe
配置 BGP 会话本地端的地址。[edit protocols bgp group vpls-pe] user@PE1# set type internal user@PE1# set local-address 10.255.255.1
为更新中的 NLR 配置协议家族的属性。
[edit protocols bgp group vpls-pe family l2vpn] user@PE1# set auto-discovery-only user@PE1# set signaling
为对等组配置邻接方
vpls-pe
。[edit protocols bgp group vpls-pe] user@PE1# set neighbor 10.255.255.4 user@PE1# set neighbor 10.255.255.2
配置流量工程,并配置 OSPF 区域 0.0.0.0.0 的接口。
[edit protocols ospf] user@PE1# set traffic-engineering user@PE1# set area 0.0.0.0 interface lo0.0 passive user@PE1# set area 0.0.0.0 interface ge-0/0/1.0
配置路由策略和 BGP 社区信息。
[edit policy-options ] user@PE1# set policy-statement exp-to-frwd term 0 from community vpls-com user@PE1# set policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe2 user@PE1# set policy-statement exp-to-frwd term 0 then accept user@PE1# set community vpls-com members target:100:100
配置路由实例类型,然后配置接口。
[edit routing-instances vp1] user@PE1# set instance-type vpls user@PE1# set interface ge-0/0/0.600
例如
vpl1
,配置路由识别器,并配置 VRF 目标社区。[edit routing-instances vpl1] user@PE1# set route-distinguisher 10.255.255.1:100 user@PE1# set vrf-target target:100:100
分配 VPLS 域的最大站点标识符。
[edit routing-instances vp1 protocols vpls] user@PE1# set site-range 10
将 VPLS 协议配置为不使用 VPLS 实例的隧道服务,并将站点标识符分配给连接到提供商设备的站点。
[edit routing-instances vp1 protocols vpls] user@PE1# set no-tunnel-services user@PE1# set site vpl1PE1 site-identifier 1
配置路由实例的 VPLS 协议,以提供广告功能,以将接收方向上的流标签弹出至远程 PE,并提供广告功能,将传输方向上的流标签推送到远程 PE。
[edit routing-instances vp1 protocols vpls] user@PE1# set flow-label-receive user@PE1# set flow-label-transmit
结果
在配置模式下,输入 、 show interfacesshow protocols、 show policy-options、 show routing-instances和show routing-options命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@PE1# show interfaces ge-0/0/0 { vlan-tagging; mtu 1600; encapsulation vlan-vpls; unit 600 { encapsulation vlan-vpls; vlan-id 600; family vpls; } } ge-0/0/1 { unit 0 { family inet { address 1.0.0.1/24; } family mpls; } } lo0 { unit 0 { family inet { address 10.255.255.1/32; } } }
user@PE1# show protocols rsvp { interface all; interface ge-0/0/1.0; interface lo0.0; } mpls { label-switched-path to-pe2 { to 10.255.255.4; } interface ge-0/0/1.0; } bgp { group vpls-pe { type internal; local-address 10.255.255.1; family l2vpn { auto-discovery-only; signaling; } neighbor 10.255.255.4; neighbor 10.255.255.2; } } ospf { traffic-engineering; area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/1.0; } }
user@PE1# show policy-options policy-statement exp-to-frwd { term 0 { from community vpls-com; then { install-nexthop lsp to-pe2; accept; } } } community vpls-com members target:100:100;
user@PE1# show routing-instances vpl1 { instance-type vpls; interface ge-0/0/0.600; route-distinguisher 10.255.255.1:100; vrf-target target:100:100; protocols { vpls { site-range 10; no-tunnel-services; site vpl1PE1 { site-identifier 1; } flow-label-transmit; flow-label-receive; } } }
user@PE1# show routing-options nonstop-routing; router-id 10.255.255.1; autonomous-system 100; forwarding-table { export exp-to-frwd; }
配置 PE2
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 PE2:
配置接口。
[edit interfaces] user@PE2# set ge-0/0/0 unit 0 family inet address 2.0.0.2/24 user@PE2# set ge-0/0/0 unit 0 family mpls user@PE2# set ge-0/0/1 vlan-tagging user@PE2# set ge-0/0/1 mtu 1600 user@PE2# set ge-0/0/1 encapsulation vlan-vpls user@PE2# set ge-0/0/1 unit 600 encapsulation vlan-vpls user@PE2# set ge-0/0/1 unit 600 vlan-id 600 user@PE2# set ge-0/0/1 unit 600 family vpls user@PE2# set lo0 unit 0 family inet address 10.255.255.4/32
配置路由器 ID。
[edit routing-options] user@PE2# set router-id 10.255.255.4
配置自治系统 (AS) 编号,并使用导出语句将策略应用于本地路由器的转发表。
[edit routing-options] user@PE2# set autonomous-system 100 user@PE2# set forwarding-table export exp-to-frwd
在接口上配置 RSVP 协议。
[edit protocols rsvp] user@PE2# set interface all user@PE2# set interface ge-0/0/1.0 user@PE2# set interface lo0.0
将标签交换路径属性应用于 MPLS 协议,然后配置接口。
[edit protocols mpls] user@PE2# set label-switched-path to-pe1 to 10.255.255.1 user@PE2# set interface ge-0/0/0.0
定义一个对等组,并为对等组
vpls-pe
配置 BGP 会话的本地端地址。[edit protocols bgp group vpls-pe] user@PE2# set type internal user@PE2# set local-address 10.255.255.4
为更新中的 NLR 配置协议家族的属性。
[edit protocols bgp group vpls-pe] user@PE2# set family l2vpn auto-discovery-only user@PE2# set family l2vpn signaling
为对等组配置邻接方
vpls-pe
。[edit protocols bgp group vpls-pe] user@PE2# set neighbor 10.255.255.1 user@PE2# set neighbor 10.255.255.2
配置流量工程,并配置 OSPF 区域 0.0.0.0.0 的接口。
[edit protocols ospf] user@PE2# set traffic-engineering user@PE2# set area 0.0.0.0 interface lo0.0 passive user@PE2# set area 0.0.0.0 interface ge-0/0/0.0
配置路由策略和 BGP 社区信息。
[edit policy-options ] user@PE2# set policy-statement exp-to-frwd term 0 from community vpls-com user@PE2# set policy-statement exp-to-frwd term 0 then install-nexthop lsp to-pe1 user@PE2# set policy-statement exp-to-frwd term 0 then accept user@PE2# set community vpls-com members target:100:100
配置路由实例类型,然后配置接口。
[edit routing-instances vpl1] user@PE2# set instance-type vpls user@PE2# set interface ge-0/0/1.600
例如
vp11
,配置路由识别器,并配置 VRF 目标社区。[edit routing-instances vpl1] user@PE2# set route-distinguisher 10.255.255.4:100 user@PE2# set vrf-target target:100:100
分配 VPLS 域的最大站点标识符。
[edit routing-instances vpl1 protocols vpls] user@PE2# set site-range 10
将 VPLS 协议配置为不使用 VPLS 实例的隧道服务,并将站点标识符分配给连接到提供商设备的站点。
[edit routing-instances vpl1 protocols vpls] user@PE2# set no-tunnel-services user@PE2# set site vpl1PE2 site-identifier 2
配置路由实例的 VPLS 协议,以提供广告功能,以将接收方向上的流标签弹出至远程 PE,并提供广告功能,将传输方向上的流标签推送到远程 PE。
[edit routing-instances vpl1 protocols vpls] user@PE2# set flow-label-transmit user@PE2# set flow-label-receive
结果
在配置模式下,输入 、 show interfacesshow protocols、 show policy-options、 show routing-instances和show routing-options命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@PE2# show interfaces ge-0/0/0 { unit 0 { family inet { address 2.0.0.2/24; } family mpls; } } ge-0/0/1 { vlan-tagging; mtu 1600; encapsulation vlan-vpls; unit 600 { encapsulation vlan-vpls; vlan-id 600; family vpls; } } lo0 { unit 0 { family inet { address 10.255.255.4/32; } } }
user@PE2# show protocols rsvp { interface all; interface ge-0/0/1.0; interface lo0.0; } mpls { label-switched-path to-pe1 { to 10.255.255.1; } interface ge-0/0/0.0; } bgp { group vpls-pe { type internal; local-address 10.255.255.4; family l2vpn { auto-discovery-only; signaling; } neighbor 10.255.255.1; neighbor 10.255.255.2; } } ospf { traffic-engineering; area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/0.0; } }
user@PE2# show policy-options policy-statement exp-to-frwd { term 0 { from community vpls-com; then { install-nexthop lsp to-pe1; accept; } } } community vpls-com members target:100:100;
user@PE2# show routing-instances vpl1 { instance-type vpls; interface ge-0/0/1.600; route-distinguisher 10.255.255.4:100; vrf-target target:100:100; protocols { vpls { site-range 10; no-tunnel-services; site vpl1PE2 { site-identifier 2; } flow-label-transmit; flow-label-receive; } } }
user@PE2# show routing-options router-id 10.255.255.4; autonomous-system 100; forwarding-table { export exp-to-frwd; }
验证
确认配置工作正常。
验证 VPLS 连接信息
目的
验证 VPLS 连接信息。
行动
在操作模式下,运行 show vpls connections
命令以显示 VPLS 连接信息。
user@PE1> show vpls connections
Layer-2 VPN connections:
Legend for connection status (St)
EI -- encapsulation invalid NC -- interface encapsulation not CCC/TCC/VPLS
EM -- encapsulation mismatch WE -- interface and instance encaps not same
VC-Dn -- Virtual circuit down NP -- interface hardware not present
CM -- control-word mismatch -> -- only outbound connection is up
CN -- circuit not provisioned <- -- only inbound connection is up
OR -- out of range Up -- operational
OL -- no outgoing label Dn -- down
LD -- local site signaled down CF -- call admission control failure
RD -- remote site signaled down SC -- local and remote site ID collision
LN -- local site not designated LM -- local site ID not minimum designated
RN -- remote site not designated RM -- remote site ID not minimum designated
XX -- unknown connection status IL -- no incoming label
MM -- MTU mismatch MI -- Mesh-Group ID not available
BK -- Backup connection ST -- Standby connection
PF -- Profile parse failure PB -- Profile busy
RS -- remote site standby SN -- Static Neighbor
LB -- Local site not best-site RB -- Remote site not best-site
VM -- VLAN ID mismatch
Legend for interface status
Up -- operational
Dn -- down
Instance: vpl1
Edge protection: Not-Primary
Local site: vpl1PE1 (1)
connection-site Type St Time last up # Up trans
2 rmt Up Jun 17 11:38:14 2015 1
Remote PE: 10.255.255.4, Negotiated control-word: No
Incoming label: 262146, Outgoing label: 262145
Local interface: lsi.1048576, Status: Up, Encapsulation: VPLS
Description: Intf - vpls vpl1 local site 1 remote site 2
Flow Label Transmit: Yes, Flow Label Receive: Yes
含义
输出显示 VPLS 连接信息以及流标签接收和流标签传输信息。
验证
确认配置工作正常。
验证 VPLS 连接信息
目的
验证 VPLS 连接信息。
行动
在操作模式下,运行 show vpls connections
命令以显示 VPLS 连接信息。
user@PE2> show vpls connections
Layer-2 VPN connections:
Legend for connection status (St)
EI -- encapsulation invalid NC -- interface encapsulation not CCC/TCC/VPLS
EM -- encapsulation mismatch WE -- interface and instance encaps not same
VC-Dn -- Virtual circuit down NP -- interface hardware not present
CM -- control-word mismatch -> -- only outbound connection is up
CN -- circuit not provisioned <- -- only inbound connection is up
OR -- out of range Up -- operational
OL -- no outgoing label Dn -- down
LD -- local site signaled down CF -- call admission control failure
RD -- remote site signaled down SC -- local and remote site ID collision
LN -- local site not designated LM -- local site ID not minimum designated
RN -- remote site not designated RM -- remote site ID not minimum designated
XX -- unknown connection status IL -- no incoming label
MM -- MTU mismatch MI -- Mesh-Group ID not available
BK -- Backup connection ST -- Standby connection
PF -- Profile parse failure PB -- Profile busy
RS -- remote site standby SN -- Static Neighbor
LB -- Local site not best-site RB -- Remote site not best-site
VM -- VLAN ID mismatch
Legend for interface status
Up -- operational
Dn -- down
Instance: vpl1
Edge protection: Not-Primary
Local site: vpl1PE2 (2)
connection-site Type St Time last up # Up trans
1 rmt Up Jun 17 11:38:14 2015 1
Remote PE: 10.255.255.1, Negotiated control-word: No
Incoming label: 262145, Outgoing label: 262146
Local interface: lsi.1048576, Status: Up, Encapsulation: VPLS
Description: Intf - vpls vpl1 local site 2 remote site 1
Flow Label Transmit: Yes, Flow Label Receive: Yes
含义
输出显示 VPLS 连接信息以及流标签接收和流标签传输信息。
[edit protocols bgp]
受全局支持。您可以选择性地禁用某些 BGP 组和邻接方上的多路径。[edit protocols bgp group group-name multipath]
包含在disable
层次结构级别,以禁用组或特定 BGP 邻接方的多路径选项。defer-initial-multipath-build
[edit protocols bgp]
。或者,您可以使用层级的配置语句[edit protocols bgp]
来降低 BGP 多路径构建作业的优先级multipath-build-priority
,以加速 RIB 学习。