在本页
BGP 会话的负载平衡
了解 BGP 多路径
BGP 多路径允许您将多个内部 BGP 路径和多个外部 BGP 路径安装到转发表。选择多个路径使 BGP 能够跨多个链路对流量进行负载均衡。
如果 BGP 路径选择过程在将 IGP 成本与下一跃点进行比较后执行平局中断,则路径被视为 BGP 等价路径(用于转发)。默认情况下,多路径选择过程中会考虑具有同一相邻 AS、由支持多路径的 BGP 邻接方获知的所有路径。
BGP 通常只为每个前缀选择一个最佳路径,并将该路由安装在转表中。启用 BGP 多路径后,设备选择多个等价 BGP 路径到达给定目标,所有这些路径都安装在转发表中。BGP 仅将活动路径播发至其邻居,除非正在使用添加路径。
Junos OS BGP 多路径功能支持以下应用程序:
跨属于不同自治系统 (AS) 的两台路由设备之间多个链路的负载平衡
将一个公共子网或多个子网的负载平衡到属于同一对等 AS 的不同路由设备
跨属于不同外部联合对等方的两个路由设备之间多个链路的负载平衡
将一个公共子网或多个子网的负载平衡到属于外部联合对等方的不同路由设备
在负载平衡的常见方案中,客户在接入点 (POP) 中多宿主到多个路由器或交换机。默认行为是仅通过一个可用链接发送所有流量。负载平衡会导致流量使用两个或多个链路。
BGP 多路径不适用于共享相同 MED-plus-IGP 成本但 IGP 成本不同的路径。多路径路径选择基于 IGP 成本指标,即使两条路径具有相同的 MED-plus-IGP 成本也是如此。
从 Junos OS 18.1R1 版开始,BGP 多路径在层次结构级别全局受支持 [edit protocols bgp]
。您可以有选择地在某些 BGP 组和邻居上禁用多路径。在[edit protocols bgp group group-name multipath]
层次结构级别包含disable
以禁用组或特定 BGP 邻接方的多路径选项。
从 Junos OS 18.1R1 版开始,您可以推迟多路径计算,直到收到所有 BGP 路由。启用多路径后,BGP 会在每次添加新路由或现有路由更改时将路由插入多路径队列。当通过 BGP 添加路径功能接收到多个路径时,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。
概述
以下步骤说明如何配置每个数据包的负载平衡:
通过在层次结构级别包含一个或多个
policy-statement
语句[edit policy-options]
来定义负载平衡路由策略,并定义以下load-balance per-packet
操作:policy-statement policy-name { from { match-conditions; route-filter destination-prefix match-type <actions>; prefix-list name; } then { load-balance per-packet; } }
将策略应用于从路由表导出到转发表的路由。为此,请包含
forwarding-table
和export
语句:forwarding-table { export policy-name; }
您无法将导出策略应用于 VRF 路由实例。
在分配与正在播发的路由对应的标签时,指定该路由的所有下一跃点(如果存在多个跃点)。
配置 MPLS 的转发选项哈希密钥以包含 IP 有效负载。
在某些平台上,您可以使用机箱 maxum-ecmp 语句增加负载平衡的路径数。
使用此语句,您可以将等价负载平衡路径的最大数量更改为 32、64、128、256 或 512(最大数量因平台而异 — 请参阅 最大 ecmp)。
支持 BGP 的所有平台都支持多路径功能。对 QFX 平台进行了一些增强:
-
- 从 Junos OS 19.1R1 版开始,您可以在 QFX10000 交换机上指定最多 128 条等价路径。
-
- 从 Junos OS 19.2R1 版开始,您可以在QFX10000交换机上指定最多 512 条等价路径 — 请参阅 了解配置多达 512 条具有可选一致负载平衡的等价路径。
在此示例中,设备 R1 位于 AS 64500 中,并连接到位于 AS 64501 中的设备 R2 和设备 R3。此示例显示了设备 R1 上的配置。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit]
中。
set protocols bgp group external type external set protocols bgp group external peer-as 64501 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.1 set protocols bgp group external neighbor 10.0.0.2 set policy-options policy-statement loadbal from route-filter 10.0.0.0/16 orlonger set policy-options policy-statement loadbal then load-balance per-packet set routing-options forwarding-table export loadbal set routing-options autonomous-system 64500
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话,请执行以下操作:
配置 BGP 组。
[edit protocols bgp group external] user@R1# set type external user@R1# set peer-as 64501 user@R1# set neighbor 10.0.1.1 user@R1# set neighbor 10.0.0.2
使 BGP 组能够使用多个路径。
注:要禁用要求 BGP 多路径接受的路径必须具有相同相邻自治系统 (AS) 的默认检查,请包含该
multiple-as
选项。[edit protocols bgp group external] user@R1# set multipath
配置负载均衡策略。
[edit policy-options policy-statement loadbal] user@R1# set from route-filter 10.0.0.0/16 orlonger user@R1# set then load-balance per-packet
应用负载平衡策略。
[edit routing-options] user@R1# set forwarding-table export loadbal
配置本地自治系统 (AS) 编号。
[edit routing-options] user@R1# set autonomous-system 64500
结果
在配置模式下,输入 show 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
操作)。在这种情况下,转发表中安装的下一跃点网关可能是命令中显示的 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。
该功能仅适用于单播流量。
流量分布可能不会在所有组成员之间均匀分布 — 这取决于流量模式和硬件中散列流集表的组织。在组中添加或删除成员时,一致的散列可 最大程度地减少 流到目标链接的重新映射。
如果使用 、
inet
inet6
或layer2
选项hash-mode
之一进行配置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 隧道;流浪汉流量;EVPN-VXLAN;和 MPLS TE,自动带宽。
有关配置最多 512 个 ECMP 下一跃点以及选择性地配置一致负载平衡的说明
当您准备好配置最多 512 个下一跃点时,请使用以下配置说明:
配置 ECMP 下一跃点的最大数量,例如,配置 512 个 ECMP 下一跃点:
[edit] user@host# set chassis maximum-ecmp 512
创建路由策略并启用每个数据包的负载平衡,从而在系统上全局启用 ECMP:
[edit] user@host# set routing-options forwarding-table export load-balancing-policy user@host# set policy-options policy-statement load-balancing-policy then load-balance per-packet
通过创建单独的路由策略将传入路由与一个或多个目标前缀匹配,在所选前缀上启用弹性,例如:
[edit] user@host# set policy-options policy-statement c-hash from route-filter 20.0.0.0/24 orlonger user@host# set policy-options policy-statement c-hash then load-balance consistent-hash
将 eBGP 导入策略(例如,“c 哈希”)应用于外部对等方的 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 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit]
中。
设备 R0
set interfaces fe-1/2/0 unit 0 family inet address 10.1.0.1/30 set interfaces fe-1/2/1 unit 0 family inet address 10.1.1.1/30 set interfaces lo0 unit 0 family inet address 10.255.14.179/32 set protocols bgp group ext type external set protocols bgp group ext export test_route set protocols bgp group ext export agg_route set protocols bgp group ext peer-as 65000 set protocols bgp group ext multipath set protocols bgp group ext neighbor 10.1.0.2 set protocols bgp group ext neighbor 10.1.1.2 set policy-options policy-statement agg_route term 1 from protocol static set policy-options policy-statement agg_route term 1 from route-filter 10.1.230.0/23 exact set policy-options policy-statement agg_route term 1 then accept set policy-options policy-statement test_route term 1 from protocol static set policy-options policy-statement test_route term 1 from route-filter 10.1.10.10/32 exact set policy-options policy-statement test_route term 1 then accept set routing-options static route 10.1.10.10/32 reject set routing-options static route 10.1.230.0/23 reject set routing-options autonomous-system 65500
设备 R1
set interfaces fe-1/2/0 unit 0 family inet address 10.1.0.2/30 set interfaces fe-1/2/1 unit 0 family inet address 10.1.1.2/30 set interfaces fe-1/2/2 unit 0 family inet address 10.12.0.1/30 set interfaces lo0 unit 2 family inet address 10.255.71.24/32 set protocols bgp accept-remote-nexthop set protocols bgp group ext type external set protocols bgp group ext import agg_route set protocols bgp group ext peer-as 65500 set protocols bgp group ext multipath set protocols bgp group ext neighbor 10.1.0.1 set protocols bgp group ext neighbor 10.1.1.1 set protocols bgp group int type internal set protocols bgp group int local-address 10.255.71.24 set protocols bgp group int neighbor 10.255.14.177 set protocols ospf area 0.0.0.0 interface fe-1/2/1.4 set protocols ospf area 0.0.0.0 interface 10.255.71.24 set policy-options policy-statement agg_route term 1 from protocol bgp set policy-options policy-statement agg_route term 1 from route-filter 10.1.230.0/23 exact set policy-options policy-statement agg_route term 1 then next-hop 10.1.10.10 set policy-options policy-statement agg_route term 1 then accept set routing-options autonomous-system 65000
设备 R2
set interfaces fe-1/2/0 unit 0 family inet address 10.12.0.2/30 set interfaces lo0 unit 0 family inet address 10.255.14.177/32 set protocols bgp group int type internal set protocols bgp group int local-address 10.255.14.177 set protocols bgp group int neighbor 10.255.71.24 set protocols ospf area 0.0.0.0 interface fe-1/2/0.6 set protocols ospf area 0.0.0.0 interface 10.255.14.177 set routing-options autonomous-system 65000
设备 R0
分步过程
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 R0:
-
配置接口。
[edit interfaces fe-1/2/0 unit 0] user@R0# set family inet address 10.1.0.1/30 [edit interfaces fe-1/2/1 unit 0] user@R0# set family inet address 10.1.1.1/30 [edit interfaces lo0 unit 0] user@R0# set family inet address 10.255.14.179/32
-
配置 EBGP。
[edit protocols bgp group ext] user@R0# set type external user@R0# set peer-as 65000 user@R0# set neighbor 10.1.0.2 user@R0# set neighbor 10.1.1.2
-
在设备 R0 和设备 R1 之间启用多路径 BGP。
[edit protocols bgp group ext] user@R0# set multipath
-
配置到远程网络的静态路由。 这些路由不是拓扑的一部分。这些路由的目的是演示此示例中的功能。
[edit routing-options] user@R0# set static route 10.1.10.10/32 reject user@R0# set static route 10.1.230.0/23 reject
-
配置接受静态路由的路由策略。
[edit policy-options policy-statement agg_route term 1] user@R0# set from protocol static user@R0# set from route-filter 10.1.230.0/23 exact user@R0# set then accept [edit policy-options policy-statement test_route term 1] user@R0# set from protocol static user@R0# set from route-filter 10.1.10.10/32 exact user@R0# set then accept
-
将
agg_route
路由表中的和test_route
策略导出到 BGP 中。[edit protocols bgp group ext] user@R0# set export test_route user@R0# set export agg_route
-
配置自治系统 (AS) 编号。
[edit routing-options] user@R0# set autonomous-system 65500
结果
在配置模式下,输入 show interfaces
、show policy-options
、show protocols
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
user@R0# show interfaces fe-1/2/0 { unit 0 { family inet { address 10.1.0.1/30; } } } fe-1/2/1 { unit 0 { family inet { address 10.1.1.1/30; } } } lo0 { unit 0 { family inet { address 10.255.14.179/32; } } }
user@R0# show policy-options policy-statement agg_route { term 0 { from { protocol static; route-filter 10.1.230.0/23 exact; } then accept; } } policy-statement test_route { term 1 { from { protocol static; route-filter 10.1.10.10/32 exact; } then accept; } }
user@R0# show protocols bgp { group ext { type external; export [ test_route agg_route ]; peer-as 65000; multipath; neighbor 10.1.0.2; neighbor 10.1.1.2; } }
user@R0# show routing-options static { route 10.1.10.10/32 reject; route 10.1.230.0/23 reject; } autonomous-system 65500;
如果完成设备配置,请从配置模式输入 commit
。
配置设备 R1
分步过程
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置设备 R1:
-
配置接口。
[edit interfaces fe-1/2/0 unit 0] user@R1# set family inet address 10.1.0.2/30 [edit interfaces fe-1/2/1 unit 0] user@R1# set family inet address 10.1.1.2/30 [edit interfaces fe-1/2/2 unit 0] user@R1# set family inet address 10.12.0.1/30 [edit interfaces lo0 unit 0] user@R1# set family inet address 10.255.71.24/32
-
配置 OSPF。
[edit protocols ospf area 0.0.0.0] user@R1# set interface fe-1/2/1.0 user@R1# set interface 10.255.71.24
-
启用设备 R1 以接受远程下一跃点。
[edit protocols bgp] user@R1# set accept-remote-nexthop
-
配置 IBGP。
[edit protocols bgp group int] user@R1# set type internal user@R1# set local-address 10.255.71.24 user@R1# set neighbor 10.255.14.177
-
配置 EBGP。
[edit protocols bgp group ext] user@R1# set type external user@R1# set peer-as 65500 user@R1# set neighbor 10.1.0.1 user@R1# set neighbor 10.1.1.1
-
在设备 R0 和设备 R1 之间启用多路径 BGP。
[edit protocols bgp group ext] user@R1# set multipath
-
配置路由策略,使单跳外部 BGP 对等方(设备 R1)能够接受远程下一跃点 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 具有到 10.1.230.0 网络的路由,并启用了多路径功能 (Accepted Multipath
)。输出还显示路由的间接下一跃点为 10.1.10.10。
停用和重新激活接受-远程-下一跃点语句
目的
停用语句时, 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 按前缀负载平衡算法选择特定的转发下一跃点。此过程根据数据包的源地址和目标地址进行哈希处理,以明确地将前缀对映射到可用的下一跃点之一。当哈希函数具有大量前缀时(例如可能发生在 Internet 对等交换上),并且用于防止通信节点对之间的数据包重新排序,因此按前缀映射效果最佳。
企业网络通常希望更改默认行为以唤起 按数据包负载 均衡算法。这里强调按数据包,因为它的使用用词不当,源于原始互联网处理器 ASIC 的历史行为。实际上,当前的瞻博网络路由器支持按前缀(默认)和按流负载均衡。后者涉及针对各种第 3 层和第 4 层标头进行哈希处理,包括源地址、目标地址、传输协议、传入接口和应用程序端口的部分内容。其效果是,现在各个流被哈希到特定的下一跃点,从而在可用的下一跃点之间更均匀地分布,尤其是在源和目标对之间进行路由时。
使用按数据包负载均衡时,包含两个端点之间的通信流的数据包可能会重新排序,但各个流中的数据包会保持正确的顺序。无论您选择按前缀还是按数据包负载平衡,接入链路的不对称都会带来技术挑战。无论采用哪种方式,与映射到快速以太网接入链路等的流相比,映射到 T1 链路等的前缀或流的性能都会下降。更糟糕的是,对于繁重的流量负载,任何同等负载均衡的尝试都可能导致 T1 链路完全饱和,以及数据包丢失导致的会话中断。
幸运的是,瞻博网络 BGP 实施支持带宽社区的概念。此扩展社区对给定下一跃点的带宽进行编码,当与多路径结合使用时,负载平衡算法会在与流量相对带宽成比例的下一跃点集之间分配流量。换句话说,如果您有 10 Mbps 和 1 Mbps 的下一跃点,则对于每个使用低速的流量,平均有 9 个流将映射到高速下一跃点。
只有按数据包的负载均衡才支持 BGP 带宽社区的使用。
配置任务包含两部分:
配置外部 BGP (EBGP) 对等会话,启用多路径,并定义导入策略,以使用反映链路速度的带宽社区标记路由。
启用按数据包(实际上是按流)负载平衡,以实现最佳流量分配。
另请参阅
示例:在分配给路径的带宽不相等的情况下,平衡 BGP 流量的负载
此示例说明如何将 BGP 配置为选择多个不等价路径作为活动路径。
BGP 社区可以帮助您控制路由策略。BGP 社区良好用法的一个示例是不等负载均衡。当自治系统边界路由器 (ASBR) 接收来自直接连接的外部 BGP (EBGP) 邻接方的路由时,ASBR 会使用 IBGP 通告将这些路由通告给内部邻接方。在 IBGP 广告中,您可以附加链路带宽社区来传达播发的外部链路的带宽。当有多个外部链接可用,并且您希望对这些链接执行不相等的负载平衡时,这很有用。您可以在 AS 的所有入口链路上配置链路带宽扩展社区。链路带宽扩展社区中的带宽信息基于 EBGP 链路的配置带宽。它不基于链路上的流量。Junos OS 支持 BGP 链路带宽和多路径负载平衡,如互联网草案 draft-ietf-idr-link-bandwidth-06,BGP 链路带宽扩展社区中所述。请注意,即使 draft-ietf-idr-link-bandwidth-06 指定了非传递社区,Junos OS 实施也仅限于传递社区。
要求
准备工作:
配置设备接口。
配置内部网关协议 (IGP)。
配置 BGP。
配置路由策略,将路由(例如直接路由或 IGP 路由)从路由表导出到 BGP。
概述
在此示例中,设备 R1 位于 AS 64500 中,并连接到位于 AS 64501 中的设备 R2 和设备 R3。
此示例使用带宽扩展社区。
默认情况下,使用 BGP 多路径时,流量在计算的多个路径之间平均分配。带宽扩展社区允许向 BGP 路径添加附加属性,从而允许流量分布不均。主要应用是具有非对称带宽功能的给定网络存在多个外部路径的方案。在这种情况下,您可以标记使用带宽扩展社区接收的路由。当 BGP 多路径(内部或外部)在包含带宽属性的路由之间运行时,转发引擎可能会根据每个路径对应的带宽不均地分配流量。
当 BGP 有多个候选路径可用于多路径时,BGP 不会根据带宽社区执行不等价负载平衡,除非所有候选路径都具有此属性。
带宽扩展社区的适用性受到 BGP 多路径接受多个路径以供考虑的限制。明确而言,就 BGP 而言,执行负载平衡的路由器与多个出口点之间的 IGP 距离需要相同。这可以通过使用不跟踪相应 IGP 指标的标签交换路径 (LSP) 的完整网格来实现。但是,在电路传播延迟很大的网络中(例如,如果存在长距离电路),考虑不同路径的延迟特性通常是有价值的。
按如下方式配置带宽社区:
[edit policy-options] user@host# set community members bandwidth:[1-65535]:[0-4294967295]
第一个 16 位数字表示本地自治系统。第二个 32 位数字表示链路带宽(以字节/秒为单位)。
例如:
[edit policy-options] user@host# show community bw-t1 members bandwidth:10458:193000; community bw-t3 members bandwidth:10458:5592000; community bw-oc3 members bandwidth:10458:19440000;
其中 10458 是本地 AS 编号。这些值对应于 T1、T3 和 OC-3 路径的带宽(以字节/秒为单位)。指定为带宽值的值不需要与特定接口的实际带宽相对应。使用的平衡因子计算为指定总带宽的函数。要使用此扩展社区标记路由,请定义策略语句,如下所示:
[edit policy-options] user@host# show policy-statement link-bw-t1 { then { community set bw-t1; } accept; }
将此作为导入策略应用于面向非对称带宽链路的 BGP 对等会话。尽管理论上可以在网络中的任何点添加或删除社区属性,但在上述场景中,在面向外部链接的 EBGP 对等会话中将社区作为导入策略应用允许该属性影响本地多路径决策,并且可能更易于管理。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit]
中。
设备 R1
set interfaces ge-1/2/0 unit 0 description R1->R3 set interfaces ge-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces ge-1/2/1 unit 0 description R1->R2 set interfaces ge-1/2/1 unit 0 family inet address 10.0.1.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set protocols bgp group external type external set protocols bgp group external import bw-dis set protocols bgp group external peer-as 64501 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.1 set protocols bgp group external neighbor 10.0.0.2 set policy-options policy-statement bw-dis term a from protocol bgp set policy-options policy-statement bw-dis term a from neighbor 10.0.1.1 set policy-options policy-statement bw-dis term a then community add bw-high set policy-options policy-statement bw-dis term a then accept set policy-options policy-statement bw-dis term b from protocol bgp set policy-options policy-statement bw-dis term b from neighbor 10.0.0.2 set policy-options policy-statement bw-dis term b then community add bw-low set policy-options policy-statement bw-dis term b then accept set policy-options policy-statement loadbal from route-filter 10.0.0.0/16 orlonger set policy-options policy-statement loadbal then load-balance per-packet set policy-options community bw-high members bandwidth:65000:60000000 set policy-options community bw-low members bandwidth:65000:40000000 set routing-options autonomous-system 64500 set routing-options forwarding-table export loadbal
设备 R2
set interfaces ge-1/2/0 unit 0 description R2->R1 set interfaces ge-1/2/0 unit 0 family inet address 10.0.1.1/30 set interfaces ge-1/2/1 unit 0 description R2->R3 set interfaces ge-1/2/1 unit 0 family inet address 10.0.2.2/30 set interfaces ge-1/2/1 unit 0 family iso set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set interfaces lo0 unit 0 family iso address 49.0001.1921.6800.0002.00 set protocols bgp group external type external set protocols bgp group external export bgp-default set protocols bgp group external export send-direct set protocols bgp group external peer-as 64500 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.1.2 set protocols isis interface ge-1/2/1.0 set protocols isis interface lo0.0 set policy-options policy-statement bgp-default from protocol static set policy-options policy-statement bgp-default from route-filter 172.16.0.0/16 exact set policy-options policy-statement bgp-default then accept set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set routing-options static route 172.16.0.0/16 discard set routing-options static route 172.16.0.0/16 no-install set routing-options autonomous-system 64501
设备 R3
set interfaces ge-1/2/0 unit 0 description R3->R2 set interfaces ge-1/2/0 unit 0 family inet address 10.0.2.1/30 set interfaces ge-1/2/0 unit 0 family iso set interfaces ge-1/2/1 unit 0 description R3->R1 set interfaces ge-1/2/1 unit 0 family inet address 10.0.0.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set interfaces lo0 unit 0 family iso address 49.0001.1921.6800.0003.00 set protocols bgp group external type external set protocols bgp group external export send-direct set protocols bgp group external export bgp-default set protocols bgp group external peer-as 64500 set protocols bgp group external multipath set protocols bgp group external neighbor 10.0.0.1 set protocols isis interface ge-1/2/0.0 set protocols isis interface lo0.0 set policy-options policy-statement bgp-default from protocol static set policy-options policy-statement bgp-default from route-filter 172.16.0.0/16 exact set policy-options policy-statement bgp-default then accept set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set routing-options static route 172.16.0.0/16 discard set routing-options static route 172.16.0.0/16 no-install set routing-options autonomous-system 64501
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置 BGP 对等会话,请执行以下操作:
配置接口。
user@R1# set ge-1/2/0 unit 0 description R1->R3 user@R1# set ge-1/2/0 unit 0 family inet address 10.0.0.1/30 user@R1# set ge-1/2/1 unit 0 description R1->R2 user@R1# set ge-1/2/1 unit 0 family inet address 10.0.1.2/30 user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
配置 BGP 组。
[edit protocols bgp group external] user@R1# set type external user@R1# set import bw-dis user@R1# set peer-as 64501 user@R1# set neighbor 10.0.1.1 user@R1# set neighbor 10.0.0.2
使 BGP 组能够使用多个路径。
注:要禁用要求 BGP 多路径接受的路径必须具有相同相邻自治系统 (AS) 的默认检查,请包含该
multiple-as
选项。如果邻接方位于不同的 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% 分配给 bw 高,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 下一跃点都会从非活动路径复制到活动路径。
输出中显示了 show route
40% 和 60% 的余额。这表明流量在两个下一跃点之间分配,60% 的流量遵循第一个路径,而 40% 的流量遵循第二个路径。
跨外部 BGP 链路播发聚合带宽以实现负载平衡概述
从其内部对等方接收多条路径的 BGP 对等方会在这些路径之间对流量进行负载平衡。在早期的 Junos OS 版本中,从内部对等方接收多条路径的 BGP 发送方仅播发与活动路由关联的链路带宽。BGP 使用链路带宽扩展社区,跨外部链路通告多个路由的聚合带宽。BGP 计算具有不相等带宽分配的多路径的总带宽,并将聚合带宽播发至外部 BGP 对等方。可以配置聚合带宽的阈值来限制 BGP 组的带宽使用。IPv4 和 IPv6 路由(包括任播地址)都支持聚合带宽。
要通告多路径路由的聚合带宽并设置最大阈值,请在 [然后编辑策略选项策略语句name] 层次结构级别配置策略aggregate-bandwidth
limit-bandwidth
和操作。
在 中 图 4,自治系统 1 (AS1) 将其 3 条多路径路由的带宽聚合到远程前缀,并使用链路带宽扩展社区将其通告给带宽为 30 的自治系统 4 (AS4)。如果 AS3 和 AS4 之间出现链路故障,AS4 会从其播发至 AS6 的带宽中减去 60,并将播发的带宽从 130 修改为 70。
当 BGP 对等方传播配置了聚合带宽社区的多路径路由时,将添加一个新的链路带宽社区,其中包含来自传入带宽社区或该前缀的带宽总和。可用链路带宽动态派生自接口速度。链路带宽作为可传递扩展社区发送。但是,如果设备以非可传递链路带宽扩展社区的形式接收链路带宽,Junos OS 将忽略此社区,而是将其与可传递链路带宽扩展社区一起传播。如果未收到每个传入多路径路由的链路带宽社区,则不会向其外部对等方通告链路带宽社区。
当其中一个多路径链路发生故障时,BGP 会重新播发路由,并从传出链路带宽社区中减去故障链路的带宽。如果发现聚合链路带宽超过配置的限制,则播发的聚合带宽将被截断为两个对等方之间配置的链路带宽限制。
另请参阅
示例:配置策略以跨外部 BGP 链路通告聚合带宽以实现负载平衡
此示例说明如何配置策略以跨外部 BGP 链路通告聚合带宽以实现负载平衡,以及如何为配置的聚合带宽指定阈值。BGP 将多路径的可用链路带宽相加并计算聚合带宽。如果发生链路故障,将调整聚合带宽以反映可用带宽的当前状态。
要求
此示例使用以下硬件和软件组件:
四个具有负载平衡功能的路由器
在所有设备上运行的 Junos OS 17.4 或更高版本
概述
从 Junos OS 17.4R1 版开始,从内部对等方接收多条路径的 BGP 发送方会在这些路径之间实现流量负载均衡。在早期的 Junos OS 版本中,从内部对等方接收多条路径的 BGP 发送方仅播发与活动路由关联的链路带宽。BGP 使用具有聚合带宽的新链路带宽扩展社区来标记多路径,并在其 DMZ 链路上通告这些多路由的聚合带宽。要通告聚合的多个路由,请在 [然后编辑策略选项策略语句name] 层次结构级别配置策略aggregate-bandwidth
和limit bandwidth
操作。
拓扑学
在 中 图 5,路由器 R1 通过路由器 R2 中的下一跃点 10.0.1.1 以每秒 60,000,000 字节的速度负载均衡到远程目标的流量,并以每秒 40,000,000 字节的速度通过路由器 R3 中的 10.0.0.2 将流量负载均衡到远程目标。路由器 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 链路,配置另一个社区bw-low
,配置 40% 的 1-Gbps 链路。将 60% 的 1-Gbps 链路配置为高带宽社区,40% 配置为低带宽社区。
[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
) -
标记为单播 (
family inet labeled-unicast
) 的 IPv4 -
标记为单播 (
family inet6 labeled-unicast
) 的 IPv6 -
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 对等方提交添加路径 发送 的配置时,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]
。您不能同时启用两者multipath
path-selection-mode
。
另请参阅
示例:在 BGP 中通告多条路径
在此示例中,BGP 路由器配置为播发多个路径,而不是仅播发活动路径。RFC 7911, BGP 中的多路径播发中指定了 BGP 中的多条路径播发。
要求
此示例使用以下硬件和软件组件:
八个支持 BGP 的设备。
启用 BGP 的设备中有五台不一定需要是路由器。例如,它们可以是 EX 系列以太网交换机。
其中三个支持 BGP 的设备配置为发送多个路径或接收多个路径(或同时发送和接收多个路径)。这三台支持 BGP 的设备必须是 M 系列多服务边缘路由器、MX 系列 5G 通用路由平台或 T 系列核心路由器。
这三台路由器必须运行 Junos OS 11.4 或更高版本。
概述
以下语句用于配置到目标的多个路径:
[edit protocols bgp group group-name family family] add-path { receive; send { include-backup-path include-backup-path; multipath; path-count path-count; path-selection-mode { (all-paths | equal-cost-paths); } prefix-policy [ policy-names ... ]; } }
在此示例中,路由器 R5、路由器 R6 和路由器 R7 将静态路由重新分发到 BGP 中。路由器 R1 和路由器 R4 是路由反射器。路由器 R2 和路由器 R3 是路由反射器 R1 的客户端。路由器 R8 是路由反射器 R4 的客户端。
在 BGP 中启用多路径通告时,路由反射是可选的。
通过此 add-path send path-count 6
配置,路由器 R1 配置为向路由器 R4 发送最多 6 条路径(每个目标)。
通过此 add-path receive
配置,路由器 R4 配置为从路由器 R1 接收多条路径。
通过此 add-path send path-count 6
配置,路由器 R4 配置为向路由器 R8 发送最多 6 条路径。
通过此 add-path receive
配置,路由器 R8 配置为从路由器 R4 接收多条路径。
策略配置(以及相应的路由过滤器)将 add-path send prefix-policy allow_199
路由器 R4 限制为仅发送 172.16.199.1/32 路由的多个路径。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit]
中。
路由器 R1
set interfaces fe-0/0/0 unit 12 family inet address 10.0.12.1/24 set interfaces fe-0/0/1 unit 13 family inet address 10.0.13.1/24 set interfaces fe-1/0/0 unit 14 family inet address 10.0.14.1/24 set interfaces fe-1/2/0 unit 15 family inet address 10.0.15.1/24 set interfaces lo0 unit 10 family inet address 10.0.0.10/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.10 set protocols bgp group rr cluster 10.0.0.10 set protocols bgp group rr neighbor 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.30 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.2 local-address 10.0.15.1 set protocols bgp group e1 neighbor 10.0.15.2 peer-as 2 set protocols bgp group rr_rr type internal set protocols bgp group rr_rr local-address 10.0.0.10 set protocols bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6 set protocols ospf area 0.0.0.0 interface lo0.10 passive set protocols ospf area 0.0.0.0 interface fe-0/0/0.12 set protocols ospf area 0.0.0.0 interface fe-0/0/1.13 set protocols ospf area 0.0.0.0 interface fe-1/0/0.14 set protocols ospf area 0.0.0.0 interface fe-1/2/0.15 set routing-options router-id 10.0.0.10 set routing-options autonomous-system 1
路由器 R2
set interfaces fe-1/2/0 unit 21 family inet address 10.0.12.2/24 set interfaces fe-1/2/1 unit 26 family inet address 10.0.26.1/24 set interfaces lo0 unit 20 family inet address 10.0.0.20/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.2 peer-as 2 set protocols ospf area 0.0.0.0 interface lo0.20 passive set protocols ospf area 0.0.0.0 interface fe-1/2/0.21 set protocols ospf area 0.0.0.0 interface fe-1/2/1.28 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 1
路由器 R3
set interfaces fe-1/0/1 unit 31 family inet address 10.0.13.2/24 set interfaces fe-1/0/2 unit 37 family inet address 10.0.37.1/24 set interfaces lo0 unit 30 family inet address 10.0.0.30/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.30 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.2 peer-as 2 set protocols ospf area 0.0.0.0 interface lo0.30 passive set protocols ospf area 0.0.0.0 interface fe-1/0/1.31 set protocols ospf area 0.0.0.0 interface fe-1/0/2.37 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 1
路由器 R4
set interfaces fe-1/2/0 unit 41 family inet address 10.0.14.2/24 set interfaces fe-1/2/1 unit 48 family inet address 10.0.48.1/24 set interfaces lo0 unit 40 family inet address 10.0.0.40/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.40 set protocols bgp group rr family inet unicast add-path receive set protocols bgp group rr neighbor 10.0.0.10 set protocols bgp group rr_client type internal set protocols bgp group rr_client local-address 10.0.0.40 set protocols bgp group rr_client cluster 10.0.0.40 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy allow_199 set protocols ospf area 0.0.0.0 interface fe-1/2/0.41 set protocols ospf area 0.0.0.0 interface lo0.40 passive set protocols ospf area 0.0.0.0 interface fe-1/2/1.48 set policy-options policy-statement allow_199 from route-filter 172.16.199.1/32 exact set policy-options policy-statement allow_199 term match_199 from prefix-list match_199 set policy-options policy-statement allow_199 then add-path send-count 20 set policy-options policy-statement allow_199 then accept set routing-options autonomous-system 1
路由器 R5
set interfaces fe-1/2/0 unit 51 family inet address 10.0.15.2/24 set interfaces lo0 unit 50 family inet address 10.0.0.50/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.1 export s2b set protocols bgp group e1 neighbor 10.0.15.1 peer-as 1 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then as-path-expand 2 set policy-options policy-statement s2b then accept set routing-options autonomous-system 2 set routing-options static route 172.16.199.1/32 reject set routing-options static route 172.16.198.1/32 reject
路由器 R6
set interfaces fe-1/2/0 unit 62 family inet address 10.0.26.2/24 set interfaces lo0 unit 60 family inet address 10.0.0.60/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.1 export s2b set protocols bgp group e1 neighbor 10.0.26.1 peer-as 1 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then accept set routing-options autonomous-system 2 set routing-options static route 172.16.199.1/32 reject set routing-options static route 172.16.198.1/32 reject
路由器 R7
set interfaces fe-1/2/0 unit 73 family inet address 10.0.37.2/24 set interfaces lo0 unit 70 family inet address 10.0.0.70/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.1 export s2b set protocols bgp group e1 neighbor 10.0.37.1 peer-as 1 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then accept set routing-options autonomous-system 2 set routing-options static route 172.16.199.1/32 reject
路由器 R8
set interfaces fe-1/2/0 unit 84 family inet address 10.0.48.2/24 set interfaces lo0 unit 80 family inet address 10.0.0.80/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.80 set protocols bgp group rr neighbor 10.0.0.40 family inet unicast add-path receive set protocols ospf area 0.0.0.0 interface lo0.80 passive set protocols ospf area 0.0.0.0 interface fe-1/2/0.84 set routing-options autonomous-system 1
配置路由器 R1
分步过程
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅《Junos OS CLI 用户指南》中的在配置模式下使用 CLI 编辑器。
要配置路由器 R1:
配置路由器 R2、路由器 R3、路由器 R4 和路由器 R5 的接口,并配置环路 (lo0) 接口。
[edit interfaces] user@R1# set fe-0/0/0 unit 12 family inet address 10.0.12.1/24 user@R1# set fe-0/0/1 unit 13 family inet address 10.0.13.1/24 user@R1# set fe-1/0/0 unit 14 family inet address 10.0.14.1/24 user@R1# set fe-1/2/0 unit 15 family inet address 10.0.15.1/24 user@R1#set lo0 unit 10 family inet address 10.0.0.10/32
在接口上配置 BGP,并配置 IBGP 路由反射。
[edit protocols bgp] user@R1# set group rr type internal user@R1# set group rr local-address 10.0.0.10 user@R1# set group rr cluster 10.0.0.10 user@R1# set group rr neighbor 10.0.0.20 user@R1# set group rr neighbor 10.0.0.30 user@R1# set group rr_rr type internal user@R1# set group rr_rr local-address 10.0.0.10 user@R1# set group e1 type external user@R1# set group e1 neighbor 10.0.15.2 local-address 10.0.15.1 user@R1# set group e1 neighbor 10.0.15.2 peer-as 2
将路由器 R1 配置为向其邻居路由器 R4 发送最多六条路径。
路径的目标可以是路由器 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-unicast
NLRI's for which peer can send multiple paths: inet-unicast
操作
user@R1> show bgp neighbor 10.0.0.40 Peer: 10.0.0.40+179 AS 1 Local: 10.0.0.10+64227 AS 1 Type: Internal State: Established Flags: <Sync> ... NLRI's for which peer can receive multiple paths: inet-unicast ...
user@R4> show bgp neighbor 10.0.0.10 Peer: 10.0.0.10+64227 AS 1 Local: 10.0.0.40+179 AS 1 Type: Internal State: Established Flags: <Sync> ... NLRI's for which peer can send multiple paths: inet-unicast ...
user@R4> show bgp neighbor 10.0.0.80 Peer: 10.0.0.80+55416 AS 1 Local: 10.0.0.40+179 AS 1 Type: Internal State: Established (route reflector client)Flags: <Sync> ,,, NLRI's for which peer can receive multiple paths: inet-unicast ...
user@R8> show bgp neighbor 10.0.0.40 Peer: 10.0.0.40+179 AS 1 Local: 10.0.0.80+55416 AS 1 Type: Internal State: Established Flags: <Sync> ... NLRI's for which peer can send multiple paths: inet-unicast ...
验证路由器 R1 是否正在播发多条路径
目的
确保将到 172.16.198.1/32 目标的多条路径和到 172.16.199.1/32 目标的多条路径播发到路由器 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 系列、MX 系列或 T 系列路由器
设备上的 Junos OS 16.1R2 或更高版本
概述
从 Junos OS 16.1R2 版开始,您可以将 BGP 限制为 add-path
仅向参与者通告多个路径。您最多可以限制和配置 BGP multipath
算法选择的六个前缀。多路径的选择性广告有利于互联网服务提供商和数据中心使用路由反射器在 IBGP 中构建路径内多样性。您可以启用 BGP 路由反射器来通告作为负载均衡参与者路径的多路径。
拓扑学
在 中 图 7,RR1 和 RR4 是路由反射器。路由器 R2 和 R3 是路由反射器 RR1 的客户端。路由器 R8 是路由反射器 RR4 的客户端。具有邻居 R2 和 R3 的 RR1 组配置为多路径。路由器 R5、R6 和路由器 R7 将静态路由 199.1.1.1/32 和 198.1.1.1/32 重新分发到 BGP 中。
在路由器 RR1 上配置负载均衡策略,以便计算 199.1.1.1/32 路由的多路径。多路径功能在邻居 RR4 的添加路径下配置。但是,路由器 RR4 未配置负载平衡多路径。路由器 RR1 配置为向路由器 RR4 发送最多 6 个从多路径候选路由中选择的 199.1.1.1/32 添加路径路由。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到层次结构级别的 CLI [edit]
中,然后从配置模式进入提交。
路由器 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
将添加路径多路径功能配置为仅播发参与者多个路径,并将播发的多路径数限制为 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 是否仅向路由器 R8 播发 199.1.1.1/32 的一个路由。
操作
在操作模式下, show route advertising-protocol bgp 10.0.0.80 在路由器 RR4 上运行命令。
user@RR4> show route advertising-protocol bgp 10.0.0.80 detail inet.0: 20 destinations, 21 routes (20 active, 0 holddown, 0 hidden) * 10.0.0.50/32 (1 entry, 1 announced) BGP group rr_client type Internal Nexthop: 10.0.15.2 Localpref: 100 AS path: [1] 2 2 I Communities: 4713:100 Cluster ID: 10.0.0.40 Originator ID: 10.0.0.10 Addpath Path ID: 1 … * 198.1.1.1/32 (1 entry, 1 announced) BGP group rr_client type Internal Nexthop: 10.0.0.20 Localpref: 100 AS path: [1] 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.20 Communities: 4713:100 Cluster ID: 10.0.0.40 Addpath Path ID: 1 * 199.1.1.1/32 (2 entries, 1 announced) BGP group rr_client type Internal Nexthop: 10.0.0.20 Localpref: 100 AS path: [1] 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.20 Communities: 4713:100 Cluster ID: 10.0.0.40 Addpath Path ID: 1
意义
由于路由器 RR4 上未启用多路径,因此只有一个路径 10.0.0.20 播发至路由器 R8。
示例:配置路由策略以根据 BGP 社区值选择和通告多路径
播发所有可用的多个路径可能会导致设备内存上的大量处理开销。如果要在事先实际不知道前缀的情况下播发有限的前缀子集,则可以使用 BGP 公共组值来确定需要向 BGP 邻接方播发的前缀路由。此示例说明如何定义路由策略,以根据已知的 BGP 社区值过滤和播发多个路径。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
八款路由器,可组合使用 M 系列、MX 系列或 T 系列路由器
设备上的 Junos OS 16.1R2 或更高版本
概述
从 Junos OS 16.1R2 开始,您可以定义一个策略,以根据社区值识别符合条件的多路径前缀。除了指向给定目标的活动路径之外,BGP 还会通告这些带有社区标记的路由。如果路由的社区值与策略中定义的社区值不匹配,则 BGP 不会播发该路由。此功能允许 BGP 播发到给定目标的不超过 20 条路径。您可以限制和配置 BGP 为多个路径考虑的前缀数,而无需事先实际知道前缀。相反,已知的 BGP 社区值确定是否播发前缀。
拓扑学
在 中 图 8,RR1 和 RR4 是路由反射器。路由器 R2 和 R3 是路由反射器 RR1 的客户端。路由器 R8 是路由反射器 RR4 的客户端。路由器 R5、R6 和路由器 R7 将静态路由重新分发到 BGP 中。路由器 R5 通告静态路由 199.1.1.1/32 和 198.1.1.1/32,社区值为 4713:100。
路由器 RR1 配置为向路由器 RR4 发送最多 6 条路径(每个目标)。路由器 RR4 配置为向路由器 R8 发送最多 6 条路径。路由器 R8 配置为从路由器 RR4 接收多条路径。添加路径社区配置限制路由器 RR4 为仅包含 4713:100 社区值的路由发送多个路径。路由器 RR4 过滤并通告仅包含 4714:100 社区值的多路径。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到层次结构级别的 CLI [edit]
中,然后从配置模式进入提交。
路由器 RR1
set interfaces ge-1/0/10 unit 0 description RR1->R2 set interfaces ge-1/0/10 unit 0 family inet address 10.0.12.1/24 set interfaces ge-1/0/11 unit 0 description RR1->RR4 set interfaces ge-1/0/11 unit 0 family inet address 10.0.14.1/24 set interfaces ge-1/0/12 unit 0 description RR1->R5 set interfaces ge-1/0/12 unit 0 family inet address 10.0.15.1/24 set interfaces ge-1/0/13 unit 0 description RR1->R3 set interfaces ge-1/0/13 unit 0 family inet address 10.0.13.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.10/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.10 set protocols bgp group rr cluster 10.0.0.10 set protocols bgp group rr multipath set protocols bgp group rr neighbor 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.30 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.2 local-address 10.0.15.1 set protocols bgp group e1 neighbor 10.0.15.2 peer-as 64502 set protocols bgp group rr_rr type internal set protocols bgp group rr_rr local-address 10.0.0.10 set protocols bgp group rr_rr neighbor 10.0.0.40 family inet unicast add-path send path-count 6 set protocols ospf area 0.0.0.0 interface lo0.10 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/13 set protocols ospf area 0.0.0.0 interface ge-1/0/11 set protocols ospf area 0.0.0.0 interface ge-1/0/12 set routing-options router-id 10.0.0.10 set routing-options autonomous-system 64501
路由器 R2
set interfaces ge-1/0/10 unit 0 description R2->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.12.2/24 set interfaces ge-1/0/11 unit 0 description R2->R6 set interfaces ge-1/0/11 unit 0 family inet address 10.0.26.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.20/32 set protocols bgp group rr local-address 10.0.0.20 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.2 peer-as 64502 set protocols ospf area 0.0.0.0 interface lo0.20 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/11 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 64501
路由器 R3
set interfaces ge-1/0/10 unit 0 description R3->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.13.2/24 set interfaces ge-1/0/11 unit 0 description R3->R7 set interfaces ge-1/0/11 unit 0 family inet address 10.0.37.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.30/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.30 set protocols bgp group rr neighbor 10.0.0.10 export set_nh_self set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.2 peer-as 64502 set protocols ospf area 0.0.0.0 interface lo0.30 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface ge-1/0/13 set policy-options policy-statement set_nh_self then next-hop self set routing-options autonomous-system 64501
路由器 RR4
set interfaces ge-1/0/10 unit 0 description RR4->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.14.2/24 set interfaces ge-1/0/11 unit 0 description RR4->R8 set interfaces ge-1/0/11 unit 0 family inet address 10.0.48.1/24 set interfaces lo0 unit 0 family inet address 10.0.0.40/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.40 set protocols bgp group rr family inet unicast add-path receive set protocols bgp group rr neighbor 10.0.0.10 set protocols bgp group rr_client type internal set protocols bgp group rr_client local-address 10.0.0.40 set protocols bgp group rr_client cluster 10.0.0.40 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy addpath-communities-send-4713-100 set protocols bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6 set protocols ospf area 0.0.0.0 interface ge-1/0/10 set protocols ospf area 0.0.0.0 interface lo0.40 passive set protocols ospf area 0.0.0.0 interface ge-1/0/11 set policy-options community addpath-community-members 4713:100 set policy-options community addpath-communities-send-4713:100 set policy-options policy-statement addpath-communitiesunities-send-4713-100 term term1 from protocol bgp set policy-options policy-statement addpath-communities-send-4713-100 term term1 from community addpath-4713-100-community set policy-options policy-statement addpath-communitiesunities-send-4713-100 term term1 then add-path send-count 6 set policy-options policy-statement addpath-communities-send-4713-100 term term1 then add-path accept set routing-options autonomous-system 64501
路由器 R5
set interfaces ge-1/0/10 unit 0 description R5->RR1 set interfaces ge-1/0/10 unit 0 family inet address 10.0.15.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.50/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.15.1 export s2b set protocols bgp group e1 neighbor 10.0.15.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then as-path-expand 2 set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options static route 198.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R6
set interfaces ge-1/0/10 unit 0 description R6->R2 set interfaces ge-1/0/10 unit 0 family inet address 10.0.26.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.60/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.26.1 export s2b set protocols bgp group e1 neighbor 10.0.26.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options static route 198.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R7
set interfaces ge-1/0/10 unit 0 description R7->R3 set interfaces ge-1/0/10 unit 0 family inet address 10.0.37.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.70/32 set protocols bgp group e1 type external set protocols bgp group e1 neighbor 10.0.37.1 export s2b set protocols bgp group e1 neighbor 10.0.37.1 peer-as 64501 set policy-options policy-statement s2b from protocol static set policy-options policy-statement s2b from protocol direct set policy-options policy-statement s2b then community add addpath-community set policy-options policy-statement s2b then accept set policy-options community addpath-community members 4713:100 set routing-options static route 199.1.1.1/32 reject set routing-options autonomous-system 64502
路由器 R8
set interfaces ge-1/0/10 unit 0 description R8->RR4 set interfaces ge-1/0/10 unit 0 family inet address 10.0.48.2/24 set interfaces lo0 unit 0 family inet address 10.0.0.80/32 set protocols bgp group rr type internal set protocols bgp group rr local-address 10.0.0.80 set protocols bgp group rr neighbor 10.0.0.40 family inet unicast add-path receive set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-1/0/10.8 set routing-options autonomous-system 64501 set chassis fpc 1 pic 0 tunnel-services bandwidth 1g
配置路由器 RR4
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置路由器 RR4:
修改相应的接口名称、地址和其他参数后,对其他路由器重复此过程。
使用 IPv4 地址配置接口。
[edit interfaces] user@RR4# set ge-1/0/10 unit 0 description RR4->RR1 user@RR4# set ge-1/0/10 unit 0 family inet address 10.0.14.2/24 user@RR4# set ge-1/0/11 unit 0 description RR4->R8 user@RR4# set ge-1/0/11 unit 0 family inet address 10.0.48.1/24
配置环路地址。
[edit interfaces] user@RR4# set lo0 unit 0 family inet address 10.0.0.40/32
配置 OSPF 或任何其他内部网关协议 (IGP)。
[edit protocols] user@RR4# set ospf area 0.0.0.0 interface lo0.40 passive user@RR4# set ospf area 0.0.0.0 interface ge-1/0/10 user@RR4# set ospf area 0.0.0.0 interface ge-1/0/11
为路由反射器配置两个 IBGP 组 rr,为路由反射器的客户端配置两个 rr_client。
[edit protocols] user@RR4# set bgp group rr type internal user@RR4# set bgp group rr local-address 10.0.0.40 user@RR4# set bgp group rr family inet unicast add-path receive user@RR4# set bgp group rr neighbor 10.0.0.10 user@RR4# set bgp group rr_client type internal user@RR4# set bgp group rr_client local-address 10.0.0.40 user@RR4# set bgp group rr_client cluster 10.0.0.40
将该功能配置为发送仅包含 4713:100 社区值的多个路径,并将播发的多路径数限制为 6。
[edit protocols] user@RR4# set bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send prefix-policy addpath-communities-send-4713-100 user@RR4# set bgp group rr_client neighbor 10.0.0.80 family inet unicast add-path send path-count 6
定义一个策略
addpath-community-members 4713:100
来过滤具有社区值 4713:100 的前缀,并将设备限制为向路由器 R8 发送最多 16 条路径。此限制将覆盖之前在 BGP 组层次结构级别配置的添加路径发送路径计数 6。[edit policy-options] user@RR4# set community addpath-community-members 4713:100 user@RR4# set community addpath-communities-send-4713:100 user@RR4# set policy-statement addpath-communitiesunities-send-4713-100 term term1 from protocol bgp user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 from community addpath-4713-100-community user@RR4# set policy-statement addpath-communitiesunities-send-4713-100 term term1 then add-path send-count 16 user@RR4# set policy-statement addpath-communities-send-4713-100 term term1 then add-path accept
为 BGP 主机配置路由器 ID 和自治系统。
[edit routing-options] user@RR4# set router-id 10.0.0.40 user@RR4# set autonomous-system 64501
结果
在配置模式下,输入 show interfaces 、show protocols、show routing-options 和 show policy-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
[edit] user@RR4# show interfaces ge-1/0/10 { unit 0 { description RR4->RR1; family inet { address 10.0.14.2/24; } } } ge-1/0/11 { unit 0 { description RR4->R8; family inet { address 10.0.48.1/24; } } } lo0 { unit 0 { family inet { address 10.0.0.10/32; } } }
[edit] user@RR4# show protocols bgp { group rr { type internal; local-address 10.0.0.40; family inet { unicast { add-path { receive; } } } neighbor 10.0.0.10; } group rr_client { type internal; local-address 10.0.0.40; cluster 10.0.0.40; neighbor 10.0.0.80 { family inet { unicast { add-path { send { prefix-policy addpath-communities-send-4713-100; path-count 6; } } } } } } } ospf { area 0.0.0.0 { interface ge-1/0/10.0; interface lo0.40 { passive; } interface ge-1/0/11.0; } }
[edit] user@RR4# show policy-options policy-options { policy-statement addpath-communities-send-4713-100 { term term1 { from community addpath-4713-100-community; } } policy-statement addpath-communitiesunities-send-4713-100 { term term1 { from protocol bgp; then { add-path send-count 16; } } } }
[edit] user@RR4# show routing-options router-id 10.0.0.40; autonomous-system 64501;
如果完成设备配置,请提交配置。
user@RR4# commit
验证
确认配置工作正常。
- 验证多路径路由是否已从路由器 RR4 播发到路由器 R8
- 验证路由器 R8 是否接收路由器 RR4 通告的多路径路由
- 验证路由器 RR4 是否仅播发具有社区值 4713:100 的多路径路由到路由器 R8
验证多路径路由是否已从路由器 RR4 播发到路由器 R8
目的
验证路由器 RR4 是否可以向路由器 R8 发送多条路径。
操作
在操作模式下, show route advertising-protocol bgp neighbor-address 在路由器 RR4 上运行命令。
user@RR4> show route advertising-protocol bgp 10.0.0.80 inet.0: 20 destinations, 23 routes (20 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 198.1.1.1/32 10.0.0.20 100 2 I 10.0.15.2 100 2 2 I * 199.1.1.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I
意义
路由器 RR4 正在向路由器 R8 播发多个路径 10.0.0.20、10.0.0.30 和 10.0.15.2。
验证路由器 R8 是否接收路由器 RR4 通告的多路径路由
目的
验证路由器 R8 是否正在从路由器 RR4 接收多路径路由。
操作
在操作模式下, show route receive-protocol bgp neighbor-address 在路由器 R8 上运行命令。
user@R8> show route receive-protocol bgp 10.0.0.40 inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden) Prefix Nexthop MED Lclpref AS path * 10.0.0.50/32 10.0.15.2 100 2 2 I * 10.0.0.60/32 10.0.0.20 100 2 I * 10.0.0.70/32 10.0.0.30 100 2 I * 198.1.1.1/32 10.0.0.20 100 2 I 10.0.15.2 100 2 2 I * 199.1.1.1/32 10.0.0.20 100 2 I 10.0.0.30 100 2 I 10.0.15.2 100 2 2 I
意义
路由器 R8 正在从路由器 RR4 接收路由 199.1.1.1/32 的多个下一跃点 10.0.0.20、10.0.0.30 和 10.0.15.2。
验证路由器 RR4 是否仅播发具有社区值 4713:100 的多路径路由到路由器 R8
目的
路由器 RR4 必须仅向路由器 R8 播发社区值为 4713:100 的多路径路由。
操作
在操作模式下, show route 199.1.1.1/32 detail 在路由器 RR4 上运行命令。
user@RR4> show route 199.1.1.1/32 detail inet.0: 20 destinations, 23 routes (20 active, 0 holddown, 0 hidden) 199.1.1.1/32 (3 entries, 3 announced) *BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0ea90 Next-hop reference count: 6 Source: 10.0.0.10 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.14.1 via ge-1/0/10.4, selected Session Id: 0x0 Protocol next hop: 10.0.0.20 Indirect next hop: 0xc4091f0 1048581 INH Session ID: 0x0 State: <Active Int Ext> Local AS: 1 Peer AS: 1 Age: 4d 20:56:53 Metric2: 2 Validation State: unverified Task: BGP_1.10.0.0.10 Announcement bits (3): 2-KRT 3-BGP_RT_Background 4-Resolve tree 2 AS path: 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.20 Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 1 BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0eb50 Next-hop reference count: 3 Source: 10.0.0.10 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.14.1 via lt-1/0/10.4, selected Session Id: 0x0 Protocol next hop: 10.0.0.30 Indirect next hop: 0xc409300 1048582 INH Session ID: 0x0 State: <NotBest Int Ext> Inactive reason: Not Best in its group - Router ID Local AS: 1 Peer AS: 1 Age: 4d 20:56:53 Metric2: 2 Validation State: unverified Task: BGP_1.10.0.0.10 Announcement bits (1): 3-BGP_RT_Background AS path: 2 I (Originator) Cluster list: 10.0.0.10 Originator ID: 10.0.0.30 Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 2 BGP Preference: 170/-101 Next hop type: Indirect, Next hop index: 0 Address: 0xae0e9d0 Next-hop reference count: 4 Source: 10.0.0.10 Next hop type: Router, Next hop index: 1115 Next hop: 10.0.14.1 via lt-1/0/10.4, selected Session Id: 0x0 Protocol next hop: 10.0.15.2 Indirect next hop: 0xc4090e0 1048580 INH Session ID: 0x0 State: <Int Ext> Inactive reason: AS path Local AS: 1 Peer AS: 1 Age: 4d 20:56:53 Metric2: 2 Validation State: unverified Task: BGP_1.10.0.0.10 Announcement bits (1): 3-BGP_RT_Background AS path: 2 2 I Communities: 4713:100 Accepted Localpref: 100 Router ID: 10.0.0.10 Addpath Path ID: 3
意义
路由器 RR4 正在向路由器 R8 播发社区值为 4713:100 的三条路径。
通过 BGP 多路径配置递归解析
从 Junos OS 版本 17.3R1 开始,当具有单个协议下一跃点的 BGP 前缀通过具有多个解析路径的另一个 BGP 前缀解析 (unilist) 时,将选择所有路径进行协议下一跃点解析。在早期的 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) 下一跃点配置。s. 对于具有高流量的网络,这提供了更大的灵活性,可以在多达 128 个 LSP 上对流量进行负载均衡。
要配置 ECMP 下一跃点的最大限制,请在层次结构级别包含 maximum-ecmp next-hops
语句 [edit chassis]
:
[edit chassis] maximum-ecmp next-hops;
您可以使用此语句将最大 ECMP 下一跃点限制配置为 16、32、 64 或 128 。默认限制为 16.
MX 系列路由器带有一个或多个模块化端口集中器 (MPC) 卡并安装了 Junos OS 11.4 或更低版本,支持仅具有 16 个下一跃点的语句配置 maximum-ecmp
。不应为maximum-ecmp
语句配置 32 或 64 个下一跃点。提交具有 32 或 64 个下一跃点的配置时,将显示以下警告消息:
Error: Number of members in Unilist NH exceeds the maximum supported 16 on Trio.
以下类型的路由支持 ECMP 最大下一跃点配置,支持多达 128 个 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 更多。流量分配不严格遵循配置的带宽分配。此注意事项适用于以下路由器:
-
MX 系列路由器,配备所有类型的 FPC 和 DPC,不包括 MPC。此警告 不适用于 具有基于 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 组配置一致的负载平衡,请执行以下操作:
了解 BGP 标记的单播 LSP 的熵标签
什么是熵标签?
熵标签是一种特殊的负载平衡标签,可增强路由器跨等价多路径 (ECMP) 路径或链路聚合组 (LAG) 对流量进行负载均衡的能力。熵标签允许路由器仅使用标签堆栈而不是深度数据包检测 (DPI) 来有效地对流量进行负载均衡。DPI 需要更多路由器的处理能力,并不是所有路由器共享的功能。
当 IP 数据包有多条路径到达其目的地时,Junos OS 使用数据包标头的某些字段将数据包散列为确定性路径。数据包的源地址或目标地址和端口号用于散列,以避免对给定流进行数据包重新排序。如果核心标签交换路由器 (LSR) 无法执行 DPI 来识别流量,或者无法以线速识别流量,则标签堆栈单独用于 ECMP 散列。这需要一个熵标签,一个可以携带流信息的特殊负载平衡标签。与中转 LSR 相比,入口 LSR 具有更多有关传入数据包的上下文和信息。因此,入口标签边缘路由器 (LER) 可以检查数据包的流信息,将其映射到熵标签,然后将其插入标签堆栈中。核心中的 LSR 仅使用熵标签作为密钥,将数据包散列到正确的路径。
熵标签可以是 16 到 1048575 之间的任何标签值(常规 20 位标签范围)。由于此范围与现有的常规标签范围重叠,因此在熵标签之前插入一个称为熵标签指示器 (ELI) 的特殊标签。ELI 是 IANA 分配的特殊标签,值为 7。
图 9 说明了 RSVP 标签交换路径 (LSP) 数据包标签堆栈中的熵标签。标签堆栈由熵标签指示器 (ELI)、熵标签和 IP 数据包组成。
BGP 标记单播的熵标签
BGP 标记的单播跨多个内部网关协议 (IGP) 区域或多个自治系统(内部 AS LSP)连接 RSVP 或 LDP LSP。当入口 PE 和出口 PE 位于不同的 IGP 区域时,区域间 BGP 标记的单播 LSP 通常携带 VPN 和 IP 流量。当 BGP 标记的单播连接 RSVP 或 LDP LSP 时,Junos OS 会在 BGP 标记的单播 LSP 入口处插入熵标签,以实现端到端熵标签负载平衡。这是因为 RSVP 或 LDP 熵标签通常与 RSVP 或 LDP 标签一起在倒数第二个跳节点弹出,并且在拼接点(即两个区域或两个 AS 之间的路由器)处没有熵标签。因此,在没有熵标签的情况下,拼接点的路由器使用 BGP 标签转发数据包。 图 10 说明了 BGP 标记的单播数据包标签堆栈以及 RSVP 标签堆栈中的熵标签。RSVP 标签堆栈由熵标签指示器 (ELI)、熵标签、BGP 标签和 IP 数据包组成。RSVP 熵标签在倒数第二个跃点节点弹出。
BGP 标记的单播拼接节点不能使用熵标签进行负载平衡,除非拼接节点在 BGP 出口处发出熵标签功能的信号。如果 BGP 标记的单播拼接节点向提供商边缘路由器发出 BGP 熵标签功能 (ELC) 信号,则标记为单播 LSP 入口的 BGP 知道 BGP 标记的单播 LSP 出口可以处理熵标签,并在 BGP 标签下方插入熵标签指示器和熵标签。所有 LSR 都能够使用熵标签进行负载平衡。虽然 BGP 标记的单播 LSP 可能会跨越不同区域和 AS 中的许多路由器,但某些分段可能支持熵标签,而其他分段可能不支持。 图 11 说明了 BGP 标签堆栈中的熵标签。拼接节点上的标签堆栈由 ELI、熵标签和 IP 数据包组成。
要在出口节点上禁用 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]
了负载-平衡-标签-功能语句,以基于每个 LSP 向标签发出信号。如果对等路由器未配备处理负载平衡标签的设备,则可以通过在层次结构级别配置 no-load-balance-label-capability
语句 [edit forwarding-options]
来阻止熵标签功能的信令发送。
[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 子集,以便在入口处插入熵标签。
定义出口策略以禁用熵标签功能通告。
Junos OS 不支持 BGP 标记为单播的熵标签的以下功能:
当 BGP 标记的单播 LSP 通过其他运营商的 VPN 建立隧道时,不存在真正的端到端熵标签,因为 Junos OS 不会在载波至载波网络的 VPN 标签下方插入熵标签指示器或熵标签。
目前,Junos OS 不支持带有自有熵标签的 IPv6 BGP 标记的单播 LSP。但是,IPv6 BGP 标记的单播 LSP 可能会使用底层 RSVP、LDP 或 BGP LSP 中的熵标签。
另请参阅
为标记为单播 LSP 的 BGP 配置熵标签
为 BGP 标记的单播 LSP 配置熵标签,以实现端到端熵标签负载平衡。熵标签是一种特殊的负载均衡标签,可以携带数据包的流信息。BGP 标记的单播通常跨多个 IGP 区域或多个自治系统 (AS) 连接 RSVP 或 LDP LSP。RSVP 或 LDP 熵标签与 RSVP 或 LDP 标签一起在倒数第二个跃点节点弹出。此功能允许在拼接点(即两个区域或 AS 之间的路由器)使用平均信息量标签,以实现 BGP 流量的端到端平均信息量标签负载平衡。此功能允许在 BGP 标记的单播 LSP 入口处插入熵标签。
熵标签可以是 16 到 1048575 之间的任何标签值(常规 20 位标签范围)。由于此范围与现有的常规标签范围重叠,因此在熵标签之前插入一个称为熵标签指示器 (ELI) 的特殊标签。ELI 是 IANA 分配的特殊标签,值为 7。
在为 BGP 标记的单播配置熵标签之前,请确保:
配置设备接口。
配置 OSPF 或任何其他 IGP 协议。
配置 BGP。
配置 LDP。
配置 RSVP。
配置 MPLS。
要为 BGP 标记的单播 LSP 配置熵标签,请执行以下操作:
另请参阅
示例:为标记为单播 LSP 的 BGP 配置熵标签
此示例说明如何为标记为单播的 BGP 配置熵标签,以使用熵标签实现端到端负载均衡。当 IP 数据包有多条路径到达其目的地时,Junos OS 使用数据包标头的某些字段将数据包散列为确定性路径。这需要一个熵标签,一个可以携带流信息的特殊负载平衡标签。核心中的 LSR 只需使用熵标签作为密钥,将数据包散列到正确的路径。熵标签可以是 16 到 1048575 之间的任何标签值(常规 20 位标签范围)。由于此范围与现有的常规标签范围重叠,因此在熵标签之前插入一个称为熵标签指示器 (ELI) 的特殊标签。ELI 是 IANA 分配的特殊标签,值为 7。
BGP 标记的单播通常跨多个 IGP 区域或多个自治系统连接 RSVP 或 LDP LSP。RSVP 或 LDP 熵标签与 RSVP 或 LDP 标签一起在倒数第二个跃点节点弹出。此功能允许在拼接点使用熵标签来弥合倒数第二个跃点和拼接点之间的间隙,以实现 BGP 流量的端到端熵标签负载平衡。
要求
此示例使用以下硬件和软件组件:
-
7 个带 MPC 的 MX 系列路由器
-
在所有设备上运行的 Junos OS 15.1 或更高版本
-
使用 Junos OS Relese 22.4 重新验证
-
在为 BGP 标记的单播配置熵标签之前,请确保:
-
配置设备接口。
-
配置 OSPF 或任何其他 IGP 协议。
-
配置 BGP。
-
配置 RSVP。
-
配置 MPLS。
概述
当 BGP 标记的单播跨多个 IGP 区域或多个自治系统连接 RSVP 或 LDP LSP 时,RSVP 或 LDP 熵标签将与 RSVP 或 LDP 标签一起在倒数第二个跃点节点弹出。但是,在拼接点(即两个区域之间的路由器)处没有熵标签。因此,拼接点处的路由器使用 BGP 标签转发数据包。
从 Junos OS 15.1 版开始,您可以为 BGP 标记的单播配置熵标签,以实现端到端熵标签负载平衡。此功能允许在拼接点使用熵标签,以实现 BGP 流量的端到端熵标签负载平衡。Junos OS 允许在 BGP 标记的单播 LSP 入口处插入熵标签。
默认情况下,支持熵标签的路由器在层次结构级别配置load-balance-label-capability
[edit forwarding-options]
语句,以基于每个 LSP 发出标签信号。如果对等路由器未配备处理负载平衡标签的设备,则可以通过在层次结构级别配置 来no-load-balance-label-capability
[edit forwarding-options]
阻止熵标签功能的信令发送。
[edit forwarding-options]
user@PE#no-load-balance-label-capability
您可以使用层次结构级别的选项[edit policy-options policy-statement policy name then]
,在no-entropy-label-capability
出口处为策略中指定的路由显式禁用播发熵标签功能。
[edit policy-options policy-statement policy-name then]
user@PE#no-entropy-label-capability
拓扑学
在 中 图 12 ,路由器 PE1 是入口路由器,路由器 PE2 是出口路由器。路由器 P1 和 P2 是传输路由器。路由器 ABR 是区域 0 和区域 1 之间的区域网桥路由器。在ABR 到 PE2 中配置了两个 LSP ,用于对流量进行负载平衡。入口路由器 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-unicast
ABR 对等family inet-vpn
和 PE2 对等配置 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 的接口放在桥接域中,并创建一个 IRB 接口来验证与 Host1 的连接。
[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 执行 Ping CE2
- 验证负载平衡
- 验证熵标签
验证是否正在播发熵标签功能
目的
验证熵标注功能路径属性是否正在从 ABR 播 发到 PE1 ,以便路由到 PE2。
操作
在操作模式下, show route advertising-protocol bgp 10.1.255.2 detail 在路由器 ABR 上运行命令。
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 的熵标签播发 。
操作
在操作模式下, show route protocol bgp 10.1.255.6 extensive 在路由器 PE1 上运行命令。
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)。
操作
在操作模式下,show route table mpls.0 在路由器 ABR 上运行和show route forwarding-table label <label>命令s。
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 extensive 和 show 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 执行 Ping CE2
目的
验证连接并用于验证负载平衡。
操作
在操作模式下,在路由器 PE1 上运行 ping 172.16.255.7 source 172.16.12.1 rapid count 100 和 ping 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
意义
输出显示上一个命令中使用 LSP abr-pe2-2 的第一个 ping 和第二个使用 LSP abr-pe2的 ping 。
验证熵标签
目的
验证所使用的 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 系列、MX 系列、T 系列或 PTX 系列路由器的组合
配置了 BGP PIC 的设备上的 Junos OS 15.1 或更高版本
概述
从 Junos OS 15.1 版开始,最初支持 3 层 VPN 路由器的 BGP PIC 扩展到具有全局表中多个路由的 BGP,例如 inet 和 inet6 单播,以及标记为单播的 inet 和 inet6。除了计算出的到目标的最佳路径之外,BGP 还会向数据包转发引擎安装第二最佳路径。当 IGP 失去对前缀的可访问性时,路由器将使用此备份路径来减少流量损失,直到解决通过 BGP 的全局收敛问题,从而缩短中断持续时间。
BGP PIC 功能仅在具有 MPC 的路由器上受支持。
拓扑学
此示例显示了三个客户边缘 (CE) 路由器:设备 CE0、CE1 和 CE2。路由器 PE0、PE1 和 PE2 是提供商边缘 (PE) 路由器。路由器 P0 和 P1 是提供商核心路由器。BGP PIC 在路由器 PE0 上配置。为了进行测试,地址 192.168.1.5 将添加为设备 CE1 上的第二个环路接口地址。该地址通告给路由器 PE1 和 PE2,并由内部 BGP (IBGP) 中继到路由器 PE0。在路由器 PE0 上,有两条路径可以连接到 192.168.1.5 网络。这些是主路径和备份路径。 图 13 显示了示例网络。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到层次结构级别的 CLI [edit]
中,然后从配置模式进入提交。
路由器 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-options
show 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 边缘工作正常。
操作
从设备 PE0 运行 show route extensive
命令。
user@PE0> show route 192.168.1.5 extensive
inet.0: 236941 destinations, 630411 routes (236940 active, 0 holddown, 1 hidden)
20.1.1.1/32 (3 entries, 2 announced)
State: <CalcForwarding>
TSI:
KRT in-kernel 192.168.1.5/24 -> {indirect(1048574), indirect(1048575)}
@BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0xafd09d0
Next-hop reference count: 236886
Source: 192.168.0.4
Next hop type: Router, Next hop index: 623
Next hop: 10.0.0.2 via ge-0/0/1.0, selected
Session Id: 0x140
Protocol next hop: 192.168.0.4
Indirect next hop: 0xab3b980 1048574 INH Session ID: 0x144
State: <Active Int Ext ProtectionPath ProtectionCand>
Local AS: 64496 Peer AS: 64496
Age: 1:11 Metric2: 2
Validation State: unverified
Task: BGP_100.192.168.0.5
Announcement bits (1): 6-Resolve tree 2
AS path: 64497 I
Accepted MultipathUnequal
Localpref: 100
Router ID: 192.168.0.5
Indirect next hops: 1
Protocol next hop: 192.168.0.5 Metric: 2
Indirect next hop: 0xab3b980 1048574 INH Session ID: 0x144
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.0.0.2 via ge-0/0/1.0
Session Id: 0x140
192.168.0.5/32 Originating RIB: inet.0
Metric: 2 Node path count: 1
Forwarding nexthops: 1
Nexthop: 10.0.0.2 via ge-0/0/1.0
BGP Preference: 170/-101
Next hop type: Indirect, Next hop index: 0
Address: 0xafd0970
Next-hop reference count: 196735
Source: 192.168.0.4
Next hop type: Router, Next hop index: 624
Next hop: 10.0.0.6 via ge-0/0/0.0, selected
Session Id: 0x141
Protocol next hop: 192.168.0.4
Indirect next hop: 0xab3c240 1048575 INH Session ID: 0x145
State: <NotBest Int Ext ProtectionCand>
Inactive reason: Not Best in its group - IGP metric
Local AS: 100 Peer AS: 100
Age: 1:05 Metric2: 1001
Validation State: unverified
Task: BGP_100.192.168.0.4
AS path: 200 400 I
Accepted
Localpref: 100
Router ID: 192.168.0.4
Indirect next hops: 1
Protocol next hop: 192.168.0.4 Metric: 1001
Indirect next hop: 0xab3c240 1048575 INH Session ID: 0x145
Indirect path forwarding next hops: 1
Next hop type: Router
Next hop: 10.0.0.6 via ge-0/0/0.0
Session Id: 0x141
192.168.0.4/32 Originating RIB: inet.0
Metric: 1001 Node path count: 1
Forwarding nexthops: 1
Nexthop: 10.0.0.6 via ge-0/0/0.0
#Multipath Preference: 255
Next hop type: Indirect, Next hop index: 0
Address: 0xd330f90
Next-hop reference count: 304062
Next hop type: Router, Next hop index: 623
Next hop: 10.0.0.6 via ge-0/0/0.0, selected
Session Id: 0x140
Next hop type: Router, Next hop index: 624
Next hop: 10.0.0.2 via ge-0/0/1.0
Session Id: 0x141
Protocol next hop: 192.168.0.4
Indirect next hop: 0xab3b980 1048574 INH Session ID: 0x144 Weight 0x1
Protocol next hop: 192.168.0.5
Indirect next hop: 0xab3c240 1048575 INH Session ID: 0x145 Weight 0x4000
State: <ForwardinOnly Int Ext>
Inactive reason: Forwarding use only
Local AS: 64496
Age: 1:05 Metric2: 2
Validation State: unverified
Task: RT
Announcement bits (1): 0-KRT
AS path: 64497 I
意义
发生链路故障时,Junos OS 使用下一跃点和 weight
值来选择备份路径。下一跃点权重具有以下值之一:
0x1 表示具有活动下一跃点的主路径。
0x4000指示具有被动下一跃点的备份路径。
显示转发表
目的
使用 show route forwarding-table
命令检查转发和内核路由表状态。
操作
从设备 PE0 运行 show route forwarding-table destination 192.168.1.5 extensive
命令。
user@PE0> show route forwarding-table destination 192.168.1.5 extensive
Routing table: default.inet [Index 0]
Internet:
Destination: 192.168.1.5/24
Route type: user
Route reference: 0 Route interface-index: 0
Multicast RPF nh index: 0
Flags: sent to PFE
Next-hop type: unilist Index: 1048576 Reference: 7401
Next-hop type: indirect Index: 1048574 Reference: 2 Weight: 0x1
Nexthop: 10.0.0.6
Next-hop type: unicast Index: 623 Reference: 8
Next-hop interface: ge-0/0/0.0 Weight: 0x1
Next-hop type: indirect Index: 1048575 Reference: 2 Weight: 0x4000
Nexthop: 10.0.0.2
Next-hop type: unicast Index: 624 Reference: 8
Next-hop interface: ge-0/0/1.0 Weight: 0x4000
意义
发生链路故障时,Junos OS 使用下一跃点和 weight
值来选择备份路径。下一跃点权重具有以下值之一:
0x1 表示具有活动下一跃点的主路径。
0x4000指示具有被动下一跃点的备份路径。
使用 BGP 标记单播的 BGP PIC 边缘概述
本节介绍使用 BGP 标记的单播作为传输协议的 BGP PIC Edge 的优势和概述。
使用 BGP 标记单播的 BGP PIC 边缘的优势
此功能具有以下优点:
在多域网络中发生边界(ABR 和 ASBR)节点故障时提供流量保护。
提供更快的网络连接恢复,并在主路径不可用时减少流量损失。
BGP 前缀独立收敛的工作原理是什么?
BGP 前缀独立收敛 (PIC) 改进了网络节点故障时的 BGP 收敛。BGP PIC 为路由引擎上的间接下一跃点创建并存储主路径和备份路径,并向数据包转发引擎提供间接下一跃点路由信息。发生网络节点故障时,路由引擎会向数据包转发引擎发出信号,表明间接下一跃点出现故障,并且流量将重新路由到预先计算的等价路径或备份路径,而无需修改 BGP 前缀。通过使用备份路径继续将流量路由到目标前缀以减少流量丢失,直到解决通过 BGP 的全局融合问题。
BGP 融合适用于核心和边缘网络节点故障。对于 BGP PIC 核心,转发链的调整是由于节点或核心链路故障。对于 BGP PIC 边缘,转发链的调整是由于边缘节点或边缘链路故障。
使用 BGP 标记的单播作为传输协议的 BGP PIC Edge
当多域网络中发生边界节点(ABR 和 ASBR)故障时,使用 BGP 标记的单播传输协议的 BGP PIC Edge 有助于保护和重新路由流量。多域网络通常用于城域以太网聚合和移动回传网络设计。
在瞻博网络 MX 系列、EX 系列和 PTX 系列设备上,BGP PIC Edge 支持将 BGP 标记为单播作为传输协议的第 3 层服务。此外,在瞻博网络 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 PIC 边缘保护,并将 BGP 标记为单播作为传输:
标记为单播的 IPv4 BGP 上的 IPv4 服务
IPv6 BGP 标记为单播服务的 IPv4 BGP 标记为单播
通过标记为单播的 IPv4 BGP 上的 IPv4 第 3 层 VPN 服务
通过标记为单播的 IPv4 BGP 上的 IPv6 第 3 层 VPN 服务
在瞻博网络 MX 系列和 EX 系列设备上,以下服务支持 BGP PIC 边缘保护,并将 BGP 标记为单播作为传输:
通过 IPv4 BGP 标记的单播的第 2 层电路服务
标记为单播的 IPv4 BGP 上的第 2 层 VPN 服务
基于 IPv4 的 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务 BGP 标记为单播
使用带有 BGP 标记的单播为第 2 层服务配置 BGP PIC Edge
MX 系列、EX9204、EX9208、EX9214、EX9251 和 EX9253 设备支持用于第 2 层电路、第 2 层 VPN 和 VPLS(BGP VPLS、LDP VPLS 和 FEC 129 VPLS)服务的 BGP PIC 边缘保护,其中 BGP 标记为单播作为传输协议。BGP PIC Edge 使用 BGP 标记的单播传输协议有助于保护多域网络中边界节点(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 说明了运行标记为单播作为域间传输协议的 BGP 的第 3 层 VPN。
下表描述了拓扑中使用的组件:
主要组件 |
设备类型 |
位置 |
---|---|---|
CE1 |
MX 系列 |
已连接到客户网络。 |
PE1 |
MX 系列 |
配置了主路由路径和备份路由路径,以保护和重新路由从 CE1 到 CE2 的流量。 |
P1-P3 |
MX 系列 |
用于传输流量的核心路由器。 |
ABR1-ABR2 |
MX 系列 |
区域边界路由器 |
ABSR1-ABSR4 |
MX 系列 |
自治系统边界路由器 |
RR1-RR3 |
MX 系列 |
路由反射器 |
PE2-PE3 |
MX 系列 |
PE 路由器连接到客户边缘路由器 (CE2)。 |
CE2 |
MX 系列 |
已连接到客户网络。 |
PE2 和 PE3 设备地址 作为标记为单播路由从 ABR1 和 ABR2 获知 。这些路由通过 IGP/LDP 协议解析。PE1 从 PE2 和 PE3 设备学习 CE2 路由。
配置
要使用以 LDP 作为传输协议的 BGP 标签单播配置 BGP PIC 边缘,请执行以下操作:
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit]
层级的 CLI 中,然后从配置模式进入 commit
。
设备 CE1
set interfaces ge-0/0/1 description CE1-to-PE1-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.0/31 set interfaces ge-0/0/2 description CE1-to-PE1-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.2/31 set interfaces lo0 unit 0 family inet address 10.4.4.4/32 set policy-options policy-statement nhs term 1 from interface lo0.0 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set routing-options router-id 10.4.4.4 set routing-options autonomous-system 65004 set protocols bgp path-selection external-router-id set protocols bgp group toAs2 export nhs set protocols bgp group toAs2 peer-as 65002 set protocols bgp group toAs2 neighbor 192.168.0.1 set protocols bgp group toAs2 neighbor 192.168.0.3
设备 PE1
set interfaces ge-0/0/1 description PE1-to-CE1-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.1/31 set interfaces ge-0/0/2 description PE1-to-CE1-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.3/31 set interfaces ge-0/0/3 description PE1-to-P1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.4/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.2.2.5/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0005.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement mp-resolv term 1 from route-filter 10.1.1.0/24 orlonger set policy-options policy-statement mp-resolv term 1 then accept set policy-options policy-statement mp-resolv term 1 then multipath-resolve set policy-options policy-statement mp-resolv term 2 from route-filter 10.2.2.0/24 orlonger set policy-options policy-statement mp-resolv term 2 then accept set policy-options policy-statement mp-resolv term 2 then multipath-resolve set policy-options policy-statement mp-resolv term def then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then local-preference 65200 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement vrf-export-red term 1 then community add leak2red set policy-options policy-statement vrf-export-red term 1 then accept set policy-options policy-statement vrf-import-red term 1 from community leak2red set policy-options policy-statement vrf-import-red term 1 then accept set policy-options community leak2red members target:100:100 set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-instances red routing-options multipath preserve-nexthop-hierarchy set routing-instances red routing-options protect core set routing-instances red protocols bgp group toCE1 peer-as 4 set routing-instances red protocols bgp group toCE1 neighbor 192.168.0.2 set routing-instances red instance-type vrf set routing-instances red interface ge-0/0/2.0 set routing-instances red vrf-import vrf-import-red set routing-instances red vrf-export vrf-export-red set routing-options rib inet.3 protect core set routing-options route-distinguisher-id 10.2.2.5 set routing-options forwarding-table export pplb set routing-options resolution preserve-nexthop-hierarchy set routing-options resolution rib inet.0 import mp-resolv set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.2.2.5 set routing-options autonomous-system 2 set routing-options protect core set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface ge-0/0/3.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/3.0 set protocols ldp interface ge-0/0/3.0 set protocols mpls label-switched-path toABR1-gold to 10.2.2.3 set protocols mpls label-switched-path toABR1-bronze to 10.2.2.3 set protocols mpls label-switched-path toABR2-gold to 10.2.2.4 set protocols bgp path-selection external-router-id set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.5 set protocols bgp group toAs2RR family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs2RR family inet labeled-unicast add-path receive set protocols bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2RR family inet labeled-unicast nexthop-resolution preserve-nexthop-hierarchy set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR export export-inet3 set protocols bgp group toAs2RR neighbor 10.2.2.6 set protocols bgp group toAs4 peer-as 65004 set protocols bgp group toAs4 neighbor 192.168.0.0 set protocols bgp group toAs1PEs multihop no-nexthop-change set protocols bgp group toAs1PEs local-address 10.2.2.5 set protocols bgp group toAs1PEs family inet unicast set protocols bgp group toAs1PEs family inet-vpn unicast set protocols bgp group toAs1PEs family inet6 unicast set protocols bgp group toAs1PEs family inet6-vpn unicast set protocols bgp group toAs1PEs export nhs set protocols bgp group toAs1PEs peer-as 65001 set protocols bgp group toAs1PEs neighbor 10.1.1.1 set protocols bgp group toAs1PEs neighbor 10.1.1.2 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp multipath
设备 P1
set interfaces ge-0/0/1 description P1-to-RR1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.6/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description P1-to-ABR1 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.8/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description P1-to-PE1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.5/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description P1-to-ABR2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.10/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.8/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0008.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set routing-options router-id 10.2.2.8 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all
设备 RR1
set interfaces ge-0/0/1 description RR1-to-P1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.7/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.2.2.6/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0006.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement pplb then load-balance per-packet set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.2.2.6 set routing-options autonomous-system 2 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-rib inet6.3 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all set protocols bgp path-selection external-router-id set protocols bgp group toAs2Reg2BNs type internal set protocols bgp group toAs2Reg2BNs family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs2Reg2BNs family inet labeled-unicast add-path receive set protocols bgp group toAs2Reg2BNs family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2Reg2BNs family inet labeled-unicast rib inet.3 set protocols bgp group toAs2Reg2BNs export export-inet3 set protocols bgp group toAs2Reg2BNs neighbor 10.2.2.3 set protocols bgp group toAs2Reg2BNs neighbor 10.2.2.4 set protocols bgp group toAs2Reg2BNs neighbor 10.2.2.5 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp local-address 10.2.2.6 set protocols bgp cluster 10.2.2.6
设备 ABR1
set interfaces ge-0/0/1 description ABR1-to-P2 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.12/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ABR1-to-P1 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.9/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.3/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0003.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.3 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls label-switched-path toASBR2-gold to 10.2.2.2 set protocols mpls label-switched-path toASBR1-bronze to 10.2.2.1 set protocols mpls label-switched-path toASBR2-bronze to 10.2.2.2 set protocols mpls interface all set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.3 set protocols bgp group toAs2RR advertise-inactive set protocols bgp group toAs2RR family inet labeled-unicast add-path receive set protocols bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR cluster 10.2.2.3 set protocols bgp group toAs2RR neighbor 10.2.2.6 set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ABR2
set interfaces ge-0/0/2 description ABR2-to-P2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.14/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/4 description ABR2-to-P1 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.11/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.4/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0004.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.4 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls label-switched-path toASBR1-bronze to 10.2.2.1 set protocols mpls interface all set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.4 set protocols bgp group toAs2RR advertise-inactive set protocols bgp group toAs2RR family inet labeled-unicast add-path receive set protocols bgp group toAs2RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR cluster 10.2.2.4 set protocols bgp group toAs2RR neighbor 10.2.2.6 set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 P2
set interfaces ge-0/0/1 description P2-to-ABR1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.13/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description P2-to-ABR2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.15/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description P2-to-RR2 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.16/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description P2-to-ASBR1 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.18/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description P2-to-ASBR2 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.20/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.9/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0009.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set routing-options router-id 10.2.2.9 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all
设备 RR2
set interfaces ge-0/0/3 description RR2-to-P2 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.17/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.2.2.7/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0007.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.2.2.7 set routing-options autonomous-system 65002 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all set protocols bgp path-selection external-router-id set protocols bgp group toAs2Reg1BNs type internal set protocols bgp group toAs2Reg1BNs family inet labeled-unicast add-path receive set protocols bgp group toAs2Reg1BNs family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs2Reg1BNs family inet labeled-unicast rib inet.3 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.1 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.2 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.3 set protocols bgp group toAs2Reg1BNs neighbor 10.2.2.4 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp local-address 10.2.2.7 set protocols bgp cluster 10.2.2.7
设备 ASBR1
set interfaces ge-0/0/2 description ASBR1-to-ASBR3 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.22/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description ASBR1-to-ASBR4 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.24/31 set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description ASBR1-to-P2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.19/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.1/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0001.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.1 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface ge-0/0/4.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/4.0 set protocols ldp interface ge-0/0/4.0 set protocols mpls interface ge-0/0/4.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs1-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs1-T peer-as 1 set protocols bgp group toAs1-T neighbor 192.168.0.23 set protocols bgp group toAs1-T neighbor 192.168.0.27 set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.1 set protocols bgp group toAs2RR advertise-external set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ASBR2
set interfaces ge-0/0/1 description ASBR2-to-ASBR3 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.28/31 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ASBR2-to-ASBR4 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.26/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/5 description ASBR2-to-P2 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.21/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.2.2.2/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0002.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.2.2.2 set routing-options autonomous-system 65002 set protocols isis level 1 disable set protocols isis interface ge-0/0/5.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/5.0 set protocols ldp interface ge-0/0/5.0 set protocols mpls interface ge-0/0/5.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs1-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs1-T peer-as 1 set protocols bgp group toAs1-T neighbor 192.168.0.29 set protocols bgp group toAs1-T neighbor 192.168.0.25 set protocols bgp group toAs2RR type internal set protocols bgp group toAs2RR local-address 10.2.2.2 set protocols bgp group toAs2RR advertise-external set protocols bgp group toAs2RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs2RR export nhs set protocols bgp group toAs2RR neighbor 10.2.2.7 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ASBR3
set interfaces ge-0/0/1 description ASBR3-to-ASBR2 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.29/31 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ASBR3-to-ASBR1 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.23/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/4 description ASBR3-to-P3 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.30/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.1.3/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0003.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.1.1.3 set routing-options autonomous-system 65001 set protocols isis level 1 disable set protocols isis interface ge-0/0/4.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/4.0 set protocols ldp interface ge-0/0/4.0 set protocols mpls label-switched-path toPE2-gold to 10.1.1.1 set protocols mpls interface ge-0/0/4.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs2-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs2-T peer-as 65002 set protocols bgp group toAs2-T neighbor 192.168.0.22 set protocols bgp group toAs2-T neighbor 192.168.0.28 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.3 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 ASBR4
set interfaces ge-0/0/1 description ASBR4-to-P3 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.32/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description ASBR4-to-ASBR2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.27/31 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description ASBR4-to-ASBR1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.25/31 set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.1.4/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0004.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set routing-options forwarding-table export pplb set routing-options router-id 10.1.1.4 set routing-options autonomous-system 65001 set protocols isis level 1 disable set protocols isis interface ge-0/0/1.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/1.0 set protocols ldp interface ge-0/0/1.0 set protocols mpls label-switched-path toPE2-bronze to 10.1.1.1 set protocols mpls label-switched-path toPE3-bronze to 10.1.1.2 set protocols mpls interface ge-0/0/1.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs2-T family inet labeled-unicast rib inet.3 set protocols bgp group toAs2-T peer-as 2 set protocols bgp group toAs2-T neighbor 192.168.0.26 set protocols bgp group toAs2-T neighbor 192.168.0.24 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.4 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 RR3
set interfaces ge-0/0/2 description RR3-to-P3 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.35/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.1.1.6/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0006.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement pplb then load-balance per-packet set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.1.1.6 set routing-options autonomous-system 1 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all set protocols bgp path-selection external-router-id set protocols bgp group toAs1BNs type internal set protocols bgp group toAs1BNs family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs1BNs family inet labeled-unicast add-path receive set protocols bgp group toAs1BNs family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs1BNs family inet labeled-unicast rib inet.3 set protocols bgp group toAs1BNs export export-inet3 set protocols bgp group toAs1BNs neighbor 10.1.1.3 set protocols bgp group toAs1BNs neighbor 10.1.1.4 set protocols bgp group toAs1BNs neighbor 10.1.1.2 set protocols bgp group toAs1BNs neighbor 10.1.1.1 set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy set protocols bgp local-address 10.1.1.6 set protocols bgp cluster 10.1.1.6
设备 P3
set interfaces ge-0/0/1 description P3-to-ASBR4 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.33/31 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description P3-to-RR3 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.34/31 set interfaces ge-0/0/2 unit 0 family iso set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description P3-to-PE2 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.36/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description P3-to-ASBR3 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.31/31 set interfaces ge-0/0/4 unit 0 family iso set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description P3-to-PE3 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.38/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.1.1.5/32 set interfaces lo0 unit 0 family iso address 49.0000.0000.aaaa.0005.00 set policy-options policy-statement allow-lo0 term 1 from interface lo0.0 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set routing-options router-id 10.1.1.5 set protocols isis level 1 disable set protocols isis interface all set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface all set protocols ldp interface all set protocols mpls interface all
设备 PE2
set interfaces ge-0/0/1 description PE2-to-CE2-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.40/31 set interfaces ge-0/0/2 description PE2-to-CE2-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.42/31 set interfaces ge-0/0/3 description PE2-to-P3 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.37/31 set interfaces ge-0/0/3 unit 0 family iso set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.1.1.1/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0001.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then metric add 0 set policy-options policy-statement nhs term 1 then local-preference 200 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement vrf-export-red term 1 then community add leak2red set policy-options policy-statement vrf-export-red term 1 then accept set policy-options policy-statement vrf-import-red term 1 from community leak2red set policy-options policy-statement vrf-import-red term 1 then accept set policy-options community leak2red members target:100:100 set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-instances red protocols bgp group toCE2 peer-as 65003 set routing-instances red protocols bgp group toCE2 neighbor 192.168.0.43 set routing-instances red instance-type vrf set routing-instances red interface ge-0/0/2.0 set routing-instances red vrf-import vrf-import-red set routing-instances red vrf-export vrf-export-red set routing-options route-distinguisher-id 10.1.1.1 set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.1.1.1 set routing-options autonomous-system 1 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface ge-0/0/3.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/3.0 set protocols ldp interface ge-0/0/3.0 set protocols mpls interface ge-0/0/3.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs3-1 peer-as 65003 set protocols bgp group toAs3-1 neighbor 192.168.0.41 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.1 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs1RR family inet labeled-unicast add-path receive set protocols bgp group toAs1RR family inet labeled-unicast add-path send path-count 4 set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR family inet6-vpn unicast set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR export export-inet3 set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp group toAs2PEs multihop no-nexthop-change set protocols bgp group toAs2PEs local-address 10.1.1.1 set protocols bgp group toAs2PEs family inet unicast set protocols bgp group toAs2PEs family inet-vpn unicast set protocols bgp group toAs2PEs family inet6 unicast set protocols bgp group toAs2PEs family inet6-vpn unicast set protocols bgp group toAs2PEs export nhs set protocols bgp group toAs2PEs peer-as 65002 set protocols bgp group toAs2PEs neighbor 10.2.2.5 set protocols bgp group toAs2PEs vpn-apply-export set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 PE3
set interfaces ge-0/0/3 description PE3-to-CE2-Link1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.44/31 set interfaces ge-0/0/4 description PE3-to-CE2-Link2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.46/31 set interfaces ge-0/0/5 description PE3-to-P3 set interfaces ge-0/0/5 vlan-tagging set interfaces ge-0/0/5 unit 0 vlan-id 100 set interfaces ge-0/0/5 unit 0 family inet address 192.168.0.39/31 set interfaces ge-0/0/5 unit 0 family iso set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 1 family inet address 10.1.1.2/32 set interfaces lo0 unit 1 family iso address 49.0000.0000.aaaa.0002.00 set policy-options policy-statement add-noexport term 1 then community add noexport set policy-options policy-statement allow-lo0 term 1 from interface lo0.1 set policy-options policy-statement allow-lo0 term 1 then accept set policy-options policy-statement allow-lo0 term 2 then reject set policy-options policy-statement export-inet3 term 1 from rib inet.3 set policy-options policy-statement export-inet3 term 1 then accept set policy-options policy-statement export-inet3 term 2 then reject set policy-options policy-statement nhs term 1 from protocol bgp set policy-options policy-statement nhs term 1 then metric add 0 set policy-options policy-statement nhs term 1 then local-preference 200 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement vrf-export-red term 1 then community add leak2red set policy-options policy-statement vrf-export-red term 1 then accept set policy-options policy-statement vrf-import-red term 1 from community leak2red set policy-options policy-statement vrf-import-red term 1 then accept set policy-options community leak2red members target:100:100 set policy-options community noexport members no-export set policy-options community noexport members no-advertise set routing-instances red protocols bgp group toCE2 peer-as 65003 set routing-instances red protocols bgp group toCE2 neighbor 192.168.0.47 set routing-instances red instance-type vrf set routing-instances red interface ge-0/0/4.0 set routing-instances red vrf-import vrf-import-red set routing-instances red vrf-export vrf-export-red set routing-options route-distinguisher-id 10.1.1.2 set routing-options forwarding-table export pplb set routing-options interface-routes rib-group inet inet0to3 set routing-options router-id 10.1.1.2 set routing-options autonomous-system 1 set routing-options rib-groups inet0to3 import-rib inet.0 set routing-options rib-groups inet0to3 import-rib inet.3 set routing-options rib-groups inet0to3 import-policy allow-lo0 set routing-options rib-groups inet3to0 import-rib inet.3 set routing-options rib-groups inet3to0 import-rib inet.0 set routing-options rib-groups inet3to0 import-policy add-noexport set protocols isis level 1 disable set protocols isis interface ge-0/0/5.0 set protocols isis export allow-lo0 set protocols isis topologies ipv6-unicast set protocols rsvp interface ge-0/0/5.0 set protocols ldp interface ge-0/0/5.0 set protocols mpls interface ge-0/0/5.0 set protocols bgp path-selection external-router-id set protocols bgp group toAs3 peer-as 65003 set protocols bgp group toAs3 neighbor 192.168.0.45 set protocols bgp group toAs1RR type internal set protocols bgp group toAs1RR local-address 10.1.1.2 set protocols bgp group toAs1RR advertise-external set protocols bgp group toAs1RR family inet labeled-unicast rib-group inet3to0 set protocols bgp group toAs1RR family inet labeled-unicast rib inet.3 set protocols bgp group toAs1RR export nhs set protocols bgp group toAs1RR export export-inet3 set protocols bgp group toAs1RR neighbor 10.1.1.6 set protocols bgp group toAs2PEs multihop no-nexthop-change set protocols bgp group toAs2PEs local-address 10.1.1.2 set protocols bgp group toAs2PEs family inet unicast set protocols bgp group toAs2PEs family inet-vpn unicast set protocols bgp group toAs2PEs family inet6 unicast set protocols bgp group toAs2PEs family inet6-vpn unicast set protocols bgp group toAs2PEs export nhs set protocols bgp group toAs2PEs peer-as 65002 set protocols bgp group toAs2PEs neighbor 10.2.2.5 set protocols bgp group toAs2PEs vpn-apply-export set protocols bgp traceoptions file bgp.log set protocols bgp traceoptions file size 100m set protocols bgp traceoptions flag state detail set protocols bgp traceoptions flag policy
设备 CE2
set interfaces ge-0/0/1 description CE2-to-PE2-Link1 set interfaces ge-0/0/1 vlan-tagging set interfaces ge-0/0/1 unit 0 vlan-id 100 set interfaces ge-0/0/1 unit 0 family inet address 192.168.0.41/31 set interfaces ge-0/0/2 description CE2-to-PE2-Link2 set interfaces ge-0/0/2 vlan-tagging set interfaces ge-0/0/2 unit 0 vlan-id 100 set interfaces ge-0/0/2 unit 0 family inet address 192.168.0.43/31 set interfaces ge-0/0/3 description CE2-to-PE3-Link1 set interfaces ge-0/0/3 vlan-tagging set interfaces ge-0/0/3 unit 0 vlan-id 100 set interfaces ge-0/0/3 unit 0 family inet address 192.168.0.45/31 set interfaces ge-0/0/4 description CE2-to-PE3-Link2 set interfaces ge-0/0/4 vlan-tagging set interfaces ge-0/0/4 unit 0 vlan-id 100 set interfaces ge-0/0/4 unit 0 family inet address 192.168.0.47/31 set interfaces lo0 unit 0 family inet address 10.3.3.3/32 set policy-options policy-statement nhs term 1 from interface lo0.0 set policy-options policy-statement nhs term 1 then metric 50 set policy-options policy-statement nhs term 1 then next-hop self set policy-options policy-statement nhs term 1 then accept set policy-options policy-statement nhsMED100 term 1 from interface lo0.0 set policy-options policy-statement nhsMED100 term 1 then metric 100 set policy-options policy-statement nhsMED100 term 1 then next-hop self set policy-options policy-statement nhsMED100 term 1 then accept set policy-options community map2bronze members 100:200 set policy-options community map2gold members 100:100 set policy-options community map2gold_bronze_plain members 300:400 set routing-options router-id 10.3.3.3 set routing-options autonomous-system 65003 set protocols bgp path-selection external-router-id set protocols bgp group toAs1Internet export nhs set protocols bgp group toAs1Internet peer-as 65001 set protocols bgp group toAs1Internet neighbor 192.168.0.40 set protocols bgp group toAs1Internet neighbor 192.168.0.44 export nhsMED100 set protocols bgp group toAs1L3VPN export nhs set protocols bgp group toAs1L3VPN peer-as 65001 set protocols bgp group toAs1L3VPN neighbor 192.168.0.46 set protocols bgp group toAs1L3VPN neighbor 192.168.0.42 export nhsMED100
配置 CE1
分步过程
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 CE1:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@CE1#set ge-0/0/1 description CE1-to-PE1-Link1 user@CE1#set ge-0/0/1 vlan-tagging user@CE1#set ge-0/0/1 unit 0 vlan-id 100 user@CE1#set ge-0/0/1 unit 0 family inet address 192.168.0.0/31 user@CE1#set ge-0/0/2 description CE1-to-PE1-Link2 user@CE1#set ge-0/0/2 vlan-tagging user@CE1#set ge-0/0/2 unit 0 vlan-id 100 user@CE1#set ge-0/0/2 unit 0 family inet address 192.168.0.2/31
-
配置要用作 LDP 和 BGP 会话的路由器 ID 和终止接口的环路接口。
[edit interfaces] user@CE1#set lo0 unit 0 family inet address 10.4.4.4/32
-
配置多路径解析策略以将分层多路径安装到 PFE 中。
[edit policy-options] user@CE1#set policy-statement nhs term 1 from interface lo0.0 user@CE1#set policy-statement nhs term 1 then next-hop self user@CE1#set policy-statement nhs term 1 then accept
-
配置路由选项。
[edit routing-options] user@CE1#set router-id 10.4.4.4 user@CE1#set autonomous-system 65004
-
将标记为单播的 BGP 配置为 ABR,以将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols bgp] user@CE1#set path-selection external-router-id user@CE1#set group toAs2 export nhs user@CE1#set group toAs2 peer-as 65002 user@CE1#set group toAs2 neighbor 192.168.0.1 user@CE1#set group toAs2 neighbor 192.168.0.3
结果
在配置模式下,输入 show interfaces
、show policy-options
、show routing-options
和 show protocols
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
interfaces { ge-0/0/1 { description CE1-to-PE1-Link1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.0/31; } } } ge-0/0/2 { description CE1-to-PE1-Link2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.2/31; } } } lo0 { unit 0 { family inet { address 10.4.4.4/32; } } } } policy-options { policy-statement nhs { term 1 { from interface lo0.0; then { next-hop self; accept; } } } } routing-options { router-id 10.4.4.4; autonomous-system 65004; } protocols { bgp { path-selection external-router-id; group toAs2 { export nhs; peer-as 65002; neighbor 192.168.0.1; neighbor 192.168.0.3; } } }
配置 PE1
分步过程
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 PE1:
-
配置接口以启用 IP 和 MPLS 传输。
[edit interfaces] user@PE1#set ge-0/0/1 description PE1-to-CE1-Link1 user@PE1#set ge-0/0/1 vlan-tagging user@PE1#set ge-0/0/1 unit 0 vlan-id 100 user@PE1#set ge-0/0/1 unit 0 family inet address 192.168.0.1/31 user@PE1#set ge-0/0/2 description PE1-to-CE1-Link2 user@PE1#set ge-0/0/2 vlan-tagging user@PE1#set ge-0/0/2 unit 0 vlan-id 100 user@PE1#set ge-0/0/2 unit 0 family inet address 192.168.0.3/31 user@PE1#set ge-0/0/3 description PE1-to-P1 user@PE1#set ge-0/0/3 vlan-tagging user@PE1#set ge-0/0/3 unit 0 vlan-id 100 user@PE1#set ge-0/0/3 unit 0 family inet address 192.168.0.4/31 user@PE1#set ge-0/0/3 unit 0 family iso user@PE1#set ge-0/0/3 unit 0 family mpls
-
配置要用作 LDP 和 BGP 会话的路由器 ID 和终止接口的环路接口。
[edit interfaces] user@PE1#set lo0 unit 1 family inet address 10.2.2.5/32 user@PE1#set lo0 unit 1 family iso address 49.0000.0000.aaaa.0005.00
-
配置多路径解析策略以将分层多路径安装到 PFE 中。
[edit policy-options] user@PE1#set policy-statement add-noexport term 1 then community add noexport user@PE1#set policy-statement allow-lo0 term 1 from interface lo0.1 user@PE1#set policy-statement allow-lo0 term 1 then accept user@PE1#set policy-statement allow-lo0 term 2 then reject user@PE1#set policy-statement export-inet3 term 1 from rib inet.3 user@PE1#set policy-statement export-inet3 term 1 then accept user@PE1#set policy-statement export-inet3 term 2 then reject user@PE1#set policy-statement mp-resolv term 1 from route-filter 10.1.1.0/24 orlonger user@PE1#set policy-statement mp-resolv term 1 then accept user@PE1#set policy-statement mp-resolv term 1 then multipath-resolve user@PE1#set policy-statement mp-resolv term 2 from route-filter 10.2.2.0/24 orlonger user@PE1#set policy-statement mp-resolv term 2 then accept user@PE1#set policy-statement mp-resolv term 2 then multipath-resolve user@PE1#set policy-statement mp-resolv term def then reject user@PE1#set policy-statement nhs term 1 from protocol bgp user@PE1#set policy-statement nhs term 1 then local-preference 200 user@PE1#set policy-statement nhs term 1 then next-hop self user@PE1#set policy-statement nhs term 1 then accept user@PE1#set policy-statement pplb then load-balance per-packet user@PE1#set policy-statement vrf-export-red term 1 then community add leak2red user@PE1#set policy-statement vrf-export-red term 1 then accept user@PE1#set policy-statement vrf-import-red term 1 from community leak2red user@PE1#set policy-statement vrf-import-red term 1 then accept user@PE1#set community leak2red members target:100:100 user@PE1#set community noexport members no-export user@PE1#set community noexport members no-advertise
-
配置第 3 层 VPN 路由实例以提供客户服务。
[edit routing-instances] user@PE1#set red routing-options multipath preserve-nexthop-hierarchy user@PE1#set red routing-options protect core user@PE1#set red protocols bgp group toCE1 peer-as 65004 user@PE1#set red protocols bgp group toCE1 neighbor 192.168.0.2 user@PE1#set red instance-type vrf user@PE1#set red interface ge-0/0/2.0 user@PE1#set red vrf-import vrf-import-red user@PE1#set red vrf-export vrf-export-red
-
配置解析器 RIB 导入策略和解析 RIB,以便为策略中指定的选定第 3 层 VPN 前缀启用扩展的分层下一跃点结构。
[edit routing-options] user@PE1#set rib inet.3 protect core user@PE1#set route-distinguisher-id 10.2.2.5 user@PE1#set forwarding-table export pplb user@PE1#set resolution preserve-nexthop-hierarchy user@PE1#set resolution rib inet.0 import mp-resolv user@PE1#set interface-routes rib-group inet inet0to3 user@PE1#set router-id 10.2.2.5 user@PE1#set autonomous-system 65002 user@PE1#set protect core user@PE1#set rib-groups inet0to3 import-rib inet.0 user@PE1#set rib-groups inet0to3 import-rib inet.3 user@PE1#set rib-groups inet0to3 import-policy allow-lo0 user@PE1#set rib-groups inet3to0 import-rib inet.3 user@PE1#set rib-groups inet3to0 import-rib inet.0 user@PE1#set rib-groups inet3to0 import-policy add-noexport
-
配置 OSPF 协议。
[edit protocols ospf] user@PE1#set protocols ospf area 0.0.0.0 interface all link-protection; user@PE1#set protocols ospf area 0.0.0.0 interface fxp0.0 disable; user@PE1#set protocols ospf area 0.0.0.0 interface lo0.0 passive;
-
配置路由协议以在整个域中建立 IP 和 MPLS 连接。
[edit protocols] user@PE1#set isis level 1 disable user@PE1#set isis interface ge-0/0/3.0 user@PE1#set isis export allow-lo0 user@PE1#set isis topologies ipv6-unicast user@PE1#set rsvp interface ge-0/0/3.0 user@PE1#set ldp interface ge-0/0/3.0 user@PE1#set mpls label-switched-path toABR1-gold to 10.2.2.3 user@PE1#set mpls label-switched-path toABR1-bronze to 10.2.2.3 user@PE1#set mpls label-switched-path toABR2-gold to 10.2.2.4
-
将标记为单播的 BGP 配置为 ABR,以将环路 IP 地址交换为 BGP 标记的单播前缀。
[edit protocols bgp] user@PE1#set path-selection external-router-id user@PE1#set group toAs2RR type internal user@PE1#set group toAs2RR local-address 10.2.2.5 user@PE1#set group toAs2RR family inet labeled-unicast rib-group inet3to0 user@PE1#set group toAs2RR family inet labeled-unicast add-path receive user@PE1#set group toAs2RR family inet labeled-unicast add-path send path-count 4 user@PE1#set group toAs2RR family inet labeled-unicast nexthop-resolution preserve-nexthop-hierarchy user@PE1#set group toAs2RR family inet labeled-unicast rib inet.3 user@PE1#set group toAs2RR export nhs user@PE1#set group toAs2RR export export-inet3 user@PE1#set group toAs2RR neighbor 10.2.2.6 user@PE1#set group toAs4 peer-as 65004 user@PE1#set group toAs4 neighbor 192.168.0.0 user@PE1#set group toAs1PEs multihop no-nexthop-change user@PE1#set group toAs1PEs local-address 10.2.2.5 user@PE1#set group toAs1PEs family inet unicast user@PE1#set group toAs1PEs family inet-vpn unicast user@PE1#set group toAs1PEs family inet6 unicast user@PE1#set group toAs1PEs family inet6-vpn unicast user@PE1#set group toAs1PEs export nhs user@PE1#set group toAs1PEs peer-as 65001 user@PE1#set group toAs1PEs neighbor 10.1.1.1 user@PE1#set group toAs1PEs neighbor 10 .1.1.2 user@PE1#set traceoptions file bgp.log user@PE1#set traceoptions file size 100m user@PE1#set traceoptions flag state detail user@PE1#set traceoptions flag policy user@PE1#set multipath
结果
在配置模式下,输入 show chassis
、 show interfaces
、 show policy-options
、 show routing-instances
和show routing-options
show protocols
命令确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。
interfaces { ge-0/0/1 { description PE1-to-CE1-Link1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.1/31; } } } ge-0/0/2 { description PE1-to-CE1-Link2; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.3/31; } } } ge-0/0/3 { description PE1-to-P1; vlan-tagging; unit 0 { vlan-id 100; family inet { address 192.168.0.4/31; } family iso; family mpls; } } lo0 { unit 1 { family inet { address 10.2.2.5/32; } family iso { address 49.0000.0000.aaaa.0005.00; } } } } policy-options { policy-statement add-noexport { term 1 { then { community add noexport; } } } policy-statement allow-lo0 { term 1 { from interface lo0.1; then accept; } term 2 { then reject; } } policy-statement export-inet3 { term 1 { from rib inet.3; then accept; } term 2 { then reject; } } policy-statement mp-resolv { term 1 { from { route-filter 10.1.1.0/24 orlonger; } then { accept; multipath-resolve; } } term 2 { from { route-filter 10.2.2.0/24 orlonger; } then { accept; multipath-resolve; } } term def { then reject; } } policy-statement nhs { term 1 { from protocol bgp; then { local-preference 200; next-hop self; accept; } } } policy-statement pplb { then { load-balance per-packet; } } policy-statement vrf-export-red { term 1 { then { community add leak2red; accept; } } } policy-statement vrf-import-red { term 1 { from community leak2red; then accept; } } community leak2red members target:100:100; community noexport members [ no-export no-advertise ]; } routing-instances { red { routing-options { multipath preserve-nexthop-hierarchy; protect core; } protocols { bgp { group toCE1 { peer-as 65004; neighbor 192.168.0.2; } } } instance-type vrf; interface ge-0/0/2.0; vrf-import vrf-import-red; vrf-export vrf-export-red; } } routing-options { rib inet.3 { protect core; } route-distinguisher-id 10.2.2.5; forwarding-table { export pplb; } resolution { preserve-nexthop-hierarchy; rib inet.0 { import mp-resolv; } } interface-routes { rib-group inet inet0to3; } router-id 10.2.2.5; autonomous-system 65002; protect core; rib-groups { inet0to3 { import-rib [ inet.0 inet.3 ]; import-policy allow-lo0; } inet3to0 { import-rib [ inet.3 inet.0 ]; import-policy add-noexport; } } } protocols { isis { level 1 disable; interface ge-0/0/3.0; export allow-lo0; topologies ipv6-unicast; } rsvp { interface ge-0/0/3.0; } bgp { path-selection external-router-id; group toAs2RR { type internal; local-address 10.2.2.5; family inet { labeled-unicast { rib-group inet3to0; add-path { receive; send { path-count 4; } } nexthop-resolution { preserve-nexthop-hierarchy; } rib { inet.3; } } } export [ nhs export-inet3 ]; neighbor 10.2.2.6; } group toAs4 { peer-as 65004; neighbor 192.168.0.0; } group toAs1PEs { multihop { no-nexthop-change; } local-address 10.2.2.5; family inet { unicast; } family inet-vpn { unicast; } family inet6 { unicast; } family inet6-vpn { unicast; } export nhs; peer-as 65001; neighbor 10.1.1.1; neighbor 10.1.1.2; } traceoptions { file bgp.log size 100m; flag state detail; flag policy; } multipath; } ldp { interface ge-0/0/3.0; } mpls { label-switched-path toABR1-gold { to 10.2.2.3; } label-switched-path toABR1-bronze { to 10.2.2.3; } label-switched-path toABR2-gold { to 10.2.2.4; } } }
配置 P1 设备
分步过程
下面的示例要求您在各个配置层级中进行导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 P1:
-
配置接口。
[edit interfaces] user@P1#set ge-0/0/1 description P1-to-RR1 user@P1#set ge-0/0/1 vlan-tagging user@P1#set ge-0/0/1 unit 0 vlan-id 100 user@P1#set ge-0/0/1 unit 0 family inet address 192.168.0.6/31 user@P1#set ge-0/0/1 unit 0 family iso user@P1#set ge-0/0/1 unit 0 family mpls user@P1#set ge-0/0/2 description P1-to-ABR1 user@P1#set ge-0/0/2 vlan-tagging user@P1#set ge-0/0/2 unit 0 vlan-id 100 user@P1#set ge-0/0/2 unit 0 family inet address 192.168.0.8/31 user@P1#set ge-0/0/2 unit 0 family iso user@P1#set ge-0/0/2 unit 0 family mpls user@P1#set ge-0/0/3 description P1-to-PE1 user@P1#set ge-0/0/3 vlan-tagging user@P1#set ge-0/0/3 unit 0 vlan-id 100 user@P1#set ge-0/0/3 unit 0 family inet address 192.168.0.5/31 user@P1#set ge-0/0/3 unit 0 family iso user@P1#set ge-0/0/3 unit 0 family mpls user@P1#set ge-0/0/4 description P1-to-ABR2 user@P1#set ge-0/0/4 vlan-tagging user@P1#set ge-0/0/4 unit 0 vlan-id 100 user@P1#set ge-0/0/4 unit 0 family inet address 192.168.0.10/31 user@P1#set ge-0/0/4 unit 0 family iso user@P1#set ge-0/0/4 unit 0 family mpls
-
配置环路接口。
[edit interfaces] user@P1#set lo0 unit 0 family inet address 10.2.2.8/32 user@P1#set lo0 unit 0 family iso address 49.0000.0000.aaaa.0008.00
-
配置多路径解析策略以将分层多路径安装到 PFE 中。
[edit policy-options] user@P1#set policy-statement allow-lo0 term 1 from interface lo0.0 user@P1#set policy-statement allow-lo0 term 1 then accept user@P1#set policy-statement allow-lo0 term 2 then reject
-
配置路由选项。
[edit routing-options] user@P1#set router-id 10.2.2.8
-
在接口上配置 ISIS、RSVP、LDP 和 MPLS 协议。
[edit protocols] user@P1#set isis level 1 disable user@P1#set isis interface all user@P1#set isis export allow-lo0 user@P1#set isis topologies ipv6-unicast user@P1#set rsvp interface all user@P1#set ldp interface all user@P1#set mpls interface all
结果
在配置模式下,输入 show 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-options
show 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-options
show 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-options
show 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-options
show 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-options
show 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
意义
您可以查看权重 0x1
以及 0x4000
主跃点和备份下一跃点。
验证路由表中的下一跃点条目
目的
验证 PE1 上的活动下一跃点路由条目。
操作
在操作模式下,运行 show route extensive expanded-nh
命令。
user@PE1> show route 10.3.3.3 extensive expanded-nh inet.0: 36 destinations, 65 routes (36 active, 0 holddown, 0 hidden) 10.3.3.3/32 (2 entries, 1 announced) Installed-nexthop: List (0xd6ba4b8) Index:1048626 Indr (0xc593cac) 10.1.1.1 Krt_inh (0xcc14684) Index:1048614 List (0xc4cf7b4) Index:1048613 Frr_inh (0xc592730) Index:1048608 Chain (0xc59334c) Index:651 Push 300368 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc592604) Index:1048609 Chain (0xc5924d8) Index:649 Push 300384 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc592154) Index:1048611 Chain (0xc591bdc) Index:654 Push 300368 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 Frr_inh (0xc5921b8) Index:1048612 Chain (0xc591a4c) Index:655 Push 300384 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 Indr (0xc593ab8) 10.1.1.2 Krt_inh (0xcc14f84) Index:1048624 List (0xc4d0074) Index:1048623 Frr_inh (0xc5939f0) Index:1048619 Chain (0xc592ab4) Index:638 Push 300144 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc593a54) Index:1048620 Chain (0xc591efc) Index:637 Push 300160 Router (0xc58ea40) Index:628 192.168.0.5 Push 299808 Frr_inh (0xc59172c) Index:1048589 Chain (0xc5903a4) Index:640 Push 300144 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 Frr_inh (0xc59159c) Index:1048590 Chain (0xc58fa44) Index:639 Push 300160 Router (0xc58ebd0) Index:629 192.168.0.5 Push 299824 TSI: <SNIP> Protocol next hop: 10.1.1.1 Indirect next hop: 0xcc14684 1048614 INH Session ID: 0x146 Weight 0x1 Protocol next hop: 10.1.1.2 Indirect next hop: 0xcc14f84 1048624 INH Session ID: 0x145 Weight 0x4000 State: >Active Ext> Local AS: 65002 Peer AS: 65001 <SNIP> Indirect next hops: 2 Protocol next hop: 10.1.1.1 Metric: 1 Indirect next hop: 0xcc14684 1048614 INH Session ID: 0x146 Weight 0x1 Indirect path forwarding next hops (Merged): 4 <SNIP> Protocol next hop: 10.1.1.2 Metric: 1 Indirect next hop: 0xcc14f84 1048624 INH Session ID: 0x145 Weight 0x4000 Indirect path forwarding next hops (Merged): 4
意义
您可以查看权重 0x1
以及 0x4000
主跃点和备份下一跃点。
面向 BGP L2VPN 和 VPLS 的 FAT 伪线支持概述
伪线是通过 MPLS 分组交换网络 (PSN) 模拟电信服务(如 T1 线路)基本属性的第 2 层电路或服务。伪线旨在仅提供具有给定服务定义所需弹性要求的线线所需的最少必要功能。
在 MPLS 网络中,如 draft-keyupdate-l2vpn-fat-pw-bgp 中所述,伪线流标签的流感知传输 (FAT) 用于跨第 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) 上配置的 BGP 信号伪线(如 L2VPN)支持流感知传输 (FAT) 或流标签。这使得中转路由器或标签交换路由器 (LSR) 能够跨等价多路径路径 (ECMP) 或链路聚合组 (LAG) 执行 MPLS 数据包的负载平衡,而无需对有效负载进行深度数据包检测。FAT 伪线或流标签可用于具有转发等效类(FEC128 和 FEC129)的 LDP 信号 L2VPN,并且对流标签的支持已扩展到用于点对点或点对多点第 2 层服务的 BGP 信号伪线。
在为 BGP L2VPN 配置 FAT 伪线支持以对 MPLS 流量进行负载平衡之前:
配置设备接口并在所有接口上启用 MPLS。
配置 RSVP。
为远程 PE 路由器配置 MPLS 和 LSP。
配置 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 弹出流标签,并在传输到远程 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。
为远程 PE 路由器配置 MPLS 和 LSP。
配置 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) 上配置 VPLS 等 BGP 信号伪线支持的流感知传输 (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 连接信息以及流标签接收和流标签传输信息。
变更历史表
是否支持某项功能取决于您使用的平台和版本。 使用 Feature Explorer 查看您使用的平台是否支持某项功能。
[edit protocols bgp]
。您可以有选择地在某些 BGP 组和邻居上禁用多路径。在[edit protocols bgp group group-name multipath]
层次结构级别包含disable
以禁用组或特定 BGP 邻接方的多路径选项。[edit protocols bgp]
配置defer-initial-multipath-build
。或者,您可以使用层次结构级别的配置语句[edit protocols bgp]
降低 multipath-build-priority
BGP 多路径构建作业优先级,以加快 RIB 学习。