如何在 OSPF 中配置灵活的分段路由算法 流量工程
灵活的算法允许 IGP 单独计算网络上基于约束的路径,从而提供简单的流量工程,而无需使用网络控制器。对于尚未实施具有完整分段路由的控制器,但仍希望在网络中获益的网络来说,这是一款轻量级解决方案。
下一步
有关配置灵活算法的详细信息,请参阅 OSPF 用户指南
了解 OSPF 分段路由的灵活算法
从 Junos OS 21.1R1 版开始,您可以通过定义灵活的算法来根据需求使用不同的参数和链路约束来计算路径,从而对网络进行精简切片。例如,您可以定义一种灵活的算法来计算路径以最小化 IGP 指标,并定义另一种灵活的算法来基于流量工程指标计算路径,从而将网络划分为不同的平面。通过此功能,没有控制器的网络可以使用分段路由配置流量工程,而无需实际实施网络控制器。您可以使用前缀 SID 沿着基于约束的路径引导数据包。您可以通过策略配置,为灵活的算法配置前缀 SID。
IGP 协议使用链路指标来计算最佳路径。但是,对于某些类型的流量,最佳 IGP 路径可能并不总是最佳路径。因此,由于 IGP 指标未反映流量要求,基于最短 IGP 指标计算的 IGP 计算的最佳路径通常会被流量工程路径取代。通常,RSVP-TE 或 SR TE 用于根据附加指标和约束计算路径,以克服这一限制。Junos 会在转发表中安装此类路径,作为 IGP 计算的原始路径的补充或替换。
- 配置灵活算法的好处
- 什么是灵活算法定义 (FAD)?
- 参与灵活的算法
- 配置了灵活算法定义的网络拓扑
- 灵活的算法 RIB
- BGP 社区和灵活的算法
- 支持和不支持的功能
- 基于应用特定链接属性的灵活算法
- 基于严格应用特定链接属性的灵活算法
配置灵活算法的好处
-
分段路由流量工程的轻量级版本,可在网络核心中使用。
-
即使无需安装网络控制器,也可以使用分段路由配置流量工程。
-
每切片利用等价多路径 (ECMP) 和 TI-LFA,无需配置 BGP-LS 或静态路径。
-
使用相同的灵活算法定义和约束计算计算 TI-LFA 备份路径。
-
利用仅使用 OSPFv2 的分段路由流量工程,无需配置 RSVP 或 LDP。
-
能够基于单个标签配置受约束的主路径。
什么是灵活算法定义 (FAD)?
灵活的算法允许 IGP 根据指定的约束计算其他最佳路径,从而提供简单的流量工程,而无需使用网络控制器。对于尚未实施具有完整分段路由的控制器,但仍希望在网络中获益的网络来说,这是一款轻量级解决方案。每个作员都可以根据自己的要求定义单独的约束或颜色。
要定义灵活的算法,请在[edit routing-options]
层次结构级别包含flex-algorithm id
语句。灵活算法定义 (FAD) 分配了一个介于 128 到 255 之间的标识符。这种灵活的算法可以在网络中的一个或多个路由器上定义。灵活的算法会根据以下参数计算最佳路径:
-
Calculation type—SPF 或严格 SPF 是两个可用的计算类型选项。您可以在 FAD 中指定其中一种计算类型。如果要根据特定本地策略(例如流量工程快捷方式)影响设备上的 SPF 计算,请选择 SPF 计算类型。如果选择严格 SPF,则本地策略无法影响 SPF 路径选择。
-
Metric type- IGP 公制或 TE 公制是可用的公制类型选项。您可以根据网络要求在 FAD 中指定其中一种指标类型。如果不想对特定链路使用 IGP 指标,可以配置 OSPFv2 可用于计算路由的 TE 指标。
-
Priority- 您可以根据需要为 FAD 分配优先级,OSPFv2 会根据您分配的优先级将特定 FAD 播发优先于另一个 FAD。
-
Set of Link constraints- 您可以在层次结构级别为许多协议
[edit protocols mpls admin-groups]
配置管理组,以便为单个链接着色。然后,可以在层次结构级别上将这些admin-groups
定义为 或[edit routing-options flex-algorithm definition admin-groups]
include-all
exclude
。include any
建议仅在少数路由器上配置灵活的算法,以提供冗余并避免冲突。灵活的算法定义在 IGP 中公布为 FAD sub-TLVs
。在超大型网络中,我们不建议配置超过 8 个灵活算法定义,因为每个灵活算法都会计算自己的路径,超出这个范围可能会导致性能问题。
默认 FAD 具有以下参数:
-
计算类型:SPF
-
指标类型:IGP-度量
-
优先级:0
-
链路限制:无
在实时网络中或动态修改灵活的算法定义可能会导致流量中断,直到所有节点都汇聚到新路径上。
从 Junos OS 21.4R1 开始,我们支持 TED 中的灵活算法定义 (FAD)“和”灵活算法前缀度量 (FAPM)“,并在 BGP-LS 中实现了两个新的对应 TLV”FAD TLV“和”FAPM TLV“。FAD TLV 的值包含 Flex-Algorithm、Metric-Type、Calculation-Type 和 Priority,每个均为一个字节。TLV 中可能包含零个或多个子 TLV。五个子 tlv 是 Flex 算法排除任何亲和力、Flex 算法包括任何亲和力、Flex 算法包括所有亲和力、Flex 算法定义标志和 Flex 算法排除 SRLG。
只有当相应的节点源自底层 IGP TLV 或子 TLV 时,才能将 FAD TLV 添加到节点 NLRI 的 BGP-LS 属性中。与节点 NLRI 关联的 BGP-LS 属性可能包括一个或多个 FAD TLV,这些 FAD TLV 对应于节点播发的每个算法的灵活算法定义。
FAPM TLV 的值包含 Flex 算法(1 字节)、保留(3 字节)和度量(4 字节)。仅当相应的节点源自前缀时,才能将 FAPM TLV 添加到源自节点的前缀 NLRI 的 BGP-LS 属性中。
从 Junos OS 22.4R1 版开始,我们定义了灵活算法前缀度量 (FAPM),以便为区域间前缀提供最佳的端到端路径。区域边界路由器 (ABR) 在通告给定灵活算法 (flex algo) 中可访问的区域之间的前缀时,必须包括 FAPM。当前缀无法访问时,在区域之间播发时,ABR 不得在该 flex 算法中包含该前缀。定义的 FAPM 提供区域间支持。
参与灵活的算法
您可以根据需要将特定路由器配置为参与特定灵活的算法。各种应用程序使用基于灵活算法定义计算的路径,每个应用程序可能使用自己的特定数据平面来通过此类路径转发数据。参与设备必须向分段路由灵活算法子 TLV for OSPFv2 中的每个应用程序明确播发其参与特定灵活算法的情况。您可以将节点配置为参与某种灵活的算法,前提是它可以支持该 FAD 中指定的约束。
要在灵活的算法中配置参与,请在[edit protocols isis source-packet- routing]
层次结构级别包含flex-algorithm
语句。同一设备可以通告 FAD,也可以参与灵活的算法。
配置了灵活算法定义的网络拓扑
图 1 显示了示例拓扑,有 8 个路由器 R0、R1、R2、R3、R4、R5、R6 和 R7。四种灵活的算法 128、129、130 和 135 被定义并配置了管理组,如下表所示:
Flex 算法定义 (FAD) |
颜色 |
---|---|
128 |
包括任何红色 |
129 |
包括任何绿色 |
130 |
包括任何绿色和蓝色 |
135 |
排除红色 |

图 2 显示了 FAD 128 如何在配置了管理组 red 的任何接口上路由流量。

图 3 显示了 FAD 129 如何在配置了管理组绿色的任何接口上路由流量。

图 4 显示了 FAD 130 如何在配置了管理组绿色和蓝色的任何接口上路由流量。

图 5 显示了 FAD 135 如何在未配置管理组 red 的任何接口上路由流量。

灵活的算法 RIB
对于路由器参与的每个灵活算法,相应的灵活算法路由都会安装在相应的灵活算法 RIB 组(也称为路由表)中。默认情况下,带标签的 OSPFv2 灵活算法路由安装在 inet.color inet(6)color.0
和 mpls.0
RIB 中。
BGP 社区和灵活的算法
灵活的算法可以具有关联的 BGP 颜色社区,用于解析其他服务(如 VPN 服务)的路由。默认情况下,关联的 BGP 颜色社区与灵活算法 ID 相同。安装在 inet(6)color.0 表中的灵活算法入口路由在路由中会有这个颜色社区。但是,您可以在层次结构级别配置不同的 BGP 颜色社区 [edit routing-options flex-algorithm id color desired color community value]
。
将 BGP 颜色社区更改为灵活的算法可能会导致流量中断。如果为灵活的算法修改 BGP 颜色社区,则与该灵活算法相关的所有路由都将从 RIB 中删除,并再次添加新颜色。
支持和不支持的功能
Junos OS 在以下场景中支持灵活的算法:
-
支持为不同的灵活算法配置和播发前缀 SID。
-
部分支持 IGP 灵活算法 draft-ietf-lsr-flex-algo-05.txt互联网草案
- 目前灵活算法的实现仅支持 OSPFv2,因为只有 OSPFv2 支持分段路由。
Junos OS 不支持以下功能与灵活算法结合使用:
-
不支持链路延迟指标。
-
灵活的算法仅适用于默认单播拓扑,不支持 OSPFv2 多拓扑。
- OSPFv2 快捷方式和其他 OSPFv2 流量工程配置选项不适用于灵活的算法计算。.
- OSPFv3 不支持灵活算法的当前实现。
-
不支持灵活算法前缀 SID 的区域间 (OSPFv2) 泄漏。
-
不支持前缀和 SID 冲突解决。
-
不支持远程无环路替代功能,因为 TI-LFA 是首选的 FRR 计算。
-
不支持在没有灵活算法参与的情况下宣传灵活算法定义。
-
不支持使用特定于应用程序的链接属性通告来通告 Flex 算法的链路属性。
-
不支持传输类 RIB。
基于应用特定链接属性的灵活算法
从 Junos OS 和 Junos OS 演化版 22.2R1 版开始,您可以在同一链路上为 RSVP 和灵活算法播发不同的 te 属性,例如 te-metric、delay-metric 或admin-groups。这是使用 RFC 8920 中定义的灵活算法、特定于应用的链路属性来完成的。
让灵活的算法应用程序特定的链接属性通告 te-metric、delay-metric 或 admin-groups 的优点是,单个链接可以为 RSVP 等传统应用程序通告不同的 te-link-属性,为灵活的算法通告不同的 te-link-attributes 。
要配置灵活的算法特定于应用程序的 te 属性,请在[edit protocols ospf area interface]
层次结构级别添加语句,strict-asla-based-flex-algorithm
在层次结构级别包括application-specific
语句[edit protocols ospf source-packet-routing]
。通过此实现,不再强制要求链路启用和[edit protocols ospf traffic-engineering advertisement always]
配置 RSVP,这与广告流量工程属性的现有行为就是这种情况。
特定于应用的链路属性的 Junos OS 和 Junos OS 演化版实现仅支持灵活算法应用。
基于严格应用特定链接属性的灵活算法
特定于应用程序的灵活算法的默认行为是将灵活算法特定于应用程序的 te 属性用于链接(如果可用),如果没有,则回退到通用的特定于应用程序的 te 属性,如果两者都不可用,则使用旧版 te 属性。
中的配置语句strict-asla-based-flex-algorithm
[edit protocols ospf source-packet-routing]
必须应用于网络中设备上运行的所有灵活算法,以避免路由环路。
如果 strict-asla-based-flex-algorithm
在所有设备上都配置了该属性,则必须为每个灵活算法链路播发通用的应用特定于 te 属性或灵活算法的应用特定于 te 属性。如果没有特定于应用的 te 属性,设备不会回退到传统的 te 属性,而只会忽略链路。
作系统支持以下功能以及基于特定于应用程序的链接属性的灵活算法:
-
特定于应用的 te-attribute subTLV,符合 RFC 8920。特定于应用的 te-attributes 子 TLV 是 RFC 7684 中定义的 OSPFv2 扩展链路 TLV 的子 TLV。
-
部分支持标准应用标识符位掩码,以通告 X 位以实现灵活的算法。只有 te-metric、delay-metric 或 admin-groups 才会作为特定于应用程序的链路属性子 TLV 的一部分进行播发。
作系统不支持以下功能与基于应用程序特定链接属性的灵活算法结合使用:
- 不支持播发用户定义的应用程序标识符位掩码。
- 不支持使用 BGP-LS 重新播发灵活的算法、特定于应用的链路属性,或者更确切地说,任何特定于应用的链路属性,因为流量工程数据库 (TED) 不支持特定于应用的链路属性。
-
不支持使用标准应用程序标识符位掩码和用户定义的应用程序标识符位掩码长度设置为零的通用应用程序特定链接属性。
-
不支持在灵活算法中宣传 SRLG 链路约束。
-
除灵活算法外,不支持多种应用的流量工程。
-
不支持定义独立于 MPLS 的管理组。
另见
示例:OSPF 灵活的算法
概述
此示例说明如何在 OSPFv2 网络中配置灵活的算法。灵活的算法允许没有控制器的网络使用分段路由配置流量工程,而无需实际实施网络控制器。
从 Junos OS 21.1R1 版开始,您可以通过定义灵活的算法来根据需求使用不同的参数和链路约束来计算路径,从而对网络进行薄切片。由计算类型、度量类型和一组约束组成的集合称为灵活算法定义 (FAD)。您可以定义 FAD 并在 OSPFv2 网络中进行播发。设备也可以配置为参与某种灵活的算法,前提是它支持该特定 FAD 的约束。
拓扑学
图 6 显示了一个灵活的算法拓扑,其中有 6 个设备 R0、R1、R2、R3、R4 和 R5。在这些设备中的每一个上定义了两种灵活的算法128和129。设备上配置了管理员组红色、蓝色和绿色。在每个设备上定义具有不同参数(如指标类型、计算类型和链路约束)的 FAD。

要求
此示例使用以下硬件和软件组件:
- 六台 MX 系列路由器。
- 在所有设备上运行 Junos OS 21.1R1 或更高版本。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到 [编辑] 层次结构级别的 CLI 中。
设备 R0
set chassis network-services enhanced-ip set interfaces ge-0/0/0 description R0_to_R1_1 set interfaces ge-0/0/0 unit 0 family inet address 10.10.1.1/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description R0_to_R1_2 set interfaces ge-0/0/1 unit 0 family inet address 10.10.1.5/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description R0_to_R3_1 set interfaces ge-0/0/2 unit 0 family inet address 10.10.3.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description R0_to_R3_2 set interfaces ge-0/0/3 unit 0 family inet address 10.10.3.5/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.255.10/32 set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement ex-bgp term 1 from route-filter 10.1.1.0/24 exact set policy-options policy-statement ex-bgp term 1 then community add blue set policy-options policy-statement ex-bgp term 1 then accept set policy-options policy-statement ex-bgp term 0 from route-filter 10.1.0.0/24 exact set policy-options policy-statement ex-bgp term 0 then community add red set policy-options policy-statement ex-bgp term 0 then accept set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.10/32 exact set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1280 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1290 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 130 index 1300 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 130 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 131 index 1310 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 131 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 132 index 1320 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 132 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 133 index 1330 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 133 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 134 index 1340 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 134 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 135 index 1350 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 135 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1000 set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment set policy-options policy-statement prefix-sid term 1001 then accept set policy-options community blue members color:1:129 set policy-options community red members color:0:128 set protocols mpls admin-groups RED 0 set protocols mpls admin-groups BLUE 1 set protocols mpls admin-groups GREEN 2 set protocols mpls label-range static-label-range 1000 8000 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols mpls interface ge-0/0/0.0 admin-group RED set protocols mpls interface ge-0/0/1.0 admin-group GREEN set protocols mpls interface ge-0/0/2.0 admin-group RED set protocols mpls interface ge-0/0/3.0 admin-group GREEN set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5 set protocols ospf backup-spf-options use-source-packet-routing set protocols ospf traffic-engineering advertisement always set protocols ospf source-packet-routing prefix-segment prefix-sid set protocols ospf source-packet-routing srgb start-label 80000 set protocols ospf source-packet-routing srgb index-range 5000 set protocols ospf source-packet-routing flex-algorithm 128 set protocols ospf source-packet-routing flex-algorithm 129 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 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection set routing-options flex-algorithm 128 definition metric-type igp-metric set routing-options flex-algorithm 128 definition spf set routing-options flex-algorithm 128 definition admin-group include-any RED set routing-options flex-algorithm 129 definition metric-type te-metric set routing-options flex-algorithm 129 definition spf set routing-options flex-algorithm 129 definition admin-group include-all BLUE set routing-options router-id 192.168.255.10 set routing-options autonomous-system 65000 set routing-options static route 10.1.1.0/24 receive set routing-options static route 10.1.0.0/24 receive set routing-options forwarding-table export pplb
设备 R1
set chassis network-services enhanced-ip set interfaces ge-0/0/0 description R1_to_R0_1 set interfaces ge-0/0/0 unit 0 family inet address 10.10.1.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description R1_to_R0_2 set interfaces ge-0/0/1 unit 0 family inet address 10.10.1.6/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description R1_to_R2_1 set interfaces ge-0/0/2 unit 0 family inet address 10.10.12.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description R1_to_R2_2 set interfaces ge-0/0/3 unit 0 family inet address 10.10.12.5/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description R1_to_R3 set interfaces ge-0/0/4 unit 0 family inet address 10.10.13.1/30 set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description R1_to_R4 set interfaces ge-0/0/5 unit 0 family inet address 10.10.14.1/30 set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.255.11/32 set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.11/32 exact set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1281 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1291 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1001 set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment set policy-options policy-statement prefix-sid term 1001 then accept set protocols mpls admin-groups RED 0 set protocols mpls admin-groups BLUE 1 set protocols mpls admin-groups GREEN 2 set protocols mpls label-range static-label-range 1000 8000 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols mpls interface ge-0/0/0.0 admin-group RED set protocols mpls interface ge-0/0/1.0 admin-group GREEN set protocols mpls interface ge-0/0/2.0 admin-group RED set protocols mpls interface ge-0/0/3.0 admin-group GREEN set protocols mpls interface ge-0/0/4.0 admin-group BLUE set protocols mpls interface ge-0/0/5.0 admin-group GREEN set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5 set protocols ospf backup-spf-options use-source-packet-routing set protocols ospf traffic-engineering advertisement always set protocols ospf source-packet-routing prefix-segment prefix-sid set protocols ospf source-packet-routing srgb start-label 80000 set protocols ospf source-packet-routing srgb index-range 5000 set protocols ospf source-packet-routing flex-algorithm 128 set protocols ospf source-packet-routing flex-algorithm 129 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-0/0/4.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection set routing-options router-id 192.168.255.11 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb
设备 R2
set chassis network-services enhanced-ip set interfaces ge-0/0/0 description R2_to_R1_1 set interfaces ge-0/0/0 unit 0 family inet address 10.10.12.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description R2_to_R1_2 set interfaces ge-0/0/1 unit 0 family inet address 10.10.12.6/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description R2_to_R3 set interfaces ge-0/0/2 unit 0 family inet address 10.10.23.1/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description R2_to_R4 set interfaces ge-0/0/3 unit 0 family inet address 10.10.24.1/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description R2_to_R5_1 set interfaces ge-0/0/4 unit 0 family inet address 10.10.25.1/30 set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description R2_to_R5_2 set interfaces ge-0/0/5 unit 0 family inet address 10.10.25.5/30 set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.255.12/32 set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.12/32 exact set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1282 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1292 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1002 set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment set policy-options policy-statement prefix-sid term 1001 then accept set protocols mpls admin-groups RED 0 set protocols mpls admin-groups BLUE 1 set protocols mpls admin-groups GREEN 2 set protocols mpls label-range static-label-range 1000 8000 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols mpls interface ge-0/0/0.0 admin-group RED set protocols mpls interface ge-0/0/1.0 admin-group GREEN set protocols mpls interface ge-0/0/2.0 admin-group RED set protocols mpls interface ge-0/0/3.0 admin-group BLUE set protocols mpls interface ge-0/0/4.0 admin-group RED set protocols mpls interface ge-0/0/5.0 admin-group GREEN set protocols mpls interface ge-0/0/5.0 admin-group BLUE set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5 set protocols ospf backup-spf-options use-source-packet-routing set protocols ospf traffic-engineering advertisement always set protocols ospf source-packet-routing prefix-segment prefix-sid set protocols ospf source-packet-routing srgb start-label 80000 set protocols ospf source-packet-routing srgb index-range 5000 set protocols ospf source-packet-routing flex-algorithm 128 set protocols ospf source-packet-routing flex-algorithm 129 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 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/4.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 post-convergence-lfa node-protection set routing-options router-id 192.168.255.12 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb
设备 R3
set chassis network-services enhanced-ip set interfaces ge-0/0/0 description R3_to_R0_1 set interfaces ge-0/0/0 unit 0 family inet address 10.10.3.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description R3_to_R0_2 set interfaces ge-0/0/1 unit 0 family inet address 10.10.3.6/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description R3_to_R1 set interfaces ge-0/0/2 unit 0 family inet address 10.10.13.2/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description R3_to_R2 set interfaces ge-0/0/3 unit 0 family inet address 10.10.23.2/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description R3_to_R4_1 set interfaces ge-0/0/4 unit 0 family inet address 10.10.34.1/30 set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description R3_to_R4_2 set interfaces ge-0/0/5 unit 0 family inet address 10.10.34.5/30 set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.255.13/32 set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.13/32 exact set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1284 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1294 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1003 set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment set policy-options policy-statement prefix-sid term 1001 then accept set protocols mpls admin-groups RED 0 set protocols mpls admin-groups BLUE 1 set protocols mpls admin-groups GREEN 2 set protocols mpls label-range static-label-range 1000 8000 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols mpls interface ge-0/0/0.0 admin-group RED set protocols mpls interface ge-0/0/1.0 admin-group GREEN set protocols mpls interface ge-0/0/2.0 admin-group BLUE set protocols mpls interface ge-0/0/3.0 admin-group RED set protocols mpls interface ge-0/0/4.0 admin-group RED set protocols mpls interface ge-0/0/5.0 admin-group BLUE set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5 set protocols ospf backup-spf-options use-source-packet-routing set protocols ospf traffic-engineering advertisement always set protocols ospf source-packet-routing prefix-segment prefix-sid set protocols ospf source-packet-routing srgb start-label 80000 set protocols ospf source-packet-routing srgb index-range 5000 set protocols ospf source-packet-routing flex-algorithm 128 set protocols ospf source-packet-routing flex-algorithm 129 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 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/4.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 post-convergence-lfa node-protection set routing-options router-id 192.168.255.13 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb
设备 R4
set chassis network-services enhanced-ip set interfaces ge-0/0/0 description R4_to_R1 set interfaces ge-0/0/0 unit 0 family inet address 10.10.14.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description R4_to_R2 set interfaces ge-0/0/1 unit 0 family inet address 10.10.24.2/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description R4_to_R3_1 set interfaces ge-0/0/2 unit 0 family inet address 10.10.34.2/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description R4_to_R3_2 set interfaces ge-0/0/3 unit 0 family inet address 10.10.34.6/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces ge-0/0/4 description R4_to_R5_1 set interfaces ge-0/0/4 unit 0 family inet address 10.10.45.1/30 set interfaces ge-0/0/4 unit 0 family mpls set interfaces ge-0/0/5 description R4_to_R5_2 set interfaces ge-0/0/5 unit 0 family inet address 10.10.45.5/30 set interfaces ge-0/0/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.255.14/32 set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.14/32 exact set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1284 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1294 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1004 set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment set policy-options policy-statement prefix-sid term 1001 then accept set protocols mpls admin-groups RED 0 set protocols mpls admin-groups BLUE 1 set protocols mpls admin-groups GREEN 2 set protocols mpls label-range static-label-range 1000 8000 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols mpls interface ge-0/0/2.0 admin-group RED set protocols mpls interface ge-0/0/3.0 admin-group BLUE set protocols mpls interface ge-0/0/0.0 admin-group GREEN set protocols mpls interface ge-0/0/1.0 admin-group BLUE set protocols mpls interface ge-0/0/4.0 admin-group GREEN set protocols mpls interface ge-0/0/5.0 admin-group RED set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5 set protocols ospf backup-spf-options use-source-packet-routing set protocols ospf traffic-engineering advertisement always set protocols ospf source-packet-routing prefix-segment prefix-sid set protocols ospf source-packet-routing srgb start-label 80000 set protocols ospf source-packet-routing srgb index-range 5000 set protocols ospf source-packet-routing flex-algorithm 128 set protocols ospf source-packet-routing flex-algorithm 129 set protocols ospf area 0.0.0.0 interface lo0.0 passive set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/4.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 post-convergence-lfa node-protection set routing-options router-id 192.168.255.14 set routing-options autonomous-system 65000 set routing-options forwarding-table export pplb
设备 R5
set chassis network-services enhanced-ip set interfaces ge-0/0/0 description R5_to_R2_1 set interfaces ge-0/0/0 unit 0 family inet address 10.10.25.2/30 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/1 description R5_to_R2_2 set interfaces ge-0/0/1 unit 0 family inet address 10.10.25.6/30 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/2 description R5_to_R4_1 set interfaces ge-0/0/2 unit 0 family inet address 10.10.45.2/30 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/0/3 description R5_to_R4_2 set interfaces ge-0/0/3 unit 0 family inet address 10.10.45.6/30 set interfaces ge-0/0/3 unit 0 family mpls set interfaces lo0 unit 0 family inet address 192.168.255.15/32 set policy-options policy-statement pplb then load-balance per-packet set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.15/32 exact set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1285 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1295 set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1005 set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment set policy-options policy-statement prefix-sid term 1001 then accept set protocols mpls admin-groups RED 0 set protocols mpls admin-groups BLUE 1 set protocols mpls admin-groups GREEN 2 set protocols mpls label-range static-label-range 1000 8000 set protocols mpls interface all set protocols mpls interface fxp0.0 disable set protocols mpls interface ge-0/0/0.0 admin-group RED set protocols mpls interface ge-0/0/1.0 admin-group GREEN set protocols mpls interface ge-0/0/1.0 admin-group BLUE set protocols mpls interface ge-0/0/2.0 admin-group GREEN set protocols mpls interface ge-0/0/3.0 admin-group RED set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5 set protocols ospf backup-spf-options use-source-packet-routing set protocols ospf traffic-engineering advertisement always set protocols ospf source-packet-routing prefix-segment prefix-sid set protocols ospf source-packet-routing srgb start-label 80000 set protocols ospf source-packet-routing srgb index-range 5000 set protocols ospf source-packet-routing flex-algorithm 128 set protocols ospf source-packet-routing flex-algorithm 129 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 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection set routing-options router-id 192.168.255.15 set routing-options autonomous-system 65000 set routing-options static route 10.1.15.0/24 reject set routing-options forwarding-table export pplb
配置设备 R0
要为 OSPFv2 配置灵活算法,请在设备 R0 上执行以下步骤:
-
配置设备接口以启用 IP 传输。
[edit] user@R0set interfaces ge-0/0/0 description R0_to_R1_1 user@R0set interfaces ge-0/0/0 unit 0 family inet address 10.10.1.1/30 user@R0set interfaces ge-0/0/0 unit 0 family mpls user@R0set interfaces ge-0/0/1 description R0_to_R1_2 user@R0set interfaces ge-0/0/1 unit 0 family inet address 10.10.1.5/30 user@R0set interfaces ge-0/0/1 unit 0 family mpls user@R0set interfaces ge-0/0/2 description R0_to_R3_1 user@R0set interfaces ge-0/0/2 unit 0 family inet address 10.10.3.1/30 user@R0set interfaces ge-0/0/2 unit 0 family mpls user@R0set interfaces ge-0/0/3 description R0_to_R3_2 user@R0set interfaces ge-0/0/3 unit 0 family inet address 10.10.3.5/30 user@R0set interfaces ge-0/0/3 unit 0 family mpls
-
配置环路接口 (lo0) 地址,用作 OSPF 会话的路由器 ID。
[edit] user@R0set interfaces lo0 unit 0 family inet address 192.168.255.10/32
-
配置路由器 ID 和自治系统 (AS) 编号,以便在属于同一 AS 的一组路由设备中传播路由信息。
[edit] user@R0set routing-options router-id 192.168.255.10 user@R0set routing-options autonomous-system 65000
-
定义一个策略来对数据包进行负载平衡,并应用每个数据包的策略来启用流量的负载平衡。
[edit] user@R0set policy-options policy-statement pplb then load-balance per-packet user@R0set routing-options forwarding-table export pplb
-
配置路由策略术语的路由过滤器,使设备 R0 能够访问 192.168.255.10/32 网络。
[edit] user@R0set policy-options policy-statement prefix-sid term 1001 from route-filter 192.168.255.10/32 exact
- 在所有接口上配置 MPLS,管理接口除外。
[edit] user@R0set protocols mpls interface all user@R0set protocols mpls interface fxp0.0 disable
-
配置 MPLS 标签范围以为链路分配静态标签。
[edit] user@R0set protocols mpls label-range static-label-range 1000 8000
-
配置 TI-LFA 以启用链路和节点故障防护。如果主路径出现故障或变得不可用,使用 TI-LFA 的 SR 会立即将流量路由到备份路径或备用路径,从而更快地恢复网络连接。
[edit] user@R0set protocols ospf backup-spf-options use-source-packet-routing
-
为分段路由路由路径配置最大标签数,以保护备份最短路径优先属性。
[edit] user@R0set protocols ospf backup-spf-options use-post-convergence-lfa maximum-labels 5
-
在 SPRING 中为 OSPF 协议的分段路由全局块 (SRGB) 配置前缀分段属性、起始标签和索引范围。
[edit] user@R0set protocols ospf source-packet-routing prefix-segment prefix-sid user@R0set protocols ospf source-packet-routing srgb start-label 80000 user@R0set protocols ospf source-packet-routing srgb index-range 5000
-
在遵循后融合路径的 OSPF 接口上启用节点链路保护。
[edit] user@R0set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 post-convergence-lfa node-protection user@R0set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 post-convergence-lfa node-protection user@R0set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 post-convergence-lfa node-protection user@R0set protocols ospf area 0.0.0.0 interface ge-0/0/3.0 post-convergence-lfa node-protection
-
将环路接口配置为被动接口,以确保协议不会在环路接口上运行,并确保环路接口在整个网络中正确播发。
[edit] user@R0set protocols ospf area 0.0.0.0 interface lo0.0 passive
-
在设备 R0 上定义灵活的算法。为每个 FAD 分配一个名称,范围从 128 到 255。
[edit] user@R0set routing-options flex-algorithm 128 user@R0set routing-options flex-algorithm 129
指定定义的参数。OSPFv2 根据 FAD 的这些指定参数计算路径。
-
指定 OSPFv2 协议计算路径所依据的计算类型。
[edit] user@R0set routing-options flex-algorithm 128 definition spf user@R0set routing-options flex-algorithm 128 definition spf
-
指定 OSPFv2 计算路径所依据的指标类型。
[edit] user@R0set routing-options flex-algorithm 128 definition metric-type igp-metric user@R0set routing-options flex-algorithm 129 definition metric-type te-metric
-
如果启用了 RSVP 流量工程,则可以为多个协议配置管理组,以便为单个链路着色。
[edit] user@R0set protocols mpls admin-groups RED 0 user@R0set protocols mpls admin-groups BLUE 1 user@R0set protocols mpls admin-groups GREEN 2
-
将配置的管理员组策略分配给设备 R0 接口。
[edit] user@R0set protocols mpls interface ge-0/0/0.0 admin-group RED user@R0set protocols mpls interface ge-0/0/1.0 admin-group GREEN user@R0set protocols mpls interface ge-0/0/2.0 admin-group RED user@R0set protocols mpls interface ge-0/0/3.0 admin-group GREEN
-
根据您的要求定义管理员组。
[edit] user@R0set routing-options flex-algorithm 128 definition admin-group include-any RED user@R0set routing-options flex-algorithm 129 definition admin-group include-all GREEN user@R0set routing-options flex-algorithm 129 definition admin-group include-all BLUE
注意:要使具有链路约束的 FAD 正常工作,所有相关链路都应在 OSPFv2 中播发管理颜色。您必须在接口上启用 RSVP,或者如果尚未配置流量工程 RSVP,请确保始终在
[edit protocols ospf]
层次结构级别配置 set traffic-engineering advertise 。[edit] user@R0set protocols ospf traffic-engineering advertisement always
-
- 在设备 R0 上配置灵活的算法参与。同一设备可以通告 FAD,也可以参与灵活的算法。
[edit] user@R0set protocols ospf source-packet-routing flex-algorithm 128 user@R0set protocols ospf source-packet-routing flex-algorithm 129
-
通过策略配置播发前缀分段。
[edit] user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 index 1280 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 128 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 index 1290 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 129 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 130 index 1300 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 130 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 131 index 1310 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 131 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 132 index 1320 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 132 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 133 index 1330 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 133 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 134 index 1340 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 134 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 135 index 1350 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment algorithm 135 node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment index 1000 user@R0set policy-options policy-statement prefix-sid term 1001 then prefix-segment node-segment user@R0set policy-options policy-statement prefix-sid term 1001 then accept
结果
检查配置结果:
在配置模式下,输入、show interfaces
show routing-options
show protocols
和show policy-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
interfaces { ge-0/0/0 { description R0_to_R1_1; unit 0 { family inet { address 10.10.1.1/30; } family mpls; } } ge-0/0/1 { description R0_to_R1_2 unit 0 { family inet { address 10.10.1.5/30; } family mpls; } } ge-0/0/2 { description R0_to_R3_1 unit 0 { family inet { address 10.10.3.1/30; } family mpls; } } ge-0/0/3 { description R0_to_R3_2 unit 0 { family inet { address 10.10.3.5/30; } family mpls; } } lo0 { unit 0 { family inet { address 192.168.255.10/32; } } } } policy-options { policy-statement pplb { then { load-balance per-packet; } } policy-statement prefix-sid { term 1001 { from { route-filter 192.168.255.10/32 exact; } then { prefix-segment { algorithm 128 index 1280 node-segment; algorithm 129 index 1290 node-segment; algorithm 130 index 1300 node-segment; algorithm 131 index 1310 node-segment; algorithm 132 index 1320 node-segment; algorithm 133 index 1330 node-segment; algorithm 134 index 1340 node-segment; algorithm 135 index 1350 node-segment; index 1000; node-segment; } accept; } } } } protocols { mpls { admin-groups { RED 0; BLUE 1; GREEN 2; } label-range { static-label-range 1000 8000; } interface all; interface fxp0.0 { disable; } interface ge-0/0/0.0 { admin-group RED; } interface ge-0/0/1.0 { admin-group GREEN; } interface ge-0/0/2.0 { admin-group RED; } interface ge-0/0/3.0 { admin-group GREEN; } } ospf { backup-spf-options { use-post-convergence-lfa maximum-labels 5; use-source-packet-routing; } traffic-engineering { advertisement always; } source-packet-routing { prefix-segment prefix-sid; srgb start-label 80000 index-range 5000; flex-algorithm [ 128 129 ]; } area 0.0.0.0 { interface lo0.0 { passive; } interface ge-0/0/0.0 { post-convergence-lfa { node-protection; } } interface ge-0/0/1.0 { post-convergence-lfa { node-protection; } } interface ge-0/0/2.0 { post-convergence-lfa { node-protection; } } interface ge-0/0/3.0 { post-convergence-lfa { node-protection; } } } } } routing-options { flex-algorithm 128 { definition { metric-type igp-metric; spf; admin-group include-any RED; } } flex-algorithm 129 { definition { metric-type te-metric; spf; admin-group include-all [ GREEN BLUE ]; } } router-id 192.168.255.10; autonomous-system 65000; forwarding-table { export pplb; } }
验证
要确认配置工作正常,请执行以下任务:
验证 OSPF 数据库
目的
验证灵活的算法信令是否显示在 OSPF 数据库中。
行动
在作模式下,运行 show ospf database opaque-area extensive
命令。
在 R0 上
user@R0>show ospf database opaque-area extensive OpaqArea 4.0.0.0 192.168.255.10 0x800000ad 503 0x22 0xb85d 76 Opaque LSA SR-Algorithm (8), length 3: Algo (1), length 1: 0 Algo (2), length 1: 128 Algo (3), length 1: 129 SID/Label Range (9), length 12: Range Size (1), length 3: 5000 SID/Label (1), length 3: Label (1), length 3: 80000 Flex-Algorithm Definition (16), length 12: Flex-Algo (1), length 1: 128 Metric-Type (2), length 1: 0 Calc-Type (3), length 1: 0 Priority (4), length 1: 0 FAD AG Include Any (2), length 4: Include Any AG (1), length 4: 0x1 Flex-Algorithm Definition (16), length 12: Flex-Algo (1), length 1: 129 Metric-Type (2), length 1: 2 Calc-Type (3), length 1: 0 Priority (4), length 1: 0 FAD AG Include All (3), length 4: Include All AG (1), length 4: 0x6 Aging timer 00:51:37 Installed 00:08:20 ago, expires in 00:51:37, sent 00:08:18 ago Last changed 5d 13:35:52 ago, Change count:
意义
R0 上的此输出说明:
此设备播发三种分段路由算法(包括两种灵活算法)。
此设备播发两个 FAD。
验证灵活的算法详细信息
目的
验证是否显示了灵活的算法详细信息。
行动
在作模式下,运行 show ospf spring flex-algorithm <flex-algorithm-id>
命令。
在 R0 上
user@R0>show ospf spring flex-algorithm 128 Flex Algo: 128, Area: 0.0.0.0 Color: 128, Participating, FAD supported Winner: 192.168.255.10, Metric: 0, Calc: 0, Prio: 0, inc-any: 0x1, FAD supported Include-Any: 0x1 RED SPF Version: 296 Participation toggles: 1 Topo refresh count: 0 Full SPFs: 296, Partial SPFs: 0
意义
将显示在 R0 上配置的灵活算法详细信息。
验证特定于灵活算法的 OSPF 内部路由
目的
验证是否显示了特定于灵活算法的 OSPF 内部路由。
行动
在作模式下,运行 show ospf route flex-algorithm <flex-algorithm-id>
命令。
在 R0 上
user@R0>show ospf route flex-algorithm 128 Prefix Path Route NH Metric NextHop Nexthop Type Type Type Interface Address/LSP 192.168.255.11 Intra Router IP 1 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 192.168.255.12 Intra Router IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.13 Intra Router IP 1 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.14 Intra Router IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.15 Intra Router IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.1.0/30 Intra Network IP 1 ge-0/0/0.0 10.10.1.4/30 Intra Network IP 1 ge-0/0/1.0 10.10.3.0/30 Intra Network IP 1 ge-0/0/2.0 10.10.3.4/30 Intra Network IP 1 ge-0/0/3.0 10.10.12.0/30 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 10.10.12.4/30 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 10.10.13.0/30 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.14.0/30 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 10.10.23.0/30 Intra Network IP 2 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.24.0/30 Intra Network IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.25.0/30 Intra Network IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.25.4/30 Intra Network IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.34.0/30 Intra Network IP 2 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.34.4/30 Intra Network IP 2 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.45.0/30 Intra Network IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 10.10.45.4/30 Intra Network IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 128.49.106.245/32 Intra Network IP 1 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 128.49.107.40/32 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.10/32 Intra Network IP 0 lo0.0 192.168.255.10/32 Intra Network Spring 0 lo0.0 192.168.255.11/32 Intra Network IP 1 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 192.168.255.11/32 Intra Network Spring 1 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 192.168.255.12/32 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.12/32 Intra Network Spring 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.13/32 Intra Network IP 1 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.13/32 Intra Network Spring 1 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.14/32 Intra Network IP 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.14/32 Intra Network Spring 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.15/32 Intra Network IP 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 192.168.255.15/32 Intra Network Spring 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 16 Intra Network Mpls 0 ge-0/0/0.0 10.10.1.2 Bkup MPLS ge-0/0/1.0 10.10.1.6 16 (S=0) Intra Network Mpls 0 ge-0/0/0.0 10.10.1.2 Bkup MPLS ge-0/0/1.0 10.10.1.6 17 Intra Network Mpls 0 ge-0/0/1.0 10.10.1.6 Bkup MPLS ge-0/0/0.0 10.10.1.2 17 (S=0) Intra Network Mpls 0 ge-0/0/1.0 10.10.1.6 Bkup MPLS ge-0/0/0.0 10.10.1.2 20 Intra Network Mpls 0 ge-0/0/2.0 10.10.3.2 Bkup MPLS ge-0/0/3.0 10.10.3.6 20 (S=0) Intra Network Mpls 0 ge-0/0/2.0 10.10.3.2 Bkup MPLS ge-0/0/3.0 10.10.3.6 21 Intra Network Mpls 0 ge-0/0/3.0 10.10.3.6 Bkup MPLS ge-0/0/2.0 10.10.3.2 21 (S=0) Intra Network Mpls 0 ge-0/0/3.0 10.10.3.6 Bkup MPLS ge-0/0/2.0 10.10.3.2 81001 Intra Network Mpls 1 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 81001 (S=0) Intra Network Mpls 1 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 81003 Intra Network Mpls 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 81004 Intra Network Mpls 1 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 81004 (S=0) Intra Network Mpls 1 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 81006 Intra Network Mpls 2 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6 81007 Intra Network Mpls 3 ge-0/0/0.0 10.10.1.2 ge-0/0/1.0 10.10.1.6 ge-0/0/2.0 10.10.3.2 ge-0/0/3.0 10.10.3.6
意义
该 show ospf route
命令通过选项进行了扩展 flex-algorithm
,可显示特定于算法的灵活 OSPF 内部路由。每条路由都以 flex-algo-id 为前缀:
验证 Flex 着色路由
目的
验证是否显示了特定于灵活算法的 OSPF 内部路由。
行动
在作模式下,运行 show route protocol ospf
命令。
在 R0 上
user@R0>show route protocol ospf inetcolor.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192.168.255.11-128<c>/64 *[L-OSPF/10/5] 1w2d 01:23:04, metric 1 > to 10.10.1.2 via ge-0/0/0.0 to 10.10.3.2 via ge-0/0/2.0, Push 81281, Push 81283(top) 192.168.255.12-128<c>/64 *[L-OSPF/10/5] 1w2d 01:23:04, metric 2 to 10.10.1.2 via ge-0/0/0.0, Push 81283 > to 10.10.3.2 via ge-0/0/2.0, Push 81283 192.168.255.13-128<c>/64 *[L-OSPF/10/5] 1w2d 01:23:04, metric 1 > to 10.10.3.2 via ge-0/0/2.0 to 10.10.1.2 via ge-0/0/0.0, Push 81284, Push 81283(top) 192.168.255.14-128<c>/64 *[L-OSPF/10/5] 1w2d 01:23:04, metric 2 > to 10.10.3.2 via ge-0/0/2.0, Push 81286 to 10.10.1.2 via ge-0/0/0.0, Push 81286, Push 81283(top) 192.168.255.15-128<c>/64 *[L-OSPF/10/5] 1w2d 01:23:04, metric 3 to 10.10.1.2 via ge-0/0/0.0, Push 81287 > to 10.10.3.2 via ge-0/0/2.0, Push 81287
意义
输出以以下格式显示在 inetcolor.0 表中编程的所有彩色 flex 路由:prefix_address-flex-algo-id<c>/64
验证 OSPF 日志
目的
验证 OSPF 日志是否显示 flexible algorithm 关键字。
行动
在作模式下,运行 show ospf log
命令。
在 R0 上
user@R0>show ospf log Topology default SPF log: Last instance of each event type When Type Elapsed 1w2d 13:59:18 SPF 0.000316 1w2d 13:59:18 Stub 0.000233 1w2d 13:59:18 Interarea 0.000002 1w2d 13:59:18 External 0.000004 1w2d 13:59:18 NSSA 0.000001 1w2d 13:59:18 Cleanup 0.000551 Maximum length of each event type When Type Elapsed 1w2d 14:34:27 SPF 0.000997 1w2d 15:59:35 Stub 0.000675 1w3d 07:08:27 Interarea 0.000010 1w3d 07:29:07 External 0.000013 1w3d 07:15:21 NSSA 0.000008 1w3d 08:38:05 Cleanup 0.001044 Last 100 events When Type Elapsed 1w2d 14:08:36 FlexAlgo SPF 0.000680 1w2d 14:08:36 SPF 0.000204 1w2d 14:08:36 Stub 0.000025 1w2d 14:08:36 Interarea 0.000003 1w2d 14:08:36 External 0.000002 1w2d 14:08:36 NSSA 0.000001 1w2d 14:08:36 Prefix SID 0.000222 1w2d 14:08:36 Adj SID 0.000074 1w2d 14:08:36 Cleanup 0.000607 1w2d 14:08:36 Total 0.001209 1w2d 14:08:31 SPF 0.000188 1w2d 14:08:31 Stub 0.000054 1w2d 14:08:31 Interarea 0.000002 1w2d 14:08:31 External 0.000001 1w2d 14:08:31 NSSA 0.000001 1w2d 14:08:31 Prefix SID 0.000181 1w2d 14:08:31 Adj SID 0.000178 1w2d 14:08:31 Cleanup 0.000413 1w2d 14:08:31 Total 0.001656 1w2d 14:06:54 FlexAlgo SPF 0.001914 1w2d 14:06:54 FlexAlgo SPF 0.000081 1w2d 14:06:54 SPF 0.000215 1w2d 14:06:54 Stub 0.000030 1w2d 14:06:54 Interarea 0.000003 1w2d 14:06:54 External 0.000001 1w2d 14:06:54 NSSA 0.000001 1w2d 14:06:54 Prefix SID 0.000227 1w2d 14:06:54 Adj SID 0.000075 1w2d 14:06:54 Cleanup 0.000233 1w2d 14:06:54 Total 0.000859 1w2d 14:06:49 SPF 0.000234 1w2d 14:06:49 Stub 0.000072 1w2d 14:06:49 Interarea 0.000003 1w2d 14:06:49 External 0.000002 1w2d 14:06:49 NSSA 0 1w2d 14:06:49 Prefix SID 0.000262 1w2d 14:06:49 Adj SID 0.000254 1w2d 14:06:49 Cleanup 0.000495 1w2d 14:06:49 Total 0.001936 1w2d 14:06:30 FlexAlgo SPF 0.001356 1w2d 14:06:30 FlexAlgo SPF 0.000061 1w2d 14:06:30 SPF 0.000207 1w2d 14:06:30 Stub 0.000023 1w2d 14:06:30 Interarea 0.000003 1w2d 14:06:30 External 0.000002 1w2d 14:06:30 NSSA 0.000001 1w2d 14:06:30 Prefix SID 0.000237 1w2d 14:06:30 Adj SID 0.000087 1w2d 14:06:30 Cleanup 0.000430 1w2d 14:06:30 Total 0.001060 1w2d 14:06:25 SPF 0.000207 1w2d 14:06:25 Stub 0.000077 1w2d 14:06:25 Interarea 0.000002 1w2d 14:06:25 External 0.000002 1w2d 14:06:25 NSSA 0.000001 1w2d 14:06:25 Prefix SID 0.000250 1w2d 14:06:25 Adj SID 0.000245 1w2d 14:06:25 Cleanup 0.000399 1w2d 14:06:25 Total 0.001840 1w2d 14:05:56 FlexAlgo SPF 0.001781 1w2d 14:05:56 FlexAlgo SPF 0.000080 1w2d 14:05:55 SPF 0.000215 1w2d 14:05:55 Stub 0.000025 1w2d 14:05:55 Interarea 0.000002 1w2d 14:05:55 External 0.000001 1w2d 14:05:55 NSSA 0.000001 1w2d 14:05:55 Prefix SID 0.000240 1w2d 14:05:55 Adj SID 0.000073 1w2d 14:05:55 Cleanup 0.000422 1w2d 14:05:55 Total 0.001055 1w2d 14:05:50 SPF 0.000212 1w2d 14:05:50 Stub 0.000082 1w2d 14:05:50 Interarea 0.000003 1w2d 14:05:50 External 0.000001 1w2d 14:05:50 NSSA 0.000001 1w2d 14:05:50 Prefix SID 0.000264 1w2d 14:05:50 Adj SID 0.000239 1w2d 14:05:50 Cleanup 0.000458 1w2d 14:05:50 Total 0.002053 1w2d 13:59:23 FlexAlgo SPF 0.001603 1w2d 13:59:23 FlexAlgo SPF 0.000062 1w2d 13:59:23 SPF 0.000224 1w2d 13:59:23 Stub 0.000021 1w2d 13:59:23 Interarea 0.000002 1w2d 13:59:23 External 0.000001 1w2d 13:59:23 NSSA 0.000001 1w2d 13:59:23 Prefix SID 0.000222 1w2d 13:59:23 Adj SID 0.000087 1w2d 13:59:23 Cleanup 0.000413 1w2d 13:59:23 Total 0.001228 1w2d 13:59:18 SPF 0.000316 1w2d 13:59:18 Stub 0.000233 1w2d 13:59:18 Interarea 0.000002 1w2d 13:59:18 External 0.000004 1w2d 13:59:18 NSSA 0.000001 1w2d 13:59:18 Prefix SID 0.000324 1w2d 13:59:18 Adj SID 0.000318 1w2d 13:59:18 Cleanup 0.000551 1w2d 13:59:18 Total 0.002751
意义
输出显示为 SPF 日志添加的 FlexAlgo 关键字。