本页内容
BGP 会话的负载均衡
了解 BGP 多路径
BGP 多路径允许您将多个内部 BGP 路径和多个外部 BGP 路径安装到转发表。选择多个路径可以使 BGP 跨多个链路对流量进行负载均衡。
如果BGP路径选择过程在将IGP成本与下一跃点进行比较后执行决胜局,则路径将被视为BGP等价路径(并用于转发)。默认情况下,多路径选择过程中会考虑具有相同相邻AS、由启用多路径的BGP邻接方获知的所有路径。
BGP 通常只为每个前缀选择一个最佳路径,并将该路由安装在转发表中。启用 BGP 多路径后,设备会选择多个等价 BGP 路径来到达给定目标,并且所有这些路径都安装在转发表中。BGP 仅将活动路径播发至其邻接方,除非正在使用 add-path。
Junos OS BGP 多路径功能支持以下应用程序:
跨属于不同自治系统 (AS) 的两台路由设备之间多个链路的负载平衡
将一个公共子网或多个子网的负载平衡到属于同一对等 AS 的不同路由设备
跨属于不同外部联合体对等方的两台路由设备之间多个链路的负载平衡
将一个公共子网或多个子网的负载平衡到属于外部联合体对等方的不同路由设备
在负载平衡的常见场景中,客户在一个接入点 (接入点) 中多宿主到多个路由器或交换机。默认行为是仅通过其中一个可用链路发送所有流量。负载均衡会导致流量使用两个或多个链路。
BGP 多路径不适用于共享相同 MED 加 IGP 成本但 IGP 成本不同的路径。多路径路径选择基于 IGP 成本指标,即使两条路径具有相同的 MED 加 IGP 成本。
从 Junos OS 18.1R1 版开始,在层次结构级别全 [edit protocols bgp] 局支持 BGP 多路径。您可以选择性地禁用某些 BGP 组和邻接方上的多路径。 disable 在层次结构级别包括 [edit protocols bgp group group-name multipath] 以禁用组或特定 BGP 邻接方的多路径选项。
从 Junos OS 18.1R1 版开始,您可以推迟多路径计算,直到收到所有 BGP 路由。启用多路径后,每次添加新路由或现有路由发生更改时,BGP 都会将路由插入多路径队列。当通过BGP添加路径功能接收到多条路径时,BGP可能会多次计算一个多路径路由。多路径计算会降低 RIB(也称为路由表)学习速率。为了加快 RIB 学习速度,可以将多路径计算推迟到收到 BGP 路由,也可以根据要求降低多路径构建作业的优先级,直到 BGP 路由得到解析。要延迟多路径计算,请在层次结构级别进行[edit protocols bgp]配置defer-initial-multipath-build。或者,您可以在层次结构级别使用[edit protocols bgp]配置语句降低 multipath-build-priority BGP 多路径构建作业优先级,以加快 RIB 学习。
也可以看看
示例:均衡 BGP 流量负载
此示例说明如何配置 BGP 以选择多个等价外部 BGP (EBGP) 或内部 BGP (IBGP) 路径作为活动路径。
要求
开始之前:
配置设备接口。
配置内部网关协议 (IGP)。
配置 BGP。
配置一个路由策略,用于将路由(例如直接路由或 IGP 路由)从路由表导出到 BGP。
概述
以下步骤说明如何配置按数据包的负载平衡:
通过在层次结构级别包含
[edit policy-options]一个或多个policy-statement语句来定义负载均衡路由策略,并定义以下操作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-tableandexport语句:forwarding-table { export policy-name; }
您无法将导出策略应用于 VRF 路由实例。
在分配与正在播发的路由相对应的标签时,指定该路由的所有下一跃点(如果存在多个跃点)。
配置 MPLS 的转发选项哈希密钥以包含 IP 有效负载。
在某些平台上,您可以使用 chassis maximum-ecmp 语句来增加负载均衡的路径数。
使用此语句,您可以将等价负载平衡路径的最大数量更改为 32、64、128、256 或 512(最大数量因平台而异,请参阅 maximum-ecmp)。
支持 BGP 的所有平台上都支持多路径功能。QFX 平台进行了部分增强:
-
- 从 Junos OS 19.1R1 版开始,您可以在 QFX10000 交换机上指定最多 128 条等价路径。
-
- 从 Junos OS 19.2R1 版开始,您可以在 QFX10000 交换机上指定最大数量的 512 条等价路径 — 请参阅了解如何使用可选的一致负载均衡配置多达 512 条等价路径。
在此示例中,设备 R1 在 AS 64500 中,并连接到设备 R2 和设备 R3(位于 AS 64501 中)。此示例显示了设备 R1 上的配置。
配置
过程
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 [edit] CLI 中。
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 protocols、 show policy-options和 show routing-options 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
[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 action)。在这种情况下,转发表中安装的下一跳网关可能是命令中 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 对等方配置多达 512 条路径的等价多路径 (ECMP)。能够配置多达 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 流量工程、自动带宽。
有关配置多达 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-4 中的路由刷新功能》中所定义的 BGP 路由刷新。如果远程对等方不支持 BGP 路由刷新,则会重置会话。
默认情况下,单跃点 EBGP 对等方会将其自己的地址播发为下一跃点。如果要播发不同的下一跃点,则必须在 EBGP 对等方上定义导入路由策略。启用单跃点 EBGP 对等方接受远程下一跃点时,您还可以在 EBGP 对等方上配置导入路由策略。但是,如果配置了远程下一跃点,则不需要路由策略。
此示例包括一个导入路由策略, agg_route使单跃点外部 BGP 对等体(设备 R1)能够接受远程下一跃点 10.1.10.10,用于到 10.1.230.0/23 网络的路由。在 [edit protocols bgp] 层次结构级别,此示例包括 import agg_route 将策略应用于外部 BGP 对等体的语句,以及 accept-remote-nexthop 使单跃点 EBGP 对等方能够接受远程下一跃点的语句。
图 2 显示了示例拓扑。
的拓扑
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 [edit] CLI 中。
设备 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
-
将和
test_route策略从路由表导出agg_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)能够接受远程下一跃点 10.1.10.10,用于到 10.1.230.0/23 网络的路由。
[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 interfaces、 show protocols和 show routing-options 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 10.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 10.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 具有到Accepted Multipath启用了多路径功能 () 的 10.1.230.0 网络的路由。输出还显示路由的间接下一跃点为 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 按前缀负载均衡算法会选择特定的转发下一跃点。此过程会针对数据包的源地址和目标地址进行哈希处理,以便确定性地将前缀配对映射到其中一个可用的下一跃点。当散列函数带有大量前缀时(例如可能发生在互联网对等交换上),按前缀映射效果最佳,并且它可以防止通信节点对之间的数据包重新排序。
企业网络通常希望更改默认行为,以唤起 按数据包的 负载均衡算法。此处强调的是“按数据包”,因为其用法用词不当,源于原始互联网处理器 ASIC 的历史行为。实际上,当前的瞻博网络路由器支持按前缀(默认)和按流的负载平衡。后者涉及针对各种第 3 层和第 4 层标头进行散列,包括源地址、目标地址、传输协议、传入接口和应用端口的某些部分。这样做的结果是,现在各个流量都会被散列到特定的下一跃点,从而在可用的下一跃点之间实现更均匀的分布,尤其是在在较少源和目标对之间进行路由时。
使用按数据包的负载平衡,包含两个端点之间通信流的数据包可能会被重新排序,但各个流中的数据包会保持正确的排序。无论您选择按前缀还是按数据包负载平衡,接入链路的不对称都可能带来技术挑战。无论通过哪种方式,与映射到快速以太网接入链路等的流量相比,映射到 T1 链路等的前缀或流量的性能都会下降。更糟糕的是,在流量负载较大的情况下,任何尝试均等负载平衡都可能导致 T1 链路完全饱和,并因数据包丢失而导致会话中断。
幸运的是,瞻博网络 BGP 实施支持带宽社区的概念。此扩展社区对给定下一跃点的带宽进行编码,当与多路径结合使用时,负载均衡算法将按照下一跃点的相对带宽成正比,在下一跃点集中分配流量。换句话说,如果你有一个 10 Mbps 的下一跳和一个 1 Mbps 的下一跳,那么平均每使用一个低速的下一跳,就会有 9 个流映射到高速下一跳。
只有按数据包负载平衡才支持使用 BGP 带宽社区。
配置任务由两部分组成:
配置外部 BGP (EBGP) 对等会话,启用多路径,并定义导入策略,以便使用反映链路速度的带宽社区标记路由。
启用按数据包(实际上是按流)的负载平衡,以实现最佳流量分配。
也可以看看
BGP 链路带宽社区
概述
在 BGP 实施中,链路带宽扩展社区对给定下一跳的带宽进行编码。BGP 通过将 BGP 链路的速度传达给远程对等方,有助于实现流量负载平衡。当您(网络管理员)将链路带宽社区与多路径相结合时,您选择的负载均衡算法将按照下一跃点的相对带宽成比例,将流量分布到下一跃点集。
当 BGP 链路带宽扩展社区是跨自治系统 (AS) 的传递属性时,BGP 组会将链路带宽扩展社区播发至相邻的 AS。您可以选择将 BGP 链路带宽社区用作非传递属性,以便路由器在 AS 边界丢弃链路带宽社区。BGP 组不会将非传递链路带宽社区播发至外部 BGP (EBGP) 邻接方。
您还可以将 BGP 配置为自动感应带宽,并在组或邻居级别导入社区。使用此链路带宽自动感知功能,网络可以自动将链路带宽值设置为设备接收 BGP 路由的接口的速度。
只有按数据包的负载平衡支持 BGP 链路带宽社区。
优势
-
启用多路径后,链路带宽可为不平等的负载平衡提供加权等价多路径 (WECMP)。
-
确保高带宽链路比低带宽链路承载更多的流量。
-
降低流量拥塞的可能性。
配置
带宽
默认情况下,链路带宽社区是传递的。您可以使用以下任一语句将链路带宽社区配置为传递:
set policy-options community name members bandwidth:value
set policy-options community name members bandwidth-transitive:value
要使其非传递,请使用以下配置:
set policy-options community policy-name members bandwidth-non-transitive:value
非传递覆盖
您可以覆盖非传递配置,以便 BGP 组通过 EBGP 会话发送链路带宽扩展社区,即使链路带宽是非传递的。要跨 EBGP 邻接方发送非传递链路带宽社区,请加入以下配置:
set protocols bgp group group-name send-non-transitive-link-bandwidth
该 send-non-transitive-link-bandwidth 语句不区分始发的链路带宽社区与已接收和重新播发的社区。启用此选项后,BGP 会将所有非传递链路带宽社区播发至 EBGP 邻接方。
聚合带宽
默认情况下,聚合链路带宽社区是传递的。您可以使用以下任一语句将链路带宽社区配置为传递:
set policy-options policy-statement name then aggregate-bandwidth
set policy-options policy-statement name then aggregate-bandwidth transitive
要使其非传递,请使用以下配置:
set policy-options policy-statement policy-name then aggregate-bandwidth non-transitive
要将总链路带宽除以播发组中的对等方数,请启用以下语 divide-equal 句:
set policy-options policy-statement policy-name then aggregate-bandwidth divide-equal
自动感应
您只能为单跳 EBGP 会话启用自动感知。
为 BGP 组配置自动感知。
在层次结构中
neighbor配置auto-sense该语句,以检测并存储指向该 BGP 邻接方的带宽。在层次结构中group对其进行配置,以检测和存储该 BGP 组下所有邻接方的带宽:set protocols bgp group group-name link-bandwith auto-sense set protocols bgp group group-name neighbor link-bandwith auto-sense
使用
auto-link-bandwidth设置为transitivenon-transitive或 配置导入策略。如果未指定,则默认auto-link-bandwidth为传递:set protocols bgp group group-name import policy-name set policy-options policy-statement policy-name then auto-link-bandwidth non-transitive
(选答)要在带宽增加时抑制链路带宽值的频繁变化,可以配置自动感应抑制计时器。仅当带宽增加时才会触发抑制定时器。默认情况下,计时器设置为 60 秒:
set protocols bgp group group-name link-bandwith auto-sense hold-down time-in-seconds
验证
使用以下命令验证配置是否成功:
-
show route receive-protocol bgp peer-ip-address extensive -
show route advertising-protocol bgp peer-ip-address extensive -
show route address extensive -
show bgp neighbor address
示例:通过分配给路径的带宽不相等来均衡 BGP 流量负载
此示例说明如何配置 BGP 以选择多个不等价路径作为活动路径。
BGP 社区可以帮助您控制路由策略。BGP 社区的一个良好用途示例是不平等的负载平衡。当自治系统边界路由器 (ASBR) 从直接连接的外部 BGP (EBGP) 邻接方接收路由时,ASBR 随后会使用 IBGP 播发将这些路由播发至内部邻接方。在 IBGP 广告中,您可以附加链路带宽社区来传达播发外部链路的带宽。当有多个外部链接可用,并且您希望通过这些链接进行不相等的负载平衡时,这非常有用。您可以在 AS 的所有入口链路上配置链路带宽扩展社区。链路带宽扩展社区中的带宽信息基于EBGP链路的配置带宽。它不基于链路上的流量。Junos OS 支持 BGP 链路带宽和多路径负载平衡,如互联网草案 draft-ietf-idr-link-bandwidth-06《 BGP 链路带宽扩展社区》中所述。
要求
开始之前:
配置设备接口。
配置内部网关协议 (IGP)。
配置 BGP。
配置一个路由策略,用于将路由(例如直接路由或 IGP 路由)从路由表导出到 BGP。
概述
在此示例中,设备 R1 在 AS 64500 中,并连接到设备 R2 和设备 R3(位于 AS 64501 中)。
此示例使用了带宽扩展社区。
默认情况下,使用 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 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 [edit] CLI 中。
设备 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选项。如果邻接方位于不同的 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
配置 BGP 社区成员。
此示例假定带宽为 1 Gbps,并将 60% 分配给带宽高,40% 分配给带宽低。参考带宽不必与链路带宽相同。
[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 17.4 版之前的版本中,从其内部对等方接收多条路径的 BGP 发言者仅播发与活动路由关联的链路带宽。BGP 使用链路带宽扩展社区,跨外部链路通告多个路由的聚合带宽。BGP 计算带宽分配不等的多路径的聚合带宽,并将聚合带宽播发给外部 BGP 对等方。可以配置聚合带宽的阈值来限制 BGP 组的带宽使用。IPv4 和 IPv6 路由(包括任播地址)均支持聚合带宽。
要通告多路径路由的聚合带宽并设置最大阈值,请在层次结构级别使用 [edit policy-options policy-statement name then] 配置带有 和 limit-bandwidth 操作的策略aggregate-bandwidth。
在 图 4 中,自治系统 1 (AS1) 将其 3 个多路径路由的带宽聚合到一个远程前缀,并使用链路带宽扩展社区将其播发给带宽为 30 的自治系统 4 (AS4)。如果 AS3 和 AS4 之间出现链路故障,AS4 会从其播发至 AS6 的带宽中减去 60,并将播发的带宽从 130 修改为 70。
当其中一个多路径链路出现故障时,BGP 会从传出链路带宽社区中减去故障链路的带宽,重新播发路由。如果发现聚合链路带宽超过配置的限制,则播发的聚合带宽将截短为两个对等方之间配置的链路带宽限制。
当 BGP 对等体传播配置了聚合带宽社区的多路径路由时,将添加一个新的链路带宽社区,其中包含来自传入带宽社区或该前缀的带宽之和。可用链路带宽由接口速度动态得出。链路带宽作为传递扩展社区发送。
BGP 可以将链路速度传输给远程对等方,从而更好地优化流量分配以实现负载平衡。BGP 组可通过 EBGP 会话发送链路带宽非传递扩展社区,用于发起或接收和重新播发的链路带宽扩展社区。要配置非传递链路带宽扩展社区:
-
在层次结构级别的
[edit policy-options community name members community-ids]导出策略中包括 。bandwidth-non-transitive:value -
在层次结构级别包括
[edit protocols bgp group (Protocols BGP) group-name]以下选项send-non-transitive-link-bandwidth:仅对于链路带宽社区,以向 EBGP 邻接方发送非传递链路带宽扩展社区。
要使设备能够在导入时自动检测路由上的链路带宽社区并附加,请在层次结构级别包含 [edit protocols bgp group link-bandwidth] auto-sense 语句。该功能有利于网络内不同传输速度的设备集成,从而实现基于链路速度的高效流量分配。
也可以看看
示例:配置策略以通告跨外部 BGP 链路的聚合带宽以实现负载平衡
此示例说明如何配置策略以通过外部 BGP 链路通告聚合带宽以实现负载平衡,以及如何为配置的聚合带宽指定阈值。BGP 将多路径的可用链路带宽相加,并计算聚合带宽。如果链路发生故障,系统会调整聚合带宽以反映可用带宽的当前状态。
要求
此示例使用以下硬件和软件组件:
-
四台路由器,具有负载平衡功能
-
所有设备上运行 Junos OS 17.4 或更高版本
概述
从 Junos OS 17.4R1 版开始,从其内部对等方接收多个路径的 BGP 发言者将在这些路径之间均衡流量负载。在早期的 Junos OS 版本中,从内部对等方接收多条路径的 BGP 发言者仅播发与活动路由关联的链路带宽。BGP 使用新的链路带宽扩展社区,其中包含用于标记多路径的聚合带宽,并通过其停火区链路通告这些多个路由的聚合带宽。要通告聚合的多个路由,请在层次结构级别使用 [edit policy-options policy-statement name then] 配置aggregate-bandwidth带有 和 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 计算可用带宽的总和,即每秒 10000000 字节。但是,在路由器 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 会话将 80,000,000 字节的聚合带宽播发至 EBGP 对等路由器 R4。
[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包含 60% 的 1-Gbps 链路的社区,以及另一个包含 40% 的 1-Gbps 链路的社区bw-low。将 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; } } } -
-
我们支持
add-path内部 BGP (IBGP) 和外部 BGP (EBGP) 对等节点。注意:-
我们支持 IBGP 和 EBGP 对等方的添加路径 接收 。
-
我们仅支持 IBGP 对等方的添加路径发送。
-
我们不支持对 EBGP 对等方的添加路径 发送 。当您尝试提交 EBGP 对等方的 add-path 发送 配置时,CLI 会引发提交错误。
-
-
仅限主实例。不支持路由实例。
-
支持平滑重启和不间断活动路由 (NSR)。
-
不支持 BGP 监控协议 (BMP)。
-
通过前缀策略,您可以过滤配置为通告目标的多条路径的路由器上的路由。前缀策略只能匹配前缀。它们不能匹配路由属性,也不能更改路由的属性。
从 Junos OS 18.4R1 版开始,除了多个 ECMP 路径外,BGP 最多还可以播发 2 个添加路径路由。
要播发最多 64 个添加路径或仅等价路径的所有添加路径,请在path-selection-mode层次结构级别包含[edit protocols bgp group group-name family name addpath send]。您不能同时启用两者multipathpath-selection-mode。
也可以看看
示例:在 BGP 中播发多个路径
在此示例中,BGP 路由器配置为播发多个路径,而不是仅播发活动路径。RFC 7911《 BGP 中多路径播发》中规定了在 BGP 中的多个路径播发。
要求
此示例使用以下硬件和软件组件:
八台支持 BGP 的设备。
其中五台支持 BGP 的设备不一定是路由器。例如,它们可以是 EX 系列以太网交换机。
其中三台支持 BGP 的设备配置为发送多条路径或接收多条路径(或同时发送和接收多条路径)。这三台支持 BGP 的设备必须M Series多服务边缘路由器、MX 系列5G通用路由平台或T Series核心路由器。
这三台路由器必须运行 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 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 [edit] CLI 中。
路由器 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 interfaces、 show protocols、 show policy-options以及 show routing-options 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 还可以配置为为添加路径播发前缀的子集发送最多 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-unicastNLRI'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 目标的多条路径播发至路由器 R4。
行动
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 Series、MX 系列 或 T Series 路由器的组合
-
设备上的 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 的 add-path 下配置。但是,路由器 RR4 未配置负载均衡多路径。路由器 RR1 配置为向路由器 RR4 发送最多 6 个从多路径候选路由中选择的 199.1.1.1/32 添加路径路由。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层次结构级别的 [edit] CLI 中,然后从配置模式进入 commit。
路由器 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 的可用多路径路由。
行动
在操作模式下,对路由器 RR1 运行 show route 199.1.1.1/32 detail 命令。
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 是否正在播发多路径路由。
行动
在操作模式下,对路由器 RR1 运行 show route advertising-protocol bgp 10.0.0.40 命令。
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 正在将路由 199.1.1.1/32 的两个下一跃点 10.0.0.20 和 10.0.0.30 播发至路由器 RR4。
验证路由器 RR4 是否将 199.1.1.1/32 的一个路由播发至路由器 R8
目的
路由器 RR4 上未配置多路径,因此路由 199.1.1.1/32 不符合添加路径的条件。验证路由器 RR4 是否仅将 199.1.1.1/32 的一个路由播发至路由器 R8。
行动
在操作模式下,对路由器 RR4 运行 show route advertising-protocol bgp 10.0.0.80 命令。
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 上未启用多路径,因此仅将一条路径 10.0.0.20 播发至路由器 R8。
示例:配置路由策略以根据 BGP 社区值选择和通告多路径
播发所有可用的多个路径可能会导致设备内存上的处理开销过大。如果想要在事先不知道前缀的情况下播发有限的前缀子集,您可以使用 BGP 社区值来识别需要播发给 BGP 邻接方的前缀路由。此示例说明如何定义路由策略,以根据已知的 BGP 社区值过滤和通告多个路径。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
-
八台路由器,可以是 M Series、MX 系列 或 T Series 路由器的组合
-
设备上的 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 发送最多 6 个路径(每个目标)。路由器 RR4 配置为向路由器 R8 发送最多 6 个路径。路由器 R8 配置为接收来自路由器 RR4 的多条路径。add-path 社区配置限制路由器 RR4 为仅包含 4713:100 社区值的路由发送多个路径。路由器 RR4 过滤并播发仅包含 4714:100 社区值的多路径。
通告多路径
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层次结构级别的 [edit] CLI 中,然后从配置模式进入 commit。
路由器 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-communities-send members 4713:100 set policy-options policy-statement addpath-communities-send-4713-100 term term1 from protocol bgp set policy-options policy-statement addpath-communities-send-4713-100 term term1 from community addpath-communities-send set policy-options policy-statement addpath-communities-send-4713-100 term term1 then add-path send-count 16 set policy-options policy-statement addpath-communities-send-4713-100 term term1 then 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-communities-send members 4713:100 user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 from protocol bgp user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 from community addpath-communities-send user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 then add-path send-count 16 user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 then 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-statement addpath-communities-send-4713-100 {
term term1 {
from {
protocol bgp;
community addpath-communities-send;
}
then {
add-path send-count 16;
accept;
}
}
}
community addpath-communities-send members 4713:100;
[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 发送多条路径。
行动
在操作模式下,对路由器 RR4 运行 show route advertising-protocol bgp neighbor-address 命令。
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 接收多路径路由。
行动
在操作模式下,对路由器 R8 运行 show route receive-protocol bgp neighbor-address 命令。
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 接收路由 199.1.1.1/32 的多个下一跃点 10.0.0.20、10.0.0.30 和 10.0.15.2。
验证路由器 RR4 是否仅播发至路由器 R8 的社区值为 4713:100 的多路径路由
目的
路由器 RR4 必须仅向路由器 R8 播发社区值为 4713:100 的多路径路由。
行动
在操作模式下,对路由器 RR4 运行 show route 199.1.1.1/32 detail 命令。
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 支持 RSVP 和 LDP LSP 配置 16、32、64 或 128 个等价多路径 (ECMP) 下一跃点。对于具有高流量的网络,这提供了更大的灵活性,可以在多达 128 个 LSP 上均衡流量负载。
要配置 ECMP 下一跃点的最大限制,请在层次结构级别包含[edit chassis]该maximum-ecmp next-hops语句:
[edit chassis] maximum-ecmp next-hops;
您可以使用此语句将最大 ECMP 下一跃点限制配置为 16、32、64 或 128。默认限制为 16。
具有一个或多个模块化端口集中器 (MPC) 卡并安装了 Junos OS 11.4 或更低版本的 MX 系列路由器,支持仅包含 16 个下一跃点的 maximum-ecmp 语句配置。不应 将语 句配置 maximum-ecmp 为 32 或 64 个下一跃点。当您提交具有 32 或 64 个下一跃点的配置时,将显示以下警告消息:
Error: Number of members in Unilist NH exceeds the maximum supported 16 on Trio.
以下类型的路由支持多达 128 个 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
增强型 ECMP 限制(最多可达 128 个 ECMP 下一跃点)也适用于通过 MPLS 路由解析的第 3 层 VPN、第 2 层 VPN、第 2 层电路和 VPLS 服务,因为此类流量也可以使用 MPLS 路由中的可用 ECMP 路径。
如果 RSVP LSP 配置了带宽分配,对于具有超过 16 个 LSP 的 ECMP 下一跃点,流量不会根据配置的带宽进行最佳分配。一些分配带宽较小的 LSP 接收的流量比配置较高带宽的 LSP 更多。流量分配不严格遵守配置的带宽分配。此警告适用于以下路由器:
-
具有所有类型的 FPC 和 DPC(不包括 MPC)的 MX 系列路由器。此警告 不适用于线 卡采用 Junos Trio 芯片组的 MX 系列路由器。
要查看 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 添加路径 功能,以便在 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 组配置一致的负载平衡:
使用多个 ECMP BGP 对等方提高网络弹性配置
概述
等价多路径 (ECMP) 是一种网络路由策略,允许同一会话或流的流量以等价的多条路径传输。流量是具有相同源和目标的流量。ECMP 进程可识别哪些路由器是朝向流目标的合法等价下一跃点。然后,设备会使用负载平衡在这多个等价下一跃点之间均匀分配流量。ECMP 是一种机制,使您(网络管理员)能够通过充分利用指向同一目标的链路上其他未使用的带宽来均衡流量负载并增加带宽。
您经常将 ECMP 与 BGP 配合使用。每个 BGP 路由可以有多个 ECMP 下一跃点。BGP 导出策略确定是否将 BGP 路由播发到这些下一跃点。作为网络管理员,您可以控制 BGP 前缀与这些 ECMP 对等方之间的播发和撤销。BGP 导出策略根据从中接收前缀的 ECMP BGP 对等方的数量确定是否播发 BGP 前缀。
您可以将BGP导出策略配置为撤回BGP路由,除非该路由从最少数量的 ECMP BGP对等方接收BGP路由前缀。要求 BGP 路由具有多个 ECMP BGP 对等方,可在发生链路故障时提供更好的弹性。
优势
-
提高网络弹性
-
防止链路意外过载
-
协助负载平衡
配置
BGP 导出策略会将 BGP 路由的 ECMP 下一跃点数与您在以下任一层次结构中使用语句配置 from nexthop-ecmp 的值进行比较: [edit policy-options policy-statement policy-name] 或 [edit policy-options policy-statement policy-name term term-name]。
此语句的选项包括:
-
value满足条件所需的确切数量的 ECMP 网关(1 到 512)。 -
equal:网关数量必须等于配置的值。 -
greater-than:网关数量必须大于配置的值。 -
greater-than-equal:网关数量必须大于或等于配置的值。 -
less-than:网关数量必须小于配置的值。 -
less-than-equal:网关数量必须小于或等于配置的值。
了解 BGP 标记单播 LSP 的熵标签
什么是熵标签?
熵标签是一种特殊的负载均衡标签,可增强路由器跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 负载均衡流量的能力。平均信息量标签允许路由器仅使用标签堆栈(而非深度包检测 (DPI))来有效地均衡流量负载。DPI 需要更多的路由器处理能力,并且并非所有路由器都具有此功能。
当 IP 数据包有多个路径可以到达其目标时,Junos OS 会使用数据包标头的某些字段将数据包散列为确定性路径。数据包的源地址或目标地址和端口号用于散列,以避免对给定流进行数据包重新排序。如果核心标签交换路由器 (标签交换路由器) 无法执行 DPI 来识别流量,或者无法以线速执行此操作,则仅将标签堆栈用于 ECMP 散列。这需要一个平均信息量标签,一种可以携带流信息的特殊负载平衡标签。与中转 LSR 相比,入口标签交换路由器包含更多关于传入数据包的上下文和信息。因此,入口标签边缘路由器(LER)可以检查数据包的流信息,将其映射到平均信息量标签中,并将其插入到标签堆栈中。核心中的 LSR 只需使用熵标签作为密钥,即可将数据包散列到正确的路径。
熵标签可以是 16 到 1048575 之间的任何标签值(常规 20 位标签范围)。由于此范围与现有的常规标签范围重叠,因此在平均信息量标签之前插入了一个称为熵标签指示器 (ELI) 的特殊标签。ELI 是 IANA 分配的特殊标签,值为 7。
图 9 展示了 RSVP 标签交换路径 (LSP) 数据包标签堆栈中的平均信息量标签。标签堆栈由熵标签指示器 (ELI)、熵标签和 IP 数据包组成。
的熵标签
BGP 标记单播的熵标签
BGP 标记的单播跨多个内部网关协议 (IGP) 区域或多个自治系统(AS 间 LSP)连接 RSVP 或 LDP LSP。当入口 BGP 和出口 PE 位于不同的 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 标记的单播拼接节点向提供商边缘路由器发出 BGP 熵标签功能 (ELC) 信号,则 BGP 标记的单播 LSP 入口知道 BGP 标记的单播 LSP 出口可以处理熵标签,并在 BGP 标签下方插入熵标签指示器和熵标签。所有 LSR 都能够使用熵标签进行负载平衡。BGP 标签单播 LSP 可能会跨越不同区域和 AS 中的许多路由器,但某些分段可能支持平均信息量标签,而另一些则可能不支持。 图 11 展示了 BGP 标签堆栈中的平均信息量标签。拼接节点上的标签堆栈由 ELI、平均信息量标签和 IP 数据包组成。
处带有 BGP 熵标签
要在出口节点上禁用带有 BGP 标签的单播的熵标签功能,请在层次结构级别使用[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
默认情况下,支持平均信息量标签的路由器在层次结构级别配置[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
默认情况下,BGP 发言者使用在 IETF BGP 路由器功能属性 (RCA) 中定义的熵标签功能 (ELCv3) 属性进行负载平衡。它仅发送和接收 ELCv3 属性。如果您需要使用可与 RCA 草稿互操作的 ELCv2 属性,请在标签单播平均信息量标签层次结构上显式配置 elc-v2-compatible 旋钮。在这种情况下,发送和接收 ELCv3 和 ELCv2。
支持和不支持的功能
在以下情况下,Junos OS 支持带有 BGP 标签的单播的熵标签:
-
LSP 的所有节点都具有平均信息量标签功能。
-
LSP 的某些节点具有熵标签功能。
-
LSP 通过其他运营商的 VPN 进行隧道传输。
-
定义入口策略以选择带有 BGP 标签的单播 LSP 子集,以便在入口处插入平均信息量标签。
-
定义出口策略以禁用平均信息量标签功能播发。
对于带有单播的 BGP 标签,Junos OS 不支持以下熵标签功能:
-
当带有 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 或 IGP 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 或 IGP LSP。RSVP 或 LDP 熵标签与 RSVP 或 LDP 标签一起弹出在倒数第二个跃点节点上。此功能允许在拼接点使用熵标签来弥合倒数第二个跃点节点和拼接点之间的间隙,以实现 BGP 流量的端到端熵标签负载平衡。
要求
此示例使用以下硬件和软件组件:
-
七款带 MPC 的 MX 系列路由器
-
在所有设备上运行 Junos OS 15.1 或更高版本
-
使用 Junos OS Relese 22.4 重新验证
-
在为 BGP 标记的单播配置平均信息量标签之前,请确保您:
-
配置设备接口。
-
配置 OSPF 或任何其他 IGP 协议。
-
配置 BGP。
-
配置 RSVP。
-
配置 MPLS。
概述
当 BGP 标记的单播跨多个 IGP 区域或多个自治系统连接 RSVP 或 LDP IGP 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
对于策略中 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
拓扑结构
在 图 12 中,路由器 PE1 是入口路由器,路由器 PE2 是出口路由器。路由器 P1 和 P2 是中转路由器。路由器 ABR 是区域 0 和区域 1 之间的区域网桥路由器。ABR 上配置了两个 LSP 到 PE2,用于流量负载平衡。入口路由器 PE1 上已启用带有 BGP 标签的单播的熵标签功能。主机 1 连接到 P1 以进行数据包捕获,以便我们可以显示熵标签。
配置熵标签
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层次结构级别的 [edit] CLI 中,然后从配置模式进入。commit
路由器 CE1
set interfaces ge-0/0/0 unit 0 family inet address 172.16.12.1/30 set interfaces lo0 unit 0 family inet address 172.16.255.1/32 primary set interfaces lo0 unit 0 family inet address 192.168.255.1/32 set routing-options router-id 172.16.255.1 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive
路由器 PE1
set interfaces ge-0/0/0 unit 0 family inet address 172.16.12.2/30 set interfaces ge-0/0/2 unit 0 family inet address 10.1.23.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.255.2/32 primary set interfaces lo0 unit 1 family inet address 10.1.255.22/32 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 pplb then load-balance per-packet set routing-instances VPN-l3vpn instance-type vrf set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface lo0.1 passive set routing-instances VPN-l3vpn protocols ospf export bgp-to-ospf set routing-instances VPN-l3vpn interface ge-0/0/0.0 set routing-instances VPN-l3vpn interface lo0.1 set routing-instances VPN-l3vpn route-distinguisher 10.1.255.2:1 set routing-instances VPN-l3vpn vrf-target target:65000:1 set routing-options router-id 10.1.255.2 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 10.1.255.2 set protocols bgp group ibgp family inet labeled-unicast entropy-label set protocols bgp group ibgp neighbor 10.1.255.4 family inet labeled-unicast rib inet.3 set protocols bgp group ibgp neighbor 10.1.255.6 family inet-vpn unicast set protocols mpls icmp-tunneling set protocols mpls label-switched-path pe1-abr to 10.1.255.4 set protocols mpls label-switched-path pe1-abr entropy-label set protocols mpls interface ge-0/0/2.0 set protocols mpls interface lo0.0 set protocols ospf traffic-engineering set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols rsvp interface ge-0/0/2.0 set protocols rsvp interface lo0.0
路由器 P1
set interfaces ge-0/0/0 unit 0 family inet address 10.1.23.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/2 unit 0 family inet address 10.1.34.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.255.3/32 primary set routing-options router-id 10.1.255.3 set protocols mpls icmp-tunneling set protocols mpls interface ge-0/0/0.0 set protocols mpls interface lo0.0 set protocols mpls interface ge-0/0/2.0 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/2.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/2.0
路由器 ABR
set interfaces ge-0/0/0 unit 0 family inet address 10.1.34.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/2 unit 0 family inet address 10.1.45.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 unit 0 family inet address 10.1.45.5/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.255.4/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 policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement send-inet3-pe1 from route-filter 10.1.255.2/32 exact set policy-options policy-statement send-inet3-pe1 then accept set policy-options policy-statement send-inet3-pe2 from route-filter 10.1.255.6/32 exact set policy-options policy-statement send-inet3-pe2 then accept set routing-options router-id 10.1.255.4 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 10.1.255.4 set protocols bgp group ibgp family inet labeled-unicast rib inet.3 set protocols bgp group ibgp neighbor 10.1.255.2 export send-inet3-pe2 set protocols bgp group ibgp neighbor 10.1.255.6 export send-inet3-pe1 set protocols mpls icmp-tunneling set protocols mpls label-switched-path abr-pe1 to 10.1.255.2 set protocols mpls label-switched-path abr-pe1 entropy-label set protocols mpls label-switched-path abr-pe2 to 10.1.255.6 set protocols mpls label-switched-path abr-pe2 entropy-label set protocols mpls label-switched-path abr-pe2 primary to-r6-1 set protocols mpls label-switched-path abr-pe2-2 to 10.1.255.6 set protocols mpls label-switched-path abr-pe2-2 entropy-label set protocols mpls label-switched-path abr-pe2-2 primary to-r6-2 set protocols mpls path to-r6-1 10.1.45.2 strict set protocols mpls path to-r6-1 10.1.56.2 strict set protocols mpls path to-r6-2 10.1.45.6 strict set protocols mpls path to-r6-2 10.1.56.6 strict set protocols mpls interface lo0.0 set protocols mpls interface ge-0/0/0.0 set protocols mpls interface ge-0/0/2.0 set protocols mpls interface ge-0/0/3.0 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.1 interface ge-0/0/2.0 set protocols ospf area 0.0.0.1 interface ge-0/0/3.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface ge-0/0/2.0 set protocols rsvp interface ge-0/0/3.0
路由器 P2
set interfaces ge-0/0/0 unit 0 family inet address 10.1.45.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 family inet address 10.1.45.6/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 unit 0 family inet address 10.1.56.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 unit 0 family inet address 10.1.56.5/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.255.5/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 policy-options policy-statement pplb then load-balance per-packet set routing-options router-id 10.1.255.5 set routing-options forwarding-table export pplb set protocols mpls icmp-tunneling set protocols mpls interface ge-0/0/2.0 set protocols mpls interface lo0.0 set protocols mpls interface ge-0/0/0.0 set protocols mpls interface ge-0/0/1.0 set protocols mpls interface ge-0/0/3.0 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 ge-0/0/2.0 set protocols ospf area 0.0.0.1 interface ge-0/0/0.0 set protocols ospf area 0.0.0.1 interface ge-0/0/1.0 set protocols ospf area 0.0.0.1 interface ge-0/0/3.0 set protocols rsvp interface ge-0/0/2.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface ge-0/0/1.0 set protocols rsvp interface ge-0/0/3.0
路由器 PE2
set interfaces ge-0/0/0 unit 0 family inet address 10.1.56.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 unit 0 family inet address 10.1.56.6/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 unit 0 family inet address 172.16.67.2/30 set interfaces lo0 unit 0 family inet address 10.1.255.6/32 primary set interfaces lo0 unit 1 family inet address 10.1.255.66/32 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 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 pplb then load-balance per-packet set routing-instances VPN-l3vpn instance-type vrf 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 lo0.1 passive set routing-instances VPN-l3vpn protocols ospf export bgp-to-ospf set routing-instances VPN-l3vpn interface ge-0/0/2.0 set routing-instances VPN-l3vpn interface lo0.1 set routing-instances VPN-l3vpn route-distinguisher 10.1.255.6:1 set routing-instances VPN-l3vpn vrf-target target:65000:1 set routing-options router-id 10.1.255.6 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb set protocols bgp group ibgp type internal set protocols bgp group ibgp local-address 10.1.255.6 set protocols bgp group ibgp family inet labeled-unicast entropy-label set protocols bgp group ibgp neighbor 10.1.255.4 family inet labeled-unicast rib inet.3 set protocols bgp group ibgp neighbor 10.1.255.2 family inet-vpn unicast set protocols mpls icmp-tunneling set protocols mpls label-switched-path pe2-abr to 10.1.255.4 set protocols mpls label-switched-path pe2-abr entropy-label set protocols mpls interface ge-0/0/0.0 set protocols mpls interface lo0.0 set protocols mpls interface ge-0/0/1.0 set protocols ospf traffic-engineering set protocols ospf area 0.0.0.1 interface ge-0/0/0.0 set protocols ospf area 0.0.0.1 interface lo0.0 passive set protocols ospf area 0.0.0.1 interface ge-0/0/1.0 set protocols rsvp interface ge-0/0/0.0 set protocols rsvp interface lo0.0 set protocols rsvp interface ge-0/0/1.0
路由器 CE2
set interfaces ge-0/0/0 unit 0 family inet address 172.16.67.1/30 set interfaces lo0 unit 0 family inet address 172.16.255.7/32 primary set interfaces lo0 unit 0 family inet address 192.168.255.7/32 set routing-options router-id 172.16.255.7 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive
配置路由器 PE1
分步程序
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 《CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置路由器 PE1,请执行以下操作:
修改相应的接口名称、地址和其他参数后,对路由器 PE2 重复此过程。
-
配置物理接口。确保在面向核心的接口上进行配置
family mpls。[edit] user@PE1# set interfaces ge-0/0/0 unit 0 family inet address 172.16.12.2/30 user@PE1# set interfaces ge-0/0/2 unit 0 family inet address 10.1.23.1/30 user@PE1# set interfaces ge-0/0/2 unit 0 family mpls
-
配置环路接口。辅助环路是可选的,在后面的步骤中应用于路由实例。
[edit] user@PE1# set interfaces lo0 unit 0 family inet address 10.1.255.2/32 primary user@PE1# set interfaces lo0 unit 1 family inet address 10.1.255.22/32
-
配置路由器 ID 和自治系统编号。
[edit] user@PE1# set routing-options router-id 10.1.255.2 user@PE1# set routing-options autonomous-system 65000
-
配置 OSPF 协议。
[edit] user@PE1# set protocols ospf traffic-engineering user@PE1# set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 user@PE1# set protocols ospf area 0.0.0.0 interface lo0.0 passive
-
配置 RSVP 协议。
[edit] user@PE1# set protocols rsvp interface ge-0/0/2.0 user@PE1# set protocols rsvp interface lo0.0
-
配置 MPLS 协议和指向 ABR 的 LSP。 包括以下选项
entropy-label以将平均信息量标签添加到 MPLS 标签堆栈。[edit protocols] user@PE1# set protocols mpls icmp-tunneling user@PE1# set protocols mpls label-switched-path pe1-abr to 10.1.255.4 user@PE1# set protocols mpls label-switched-path pe1-abr entropy-label user@PE1# set protocols mpls interface ge-0/0/2.0 user@PE1# set protocols mpls interface lo0.0
-
用于
family inet labeled-unicastABR 对等和family inet-vpnPE2 对等配置 IBGP。为带有 BGP 标签的单播启用平均信息量标签功能。[edit] user@PE1# set protocols bgp group ibgp type internal user@PE1# set protocols bgp group ibgp local-address 10.1.255.2 user@PE1# set protocols bgp group ibgp family inet labeled-unicast entropy-label user@PE1# set protocols bgp group ibgp neighbor 10.1.255.4 family inet labeled-unicast rib inet.3 user@PE1# set protocols bgp group ibgp neighbor 10.1.255.6 family inet-vpn unicast
-
定义用于将 BGP VPN 路由导出到 OSPF 的策略。策略将在路由实例的 OSPF 下应用。
[edit] user@PE1# set policy-options policy-statement bgp-to-ospf from protocol bgp user@PE1# set policy-options policy-statement bgp-to-ospf then accept
-
定义负载平衡策略并将其应用
routing-options forwarding-table到 .PE1 在本例中只有一条路径,因此不需要执行此步骤,但在本例中,我们将在所有设备上应用相同的负载平衡策略。[edit] user@PE1# set policy-options policy-statement pplb then load-balance per-packet user@PE1# set routing-options forwarding-table export pplb
-
配置第 3 层 VPN 路由实例。
[edit] user@PE1# set routing-instances VPN-l3vpn instance-type vrf
-
将接口分配给路由实例。
[edit] user@PE1# set routing-instances VPN-l3vpn interface ge-0/0/0.0 user@PE1# set routing-instances VPN-l3vpn interface lo0.1
-
为路由实例配置路由识别符。
[edit] user@PE1# set routing-instances VPN-l3vpn route-distinguisher 10.1.255.2:1
-
为路由实例配置 VPN 路由和转发 (VRF) 目标。
[edit] user@PE1# set routing-instances VPN-l3vpn vrf-target target:65000:1
-
在路由实例下配置协议 OSPF 并应用之前配置
bgp-to-ospf的策略。[edit] user@PE1# set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface ge-0/0/0.0 user@PE1# set routing-instances VPN-l3vpn protocols ospf area 0.0.0.0 interface lo0.1 passive user@PE1# set routing-instances VPN-l3vpn protocols ospf export bgp-to-ospf
配置路由器 P1
分步程序
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 《CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置路由器 P1,请执行以下操作:
修改相应的接口名称、地址和其他参数后,对路由器 P2 重复此过程。
-
配置物理接口。
[edit] user@P1# set interfaces ge-0/0/0 unit 0 family inet address 10.1.23.2/30 user@P1# set interfaces ge-0/0/0 unit 0 family mpls user@P1# set interfaces ge-0/0/2 unit 0 family inet address 10.1.34.1/30 user@P1# set interfaces ge-0/0/2 unit 0 family mpls
-
配置环路接口。
[edit] user@P1# set interfaces lo0 unit 0 family inet address 10.1.255.3/32 primary
-
配置路由器 ID。
[edit] user@P1# set routing-options router-id 10.1.255.3
-
配置 OSPF 协议。
[edit] 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 ge-0/0/0.0 user@P1# set protocols ospf area 0.0.0.0 interface ge-0/0/2.0
-
配置 RSVP 协议。
[edit] user@P1# set protocols rsvp interface ge-0/0/0.0 user@P1# set protocols rsvp interface lo0.0 user@P1# set protocols rsvp interface ge-0/0/2.0
-
配置 MPLS 协议。
[edit] user@P1# set protocols mpls icmp-tunneling user@P1# set protocols mpls interface ge-0/0/0.0 user@P1# set protocols mpls interface lo0.0 user@P1# set protocols mpls interface ge-0/0/2.0
配置路由器 ABR
分步程序
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 《CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置路由器 ABR,请执行以下操作:
-
配置物理接口。
[edit] user@ABR# set interfaces ge-0/0/0 unit 0 family inet address 10.1.34.2/30 user@ABR# set interfaces ge-0/0/0 unit 0 family mpls user@ABR# set interfaces ge-0/0/2 unit 0 family inet address 10.1.45.1/30 user@ABR# set interfaces ge-0/0/2 unit 0 family mpls user@ABR# set interfaces ge-0/0/3 unit 0 family inet address 10.1.45.5/30 user@ABR# set interfaces ge-0/0/3 unit 0 family mpls
-
配置环路接口。
[edit] user@ABR# set interfaces lo0 unit 0 family inet address 10.1.255.4/32 primary
-
配置路由器用于将数据包散列到目的地以实现负载平衡的 MPLS 标签。
[edit] user@ABR# set forwarding-options hash-key family mpls label-1 user@ABR# set forwarding-options hash-key family mpls label-2 user@ABR# set forwarding-options hash-key family mpls label-3 user@ABR# set forwarding-options enhanced-hash-key family mpls no-payload
-
配置路由器 ID 和自治系统编号。
[edit] user@ABR# set routing-options router-id 10.1.255.4 user@ABR# set routing-options autonomous-system 65000
-
配置 OSPF 协议。
[edit] user@ABR# set protocols ospf traffic-engineering user@ABR# set protocols ospf area 0.0.0.0 interface lo0.0 passive user@ABR# set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 user@ABR# set protocols ospf area 0.0.0.1 interface ge-0/0/2.0 user@ABR# set protocols ospf area 0.0.0.1 interface ge-0/0/3.0
-
配置 RSVP 协议。
[edit] user@ABR# set protocols rsvp interface lo0.0 user@ABR# set protocols rsvp interface ge-0/0/0.0 user@ABR# set protocols rsvp interface ge-0/0/2.0 user@ABR# set protocols rsvp interface ge-0/0/3.0
-
配置 MPLS 协议并指定面向 PE1 和 PE2 的 LSP。系统会向 PE2 创建两个 LSP,以便对流量进行负载平衡,以显示使用了不同的 LSP 和接口。
[edit] user@ABR# set protocols mpls icmp-tunneling user@ABR# set protocols mpls label-switched-path abr-pe1 to 10.1.255.2 user@ABR# set protocols mpls label-switched-path abr-pe1 entropy-label user@ABR# set protocols mpls label-switched-path abr-pe2 to 10.1.255.6 user@ABR# set protocols mpls label-switched-path abr-pe2 entropy-label user@ABR# set protocols mpls label-switched-path abr-pe2 primary to-r6-1 user@ABR# set protocols mpls label-switched-path abr-pe2-2 to 10.1.255.6 user@ABR# set protocols mpls label-switched-path abr-pe2-2 entropy-label user@ABR# set protocols mpls label-switched-path abr-pe2-2 primary to-r6-2 user@ABR# set protocols mpls path to-r6-1 10.1.45.2 strict user@ABR# set protocols mpls path to-r6-1 10.1.56.2 strict user@ABR# set protocols mpls path to-r6-2 10.1.45.6 strict user@ABR# set protocols mpls path to-r6-2 10.1.56.6 strict user@ABR# set protocols mpls interface lo0.0 user@ABR# set protocols mpls interface ge-0/0/0.0 user@ABR# set protocols mpls interface ge-0/0/2.0 user@ABR# set protocols mpls interface ge-0/0/3.0
-
使用
family inet labeled-unicast将 IBGP 配置为 PE1 和 PE2。应用策略以播发来自 PE1 和 PE2 的 inet.3 环路路由。我们将在下一步中展示策略。[edit] user@ABR# set protocols bgp group ibgp type internal user@ABR# set protocols bgp group ibgp local-address 10.1.255.4 user@ABR# set protocols bgp group ibgp family inet labeled-unicast rib inet.3 user@ABR# set protocols bgp group ibgp neighbor 10.1.255.2 export send-inet3-pe2 user@ABR# set protocols bgp group ibgp neighbor 10.1.255.6 export send-inet3-pe1
-
定义要在 PE1 和 PE2 的环路地址上匹配的策略。
[edit] user@ABR# set policy-options policy-statement send-inet3-pe1 from route-filter 10.1.255.2/32 exact user@ABR# set policy-options policy-statement send-inet3-pe1 then accept user@ABR# set policy-options policy-statement send-inet3-pe2 from route-filter 10.1.255.6/32 exact user@ABR# set policy-options policy-statement send-inet3-pe2 then accept
-
定义负载平衡策略并将其应用
routing-options forwarding-table到 .[edit] user@ABR# set policy-options policy-statement pplb then load-balance per-packet user@ABR# set routing-options forwarding-table export pplb
(选答)端口镜像配置
要查看应用的熵标签,可以捕获流量。在此示例中,过滤器应用于 P1 上面向 PE1 的接口,以捕获 CE1 到 CE2 的流量。流量被发送到主机 1 以供查看。捕获流量的方法与本例中使用的方法不同。有关更多信息,请参阅 端口镜像和分析器。
分步程序
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 《CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置路由器 P1,请执行以下操作:
-
配置接口。在此示例中,我们将连接到 Host1 的接口置于桥接域中,并创建一个用于验证与 Host1 的连接的 IRB 接口。
[edit] user@P1# set interfaces ge-0/0/4 unit 0 family bridge interface-mode access user@P1# set interfaces ge-0/0/4 unit 0 family bridge vlan-id 100 user@P1# set interfaces irb unit 0 family inet address 10.1.31.1/30
-
配置网桥域。
[edit] user@P1# set bridge-domains v100 vlan-id 100 user@P1# set bridge-domains v100 routing-interface irb.0
-
配置过滤器以捕获流量。在本例中,我们将捕获所有流量。
[edit] user@P1# set firewall family any filter test term 1 then count test user@P1# set firewall family any filter test term 1 then port-mirror user@P1# set firewall family any filter test term 1 then accept
-
将过滤器应用于面向 PE1 的接口。
[edit] user@P1# set interfaces ge-0/0/0 unit 0 filter input test
-
配置端口镜像选项。在本例中,我们将镜像所有流量并将其发送到连接到接口 ge-0/0/4 的 Host1。
[edit] user@P1# set forwarding-options port-mirroring input rate 1 user@P1# set forwarding-options port-mirroring family any output interface ge-0/0/4.0
验证
确认配置工作正常。
- 验证是否正在播发熵标签功能
- 验证路由器 PE1 是否接收熵标签通告
- 验证 ABR 到 PE2 的 ECMP
- 在 PE1 上显示到 CE2 的路由
- 从 CE1 对 CE2 执行 Ping 操作
- 验证负载平衡
- 验证熵标签
验证是否正在播发熵标签功能
目的
验证是否正在将平均信息量标签功能路径属性从 ABR 播发到 PE1,以便路由到 PE2。
行动
在操作模式下,对路由器 ABR 运行 show route advertising-protocol bgp 10.1.255.2 detail 命令。
user@ABR> show route advertising-protocol bgp 10.1.255.2 detail
inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
* 10.1.255.6/32 (1 entry, 1 announced)
BGP group ibgp type Internal
Route Label: 299952
Nexthop: Self
Flags: Nexthop Change
MED: 2
Localpref: 4294967294
AS path: [65000] I
Entropy label capable
意义
输出显示,IP 地址为 10.1.255.6 的主机 PE2 具有平均信息量标签功能和使用的路由标签。主机正在向其 BGP 邻接方播发平均信息量标签功能。
验证路由器 PE1 是否接收熵标签通告
目的
验证路由器 PE1 是否收到路由器 PE2 的平均信息量标签播发。
行动
在操作模式下,对路由器 PE1 运行 show route protocol bgp 10.1.255.6 extensive 命令。
user@PE1> show route protocol bgp 10.1.255.6 extensive
inet.0: 19 destinations, 19 routes (19 active, 0 holddown, 0 hidden)
inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
10.1.255.6/32 (1 entry, 1 announced)
*BGP Preference: 170/1
Next hop type: Indirect, Next hop index: 0
Address: 0x7b3ffd4
Next-hop reference count: 2, key opaque handle: 0x0, non-key opaque handle: 0x0
Source: 10.1.255.4
Next hop type: Router, Next hop index: 0
Next hop: 10.1.23.2 via ge-0/0/2.0, selected
Label-switched-path pe1-abr
Label operation: Push 299952, Push 299808(top)
Label TTL action: prop-ttl, prop-ttl(top)
Load balance label: Label 299952: Entropy label; Label 299808: None;
Label element ptr: 0x93d6bf8
Label parent element ptr: 0x93d6c20
Label element references: 3
Label element child references: 2
Label element lsp id: 0
Session Id: 0
Protocol next hop: 10.1.255.4
Label operation: Push 299952
Label TTL action: prop-ttl
Load balance label: Label 299952: Entropy label;
Indirect next hop: 0x758c05c - INH Session ID: 0
State: <Active Int Ext>
Local AS: 65000 Peer AS: 65000
Age: 1:33:11 Metric: 2 Metric2: 2
Validation State: unverified
Task: BGP_65000.10.1.255.4
Announcement bits (2): 3-Resolve tree 1 4-Resolve_IGP_FRR task
AS path: I
Accepted
Route Label: 299952
Localpref: 4294967294
Router ID: 10.1.255.4
Session-IDs associated:
Session-id: 324 Version: 3
Thread: junos-main
Indirect next hops: 1
Protocol next hop: 10.1.255.4 Metric: 2 ResolvState: Resolved
Label operation: Push 299952
Label TTL action: prop-ttl
Load balance label: Label 299952: Entropy label;
Indirect next hop: 0x758c05c - INH Session ID: 0
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.1.23.2 via ge-0/0/2.0
Session Id: 0
10.1.255.4/32 Originating RIB: inet.3
Metric: 2 Node path count: 1
Forwarding nexthops: 1
Next hop type: Router
Next hop: 10.1.23.2 via ge-0/0/2.0
Session Id: 0
意义
路由器 PE1 从其 BGP 邻接方接收平均信息量标签功能播发。
验证 ABR 到 PE2 的 ECMP
目的
验证到 PE2 的等价多路径 (ECMP)。
行动
在操作模式下,对路由器 ABR 运行和show route table mpls.0show route forwarding-table label <label>命令。
user@ABR> show route table mpls.0
mpls.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0 *[MPLS/0] 2w1d 23:02:11, metric 1
Receive
1 *[MPLS/0] 2w1d 23:02:11, metric 1
Receive
2 *[MPLS/0] 2w1d 23:02:11, metric 1
Receive
13 *[MPLS/0] 2w1d 23:02:11, metric 1
Receive
299936 *[VPN/170] 2d 21:47:02
> to 10.1.34.1 via ge-0/0/0.0, label-switched-path abr-pe1
299952 *[VPN/170] 2d 21:47:02
> to 10.1.45.2 via ge-0/0/2.0, label-switched-path abr-pe2
to 10.1.45.6 via ge-0/0/3.0, label-switched-path abr-pe2-2
ruser@ABR> show route forwarding-table label 299952
Routing table: default.mpls
MPLS:
Destination Type RtRef Next hop Type Index NhRef Netif
299952 user 0 ulst 1048575 2
10.1.45.2 Swap 299824 516 2 ge-0/0/2.0
10.1.45.6 Swap 299840 572 2 ge-0/0/3.0
...
意义
输出显示用于 BGP 标记单播路由的标签的 ECMP。
在 PE1 上显示到 CE2 的路由
目的
验证到 CE2 的路由。
行动
在操作模式下,在路由器 PE1 上运行show route table VPN-l3vpn.inet.0 172.16.255.7 extensiveshow route table VPN-l3vpn.inet.0 192.168.255.7 extensive和命令。
user@PE1> show route table VPN-l3vpn.inet.0 172.16.255.7 extensive
VPN-l3vpn.inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden)
172.16.255.7/32 (1 entry, 1 announced)
TSI:
OSPF area : 0.0.0.0, LSA ID : 172.16.255.7, LSA type : Summary
KRT in-kernel 172.16.255.7/32 -> {indirect(1048574)}
*BGP Preference: 170/-101
Route Distinguisher: 10.1.255.6:1
Next hop type: Indirect, Next hop index: 0
Address: 0x7b40434
Next-hop reference count: 9, key opaque handle: 0x0, non-key opaque handle: 0x0
Source: 10.1.255.6
Next hop type: Router, Next hop index: 515
Next hop: 10.1.23.2 via ge-0/0/2.0, selected
Label-switched-path pe1-abr
Label operation: Push 299824, Push 299952, Push 299808(top)
Label TTL action: prop-ttl, prop-ttl, prop-ttl(top)
Load balance label: Label 299824: None; Label 299952: Entropy label; Label 299808: None;
Label element ptr: 0x93d6c98
Label parent element ptr: 0x93d6bf8
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 140
Protocol next hop: 10.1.255.6
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
...
user@PE1> show route table VPN-l3vpn.inet.0 192.168.255.7 extensive
VPN-l3vpn.inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden)
192.168.255.7/32 (1 entry, 1 announced)
TSI:
OSPF area : 0.0.0.0, LSA ID : 192.168.255.7, LSA type : Summary
KRT in-kernel 192.168.255.7/32 -> {indirect(1048574)}
*BGP Preference: 170/-101
Route Distinguisher: 10.1.255.6:1
Next hop type: Indirect, Next hop index: 0
Address: 0x7b40434
Next-hop reference count: 9, key opaque handle: 0x0, non-key opaque handle: 0x0
Source: 10.1.255.6
Next hop type: Router, Next hop index: 515
Next hop: 10.1.23.2 via ge-0/0/2.0, selected
Label-switched-path pe1-abr
Label operation: Push 299824, Push 299952, Push 299808(top)
Label TTL action: prop-ttl, prop-ttl, prop-ttl(top)
Load balance label: Label 299824: None; Label 299952: Entropy label; Label 299808: None;
Label element ptr: 0x93d6c98
Label parent element ptr: 0x93d6bf8
Label element references: 1
Label element child references: 0
Label element lsp id: 0
Session Id: 140
Protocol next hop: 10.1.255.6
Label operation: Push 299824
Label TTL action: prop-ttl
Load balance label: Label 299824: None;
...
意义
输出显示,两个路由使用了相同的标签。
从 CE1 对 CE2 执行 Ping 操作
目的
验证连接并用于验证负载平衡。
行动
在操作模式下,在路由器 PE1 上运行ping 172.16.255.7 source 172.16.12.1 rapid count 100ping 192.168.255.7 source 192.168.255.1 rapid count 200和命令。
user@CE1> ping 172.16.255.7 source 172.16.12.1 rapid count 100 PING 172.16.255.7 (172.16.255.7): 56 data bytes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --- 172.16.255.7 ping statistics --- 100 packets transmitted, 100 packets received, 0% packet loss round-trip min/avg/max/stddev = 5.369/6.070/8.828/0.612 ms user@CE1> ping 192.168.255.7 source 192.168.255.1 rapid count 200 PING 192.168.255.7 (192.168.255.7): 56 data bytes !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --- 192.168.255.7 ping statistics --- 200 packets transmitted, 200 packets received, 0% packet loss round-trip min/avg/max/stddev = 5.086/5.994/10.665/0.649 ms
意义
输出显示 ping 成功。
验证负载平衡
目的
验证负载平衡。
行动
在操作模式下,对 ABR 运行 show mpls lsp ingress statistics 命令。
user@ABR> show mpls lsp ingress statistics Ingress LSP: 3 sessions To From State Packets Bytes LSPname 10.1.255.2 10.1.255.4 Up 300 30000 abr-pe1 10.1.255.6 10.1.255.4 Up 200 20000 abr-pe2 10.1.255.6 10.1.255.4 Up 100 10000 abr-pe2-2 Total 3 displayed, Up 3, Down 0
意义
输出显示上一个命令使用的第一个 ping 使用 LSP abr-pe2-2 ,第二个 ping 使用 LSP abr-pe2。
验证熵标签
目的
验证所使用的 ping 之间的熵标签是否不同。
行动
在主机 1 上,运行 tcpdump -i eth1 -n.
user@Host1# tcpdump -i eth1 -n ... 13:42:31.993274 MPLS (label 299808, exp 0, ttl 63) (label 299952, exp 0, ttl 63) (label 7, exp 0, ttl 63) (label 1012776, exp 0, ttl 0) (label 299824, exp 0, [S], ttl 63) IP 172.16.12.1 > 172.16.255.7: ICMP echo request, id 32813, seq 9, length 64 ... 13:43:19.570260 MPLS (label 299808, exp 0, ttl 63) (label 299952, exp 0, ttl 63) (label 7, exp 0, ttl 63) (label 691092, exp 0, ttl 0) (label 299824, exp 0, [S], ttl 63) IP 192.168.255.1 > 192.168.255.7: ICMP echo request, id 46381, seq 9, length 64
意义
输出显示了两个不同 ping 命令的平均信息量标签的不同值。
用于 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) 功能后,全局表中有多个路由(如 inet 和 inet6 单播,以及 inet 和 inet6 标记为单播)的 BGP 会向数据包转发引擎安装第二个最佳路径,以及到目标的计算最佳路径。当网络中的出口路由器发生故障时,路由器会使用此备用路径,从而显著缩短服务中断时间。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
-
一台带有 MPC 的 MX 系列路由器,用于配置 BGP PIC 功能
-
七台路由器,可以是 M Series、MX 系列、T Series 或 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 的路由器上受支持。
拓扑结构
此示例显示了三台客户边缘 (客户边缘) 路由器:设备 CE0、CE1 和 CE2。路由器 PE0、PE1 和 PE2 是提供商边缘 (PE) 路由器。路由器 P0 和 P1 是提供商核心路由器。BGP PIC 配置在路由器 PE0 上。为了进行测试,地址 192.168.1.5 被添加为设备 CE1 上的第二个环路接口地址。地址将通告给路由器 PE1 和 PE2,并由内部 BGP (IBGP) 中继至路由器 PE0。路由器 PE0 上有两条路径可以通向 192.168.1.5 网络。它们是主路径和备用路径。 图 13 显示了示例网络。
配置 BGP PIC
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层次结构级别的 [edit] CLI 中,然后从配置模式进入 commit。
路由器 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 policy-optionsshow protocols和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 Edge 正在正常工作。
行动
从设备 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指示具有被动下一跃点的备用路径。
保留下一跳层次结构概述
在传统的压缩层次结构中,服务标签被合并到单个传输下一跃点 (FNH) 中,这可能导致 PFE 中的下一跃点爆炸。传统的压缩层次结构还可能导致 ECMP 截断和层次结构权重丢失等问题。
保留下一跃点层次结构(也称为扩展层次结构)将每个服务标签保留在自己的链复合中,保留原始层次结构,而不是将所有内容合并到单个下一跃点结构中。
保留下一跳层次结构的好处
此功能具有以下优势:
- 减少转发下一跃点资源:显著减少转发下一跃点资源/计数。
- 所有级别的 BGP PIC:支持跨所有层级(传输、服务、复合链)的 BGP PIC,确保 BGP 路径的快速故障切换和本地融合。
- 保留层次结构权重:维护 ECMP 和层次结构路由方案的权重和带宽分布。
- 避免 ECMP 截断:确保所有 ECMP 支路都安装在 PFE 中,从而改善负载平衡和弹性。
第 2 层服务(第 2 层电路、第 2 层 VPN)、第 3 层 VPN(IPv4 和 IPv6)、VPLS、IPIP 隧道、互联网服务(IPv4、IPv6、6PE)、EVPN 和 PRPD 等服务支持保留下一跳层次结构。
传输协议,例如 BGP 标记单播、BGP 分类传输 (BGP-CT)、RSVP-流量工程、SR-MPLS、SR-FlexAlgo、SR-流量工程、SRv6 流量工程、MPLS-over-UDP 支持 通过传输类基础架构保留下一跳层次结构。
有关支持保留下一跳层次结构的平台列表,请参阅 功能浏览器 工具。
配置保留下一跃点层次结构
要配置保留下一跃点层次结构功能,请在 preserve-nexthop-hierarchy [edit routing-options resolution] 层级包含该语句。这可以确保所有相关的路由进程都遵循已建立的下一跳层次结构。这有助于在路径故障情况下高效解析路由并更快地进行调整,从而有助于提高网络性能。
保留下一跳层次结构功能有利于需要高可用性并与先进技术无缝集成的网络,例如使用 MPLS 的分段路由和使用 IPv6 的分段路由。它们可在复杂的网络架构中提供改进的流量分配、冗余和一致的路由行为。
preserve-nexthop-hierarchy语句时,将重新计算受影响路由指向的下一跃点并将其下载到 PFE 和内核。这会导致在较大规模的环境中,设备中的 CPU 峰值较高,从而导致数据包丢失,直到在 PFE 中重新编程路由。
使用 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 边缘支持第 3 层服务,并将 BGP 标记为单播作为传输协议。此外,在瞻博网络 MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备上,BGP PIC Edge 支持第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务,并将标签为单播的 BGP 用作传输协议。这些 BGP 服务是多路径(从多个 PE 中获知),并通过 BGP 标记的单播路由解析,这也可能是从其他 ABR 获知的多路径。通过 BGP PIC Edge 支持的传输协议包括 RSVP、LDP、OSPF 和 ISIS。从 Junos OS 20.2R1 版开始,MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备支持对第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务的 BGP PIC 边缘保护,并将 BGP 标记为单播作为传输协议。
在瞻博网络 MX 系列、EX 系列和 PTX 系列设备上,以下服务支持使用标记为单播的 BGP BGP PIC 边缘保护:
通过 IPv4 BGP 标记的单播提供 IPv4 服务
IPv6 基于 IPv4 BGP 标签的单播服务 BGP 标签的单播
通过 IPv4 BGP 标记单播的 IPv4 第 3 层 VPN 服务
通过 IPv4 BGP 标记的单播实现 IPv6 第 3 层 VPN 服务
在瞻博网络 MX 系列和 EX 系列设备上,以下服务支持使用标记为单播的 BGP BGP PIC 边缘保护:
通过 IPv4 BGP 标记的单播实现第 2 层电路服务
通过 IPv4 BGP 标记的单播实现第 2 层 VPN 服务
通过 IPv4 实现的 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务BGP标记为 单播
为第 2 层服务使用BGP标记的单播配置 BGP PIC Edge
MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备支持对第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务的 BGP PIC 边缘保护,并将标记为单播的 BGP 作为传输协议。使用 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 负载平衡下一跃点启用 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 流量。当来自客户边缘路由器的 IPv4 流量发送到 PE 路由器时,IPv4 流量将通过第 3 层 VPN 进行路由,其中 BGP 标记的单播被配置为传输协议。
要求
此示例使用以下硬件和软件组件:
-
MX 系列路由器。
-
所有设备上运行 Junos OS 19.4R1 或更高版本。
概述
以下拓扑通过在主路径不可用时将流量切换到备用路径来提供 ABR 和 ASBR 保护。
拓扑结构
图 14 展示了第 3 层 VPN 运行标记为单播的 BGP,作为域间传输协议。
下表介绍了拓扑中使用的组件:
| 主要组件 |
设备类型 |
职位 |
|---|---|---|
| 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 系列 |
连接到客户网络。 |
PE2 和 PE3 设备地址作为标记的单播路由从 ABR1 和 ABR2 学习。这些路由通过 IGP/LDP 协议进行解析。PE1 从 PE2 和 PE3 设备学习 CE2 路由。
配置
要使用 BGP 标签单播(LDP 作为传输协议)配置 BGP PIC Edge,请执行以下任务:
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-optionsshow 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 interfaces、 show policy-options和 show protocols 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 interfaces、 show policy-optionsshow routing-options和 show protocols 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 interfaces、 show policy-optionsshow routing-options和 show protocols 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 interfaces、 show policy-optionsshow routing-options和 show protocols 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 interfaces、 show policy-optionsshow routing-options和 show protocols 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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 interfaces、 show policy-optionsshow routing-options和 show protocols 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
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;
}
}
验证
确认配置工作正常。
验证下一跃点是否已解析
目的
验证 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
意义
您可以查看主跃点和备用下一跃点的权重0x10x4000。
验证路由表中的下一跃点条目
目的
验证 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
意义
您可以看到主跃点和备份下一跃点的权重0x10x4000。
对 BGP、L2VPN 和 VPLS 的 FAT 伪线支持概述
伪线是一种第 2 层电路或服务,可通过 MPLS 分组交换网络 (PSN) 模拟电信服务的基本属性,例如 T1 线路。伪线旨在仅提供最低限度的必要功能来模拟具有给定服务定义所需的弹性要求的线路。
在 MPLS 网络中,伪线流标签的流感知传输 (FAT)(如 draft-keyupdate-l2vpn-fat-pw-bgp 中所述)用于通过第 2 层虚拟专用网络 (L2VPN) 和虚拟专用 LAN 服务 (VPLS) 的 BGP 信号伪线对流量进行负载均衡。
FAT 流标签仅在标签边缘路由器 (LER) 上配置。这会导致中转路由器或标签交换路由器 (LSR) 跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 执行 MPLS 数据包的负载平衡,而无需对有效负载进行深度包检测。
FAT 流标签可用于 VPWS 和 VPLS 伪线的 LDP 信号转发等效类(FEC 128 和 FEC 129)伪线。接口参数 (Sub-TLV) 用于 FEC 128 和 FEC 129 伪线。为LDP定义的子TLV包含发送(T)和接收(R)位。T 位通告能够推送流标签。R 位通告能够弹出流标签。默认情况下,对于任何这些伪线,提供商边缘 (PE) 路由器的信令行为是播发设置为 0 的标签中的 T 位和 R 位。
flow-label-transmit和flow-label-receive配置语句提供了在子 TLV 字段中将 T 位和 R 位播发设置为 1 的功能,该字段是 LDP 标签映射消息的 FEC 接口参数的一部分。您可以使用这些语句来控制负载均衡标签的推送,以及将标签播发到控制平面中的 BGP 信号伪线(如 L2VPN 和 VPLS)的路由对等方。
也可以看看
配置 BGP L2VPN 的 FAT 伪线支持,以均衡 MPLS 流量负载
仅在标签边缘路由器 (LER) 上配置的 L2VPN 等 BGP 信号伪线支持流感知传输 (FAT) 或流标签。这使得中转路由器或标签交换路由器 (LSR) 能够跨等价多路径路径 (ECMP) 或链路聚合组 (LAG) 执行 MPLS 数据包的负载平衡,而无需对有效负载进行深度包检测。FAT 伪线或流标签可与具有转发等效类(FEC128 和 FEC129)的 LDP 信号 L2VPN 一起使用,并且对流标签的支持已扩展为用于点对点或点对多点第 2 层服务的 BGP 信号伪线。
在为 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 允许仅在标签边缘路由器 (LER) 上配置 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
-
为更新中的 NLRI 配置协议家族的属性。
[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 的接口。
[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 interfaces、 show protocols、 show routing-instancesshow policy-options和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
-
在更新中为 NLRI 配置协议家族的属性。
[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 的接口。
[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,并为传输方向上的推送流标签提供播发功能。
[edit routing-instances vpl1 protocols vpls] user@PE2# set flow-label-transmit user@PE2# set flow-label-receive
结果
在配置模式下,输入 show interfaces、 show protocols、 show routing-instancesshow policy-options和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 流量负载
VPLS 等 BGP 信号伪线支持流感知传输 (FAT) 或流标签,并且仅在标签边缘路由器 (LER) 上配置。这使得过渡路由器或标签交换路由器 (LSR) 能够跨等价多路径 (ECMP) 或链路聚合组 (LAG) 执行 MPLS 数据包的负载平衡,而无需对有效负载进行深度包检测。FAT 伪线或流标签可与具有转发等效等级(FEC128 和 FEC129)的 LDP 信号 VPLS 一起使用,并且对流标签的支持扩展为用于点对点或点对多点第 2 层服务的 BGP 信号伪线。
在为 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 允许仅在标签边缘路由器 (LER) 上配置 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
-
为更新中的 NLRI 配置协议家族的属性。
[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 的接口。
[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 interfaces、 show protocols、 show routing-instancesshow policy-options和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
-
为更新中的 NLRI 配置协议家族的属性。
[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 的接口。
[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 interfaces、 show protocols、 show routing-instancesshow policy-options和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 多路径。您可以选择性地禁用某些 BGP 组和邻接方上的多路径。
disable 在层次结构级别包括
[edit protocols bgp group group-name multipath] 以禁用组或特定 BGP 邻接方的多路径选项。
[edit protocols bgp]配置
defer-initial-multipath-build。或者,您可以在层次结构级别使用
[edit protocols bgp]配置语句降低
multipath-build-priority BGP 多路径构建作业优先级,以加快 RIB 学习。



