配置 OSPF 路由策略
了解路由策略
对于某些路由平台供应商,路由流发生在各种协议之间。例如,如果想要配置从 RIP 到 OSPF 的重新分配,RIP 进程会通知 OSPF 进程,它可能包含用于重新分配的路由。在 Junos OS 中,路由协议之间没有太多直接的交互。相反,所有协议都安装路由信息的中央收集点。这些是主要的单播路由表 inet.0 和 inet6.0。
路由协议从这些表中计算到每个目标的最佳路由,并将这些路由放置在一个转发表表中。然后,这些路由用于将路由协议流量转发至目标,并可以将这些流量播发至邻接方。
导入和导出路由
导入和导出这两个术语解释了路由如何在路由协议和路由表之间移动。
当路由引擎将路由协议的路由放入路由表中时,它将路由 导入 路由表中。
当路由引擎使用路由表中的活动路由发送协议播发时,它会 导出 来自路由表的路由。
注意:始终从路由表的角度介绍在路由协议和路由 表之间移动路由的过程。也就是说,路由将从路由协议 导入路由 表中,然后从路由表 导出 到路由协议。在处理路由策略时,请记住这一区别。
如图 1 所示,您可以使用导入路由策略来控制将哪些路由放置在路由表中,并导出路由策略来控制哪些路由将从路由表播发至邻接方。

通常,路由协议将其所有路由置于路由表中,并从路由表中播发有限组路由。处理路由协议和路由表之间的路由信息的常规规则称为 路由策略框架。
路由策略框架由每个路由协议的默认规则组成,用于确定哪些路由协议在路由表中的位置,并从路由表播发。每个路由协议的默认规则称为 默认路由策略。
您可以创建路由策略以先于始终存在的默认策略。 路由策略 允许您根据自己的需求修改路由策略框架。您可以创建并实施自己的路由策略,以请执行以下操作:
控制路由协议在路由表中的哪个路由。
控制从路由表中播发路由协议哪个活动路由。 活动路由 是从路由表中的所有路由中选择的一个路由,以到达目标。
当路由协议将路由置于路由表中或从路由表中播发路由时,操作路由特征。
您可以操控路由特征,以控制选择哪个路由作为活动路由才能到达目标。活动路由被放置在转发表中,用于将流量转发至路由的目标。通常,活动路由也会播发给路由器的邻接方。
主动和不活动路由
当路由表中某个目标的多个路由时,协议会选择一个活动路由,并将该路由放置在相应的路由表中。对于等价路由,Junos OS 在相应的路由表中放置了多个下一跃点。
当协议从路由表导出路由时,只会导出活动路由。这适用于默认和用户定义的导出策略指定的操作。
评估要导出的路由时,路由引擎仅使用路由表中的活动路由。例如,如果路由表包含到同一目标的多个路由,而一个路由具有首选指标,则只会评估该路由。换言之,导出策略不会评估所有路由;它只会评估路由协议允许向邻接方播发的路由。
默认情况下,BGP 播发活动路由。但是,您可以将 BGP 配置为播发 非活动路由,这些路由与其他路由转到同一目标,但指标不太可取。
显式配置的路由
显式配置的路由就是您配置的路由。未显式配置直接路由。这些地址是由于接口上配置了 IP 地址而创建的。显式配置的路由包括聚合、生成的、本地和静态路由。(聚合路由是指将具有通用地址的路由组提取到一个路由中的路由。当路由表未提供有关如何到达特定目标的信息时,生成的路由。本地路由是分配给路由器接口的 IP 地址。静态路由是到达目标的不变路由。)
策略框架软件将直接和显式配置的路由视为通过路由协议学习;因此,可以将它们导入路由表中路由不能从路由表导出到伪协议,因为此协议不是真正的路由协议。但是,聚合、直接、生成的和静态的路由可以从路由表导出到路由协议,而本地路由则不能。
动态数据库
在 Junos OS 9.5 及更高版本中,您可以在不受标准配置数据库要求的相同验证的动态数据库中配置路由策略和某些路由策略对象。因此,您可以快速提交这些路由策略和策略对象,这些对象可根据需要在标准配置中引用和应用。BGP 是可应用引用动态数据库中配置策略的路由策略的唯一协议。在标准配置中配置中配置并提交基于动态数据库的路由策略后,可以通过修改动态数据库中的策略对象来快速更改现有路由策略。由于 Junos OS 不会验证对动态数据库的配置更改,因此在使用此功能时,应先测试并验证所有配置更改,然后再提交这些更改。
另请参阅
了解 OSPF 路由策略
每个路由策略都由一个策略名称标识。名称可包含字母、数字和连字符 (-),最长可包含 255 个字符。要让名称中包含空格,请用双引号将整个名称括起来。配置中,每个路由策略名称都必须是唯一的。创建并命名策略后,必须先应用策略,然后才能激活。
在语句中 import
,列出了用于过滤安装在 OSPF 邻接方路由表中的 OSPF 外部路由的路由策略的名称。您可以过滤路由,但不能过滤链路状态地址 (LSA) 泛洪。外部路由是在 OSPF 自治系统 (AS) 外部的路由。导入策略不会影响 OSPF 数据库。这意味着导入策略对链路状态通告没有影响。
在语句中 export
,列出了当路由从路由表导出到 OSPF 时要评估的路由策略的名称。
默认情况下,如果路由设备有多个 OSPF 区域,则来自其他区域学习的路由会自动安装到路由表的第 0 区域。
要指定多个策略并创建策略链,请使用空格作为分隔符列出这些策略。如果指定了多个策略,将按指定顺序评估这些策略。一旦执行接受或拒绝操作,策略链评估就会终止。
本主题介绍以下信息:
路由策略条款
路由策略由一个或多个术语组成。术语是一种命名结构,用于定义匹配条件和操作。您可以定义一个或多个术语。名称可以包含字母、数字和连字符 ( -),最长可包含 255 个字符。要让名称中包含空格,请用双引号将整个名称括起来。
每个术语都包含一组匹配条件和一组操作:
匹配条件是路由在应用操作之前必须匹配的标准。如果路由符合所有条件,则向路由应用一个或多个操作。
操作指定接受还是拒绝路由,控制评估一系列策略的方式,以及操作与路由关联的特性。
路由策略匹配条件
匹配条件定义了路由为要执行的操作所必须匹配的标准。您可以为每个术语定义一个或多个匹配条件。如果路由符合特定术语的所有匹配条件,将处理为该术语定义的操作。
每个术语均可包含两个语句和to
用于定义匹配条件的语句from
:
在语句中
from
,您可以定义传入路由必须匹配的标准。您可以指定一个或多个匹配条件。如果指定多个,则它们都必须匹配路由,才能发生匹配。语句
from
是可选的。如果省略这些from
语句和to
语句,则所有路由均被视为匹配。注意:在导出策略中,省略路由策略术语中的
from
语句可能会导致出现意外的结果。在语句中
to
,您可以定义传出路由必须匹配的标准。您可以指定一个或多个匹配条件。如果指定多个,则它们都必须匹配路由,才能发生匹配。
术语中匹配条件的顺序并不重要,因为路由必须匹配一个术语中的所有匹配条件,才能采取措施。
有关匹配条件的完整列表,请参阅在路由策略条款中配置匹配条件。
路由策略操作
操作定义当路由与特定术语和to
语句中的所有匹配条件匹配时,from
路由设备对路由执行的操作。如果某个术语没有from
语句,to
则所有路由均被视为匹配,并且操作适用于所有路由。
每个术语都可以使用以下一个或多个操作类型。这些操作是在 then
语句下配置的。
流控制操作,这会影响是否接受还是拒绝路由以及是否评估下一项或路由策略。
操作路由特征的操作。
追踪操作,记录路由匹配项。
语句 then
是可选的。如果省略,将发生以下其中一种情况:
评估路由策略中的下一个术语(如果有)。
如果路由策略没有更多的术语,则评估下一个路由策略(如果存在)。
如果没有更多的术语或路由策略,
accept
将执行默认策略指定的或reject
操作。
有关路由策略操作的完整列表,请参阅在路由策略条款中配置操作。
了解 OSPF 协议的备份选择策略
对 OSPF 无环路备用 (LFA) 路由的支持基本上增加了 OSPF 的 IP 快速重新路由功能。Junos OS 可预计算所有 OSPF 路由的多个无环路备份路由。这些备份路由预安装在数据包转发引擎中,当特定路由的主下一跃点的链路不再可用时,该引擎会执行本地修复和实施备份路径。通过选择任何匹配的 LFA 以随机完成 LFA 选择,以推进到给定目标。这并不能确保为网络提供最佳备份覆盖范围。为了选择最佳 LFA,Junos OS 允许您为每个目标(IPv4 和 IPv6)配置网络范围的备份选择策略,以及一个主下一跃点接口。根据管理员组、srlg、带宽、保护类型、指标和节点信息评估这些策略。
在备份最短路径优先 (SPF) 计算期间,备份路径的每个节点和链路属性均由 IGP 累积,并与拓扑中的每个节点(路由器)相关联。最佳备份路径中的下一跃点被选为路由表中的备份下一跃点。通常,备份评估策略规则可分为以下几类:
修枝 — 配置为选择符合条件的备份路径的规则。
订购 — 已配置规则以在符合条件的备份路径中选择最佳路径。
备份选择策略可配置为修剪和订购规则。在评估备份策略时,会为每个备份路径分配一个分数,这是一个整数值,表示评估标准的总权重。选择分数最高的备份路径。
要实施 LFA 选择,请为以下属性配置各种规则:
管理员组 – 管理组也称为链路着色或资源类,是手动分配的属性,用于描述链路的“颜色”,因此具有相同颜色的链接在概念上属于同一类。这些配置的管理组在协议 MPLS 下定义。您可以使用管理组使用排除、包含所有、包含任意或优先级来实施各种备份选择策略。
srlg — 共享风险链路组 (SRLG) 是共享公共资源的一组链路,如果公共资源发生故障,将影响集中的所有链路。这些链路具有相同的故障风险,因此被视为属于同一 SRLG。例如,共享通用光纤的链路据说位于同一 SRLG 中,因为光纤故障可能会导致该组中的所有链路出现故障。SRLG 由 IGP (OSPF) 域中唯一的 32 位编号表示。一个链路可能属于多个 SRLG。您可以定义备份选择以允许或拒绝主路径和备份路径之间的通用 SRLG。这种通用 SRLG 的拒绝基于在主下一跃点和备用 SPF 中具有通用 SRLG 的链路不存在。
注意:只能为默认拓扑创建管理组和 SRLG。
带宽 — 带宽用于指定主路径和备份路径之间的带宽约束。只有当备份下一跃点接口的带宽大于或等于主下一跃点的带宽时,才能使用备份下一跃点链路。
保护类型— 保护类型可保护目标免遭主节点的节点故障或主链路的链路故障。您可以配置节点、链路或节点链路来保护目标。如果配置了链路节点,则节点保护 LFA 优于链路保护 LFA。
节点 - 该节点是每个节点的策略信息。在这里,节点可以是直连路由器、RSVP 备份 LSP 尾端等远程路由器,也可以是备份 SPF 路径中的任何一个其他路由器。通过 LSP 中节点播发的路由 ID 识别这些节点。您可以列出首选节点,也可以将其排除在备份路径中。
指标 — 指标决定了 LFA 应如何成为首选。在备份选择路径中,根指标和 dest 指标是两种类型的指标。根指标表示一跃点邻接方或远程路由器(如 RSVP 备份 LSP 尾端路由器)的指标。dest 指标表示从单跳邻接方或远程路由器(如 RSVP 备份 LSP 尾端路由器)到最终目标的指标。指标评估可按升序或降序进行。默认情况下,第一个优先级是目标评估最低的备份路径,然后是根指标最低的备份路径。
评估顺序允许您控制备份路径中评估这些属性的顺序和标准。您可以显式配置评估顺序。只有配置的属性会影响备份路径的选择。LFA 这些属性的默认评估顺序是 [ 管理组 srlg 带宽保护类型节点指标] 。
OSPFv3 不支持 TE 属性,也不能用于 IPv6 前缀的备份选择策略评估。
另请参阅
为 OSPF 协议配置备份选择策略
对 OSPF 无环路备用 (LFA) 路由的支持基本上增加了 OSPF 的 IP 快速重新路由功能。Junos OS 可预计算所有 OSPF 路由的多个无环路备份路由。这些备份路由预安装在数据包转发引擎中,当特定路由的主下一跃点的链路不再可用时,该引擎会执行本地修复和实施备份路径。通过选择任何匹配的 LFA 以随机完成 LFA 选择,以推进到给定目标。这并不能确保为网络提供最佳备份覆盖范围。为了选择最佳 LFA,Junos OS 允许您为每个目标(IPv4 和 IPv6)配置网络范围的备份选择策略,以及一个主下一跃点接口。根据管理员组、srlg、带宽、保护类型、指标和节点信息评估这些策略。
开始为 OSPF 协议配置备份选择策略之前:
配置路由器接口。请参阅 路由设备的 Junos OS 网络管理管理指南。
配置内部网关协议或静态路由。请参阅 路由设备的 Junos OS 路由协议库。
要为 OSPF 协议配置备份选择策略:
另请参阅
与拓扑无关的无环路替代产品,具有适用于 OSPF 的分段路由
了解 OSPF 的分段路由与拓扑无关的无环路替代产品
通过实施描述该路径的标签堆栈,路由器可以通过分段路由沿着网络中的特定路径发送数据包。无需按路径建立分段路由标签堆栈所述的转发操作。因此,入口路由器可以使用分段路由标签堆栈实例化任意路径,并立即使用该路径,无需任何信号。
在分段路由中,每个节点都会播发传入标签和转发操作之间的映射关系。特定转发操作称为分段,标识该分段的标签称为分段标识符 (SID)。由 TI-LFA 创建的备份路径使用以下类型的分段:
节点分段 — 节点分段会沿着一个或多个最短路径将数据包转发到目标节点。将交换代表节点分段(节点 SID)的标签,直到到达目标节点。
邻接分段 — 邻接分段跨播发邻接分段的节点上的特定接口转发数据包。播发邻接分段的节点会弹出表示邻接分段(邻接 SID)的标签。
路由器可以创建一个标签堆栈,该堆栈结合使用节点 SID 和邻接 SID,从而沿着特定路径发送数据包。通常,节点 SID 用于表示路径的各个部分,这些部分与两个节点之间的最短路径相对应。如果节点 SID 无法准确表示所需路径,则使用邻接 SID。
与 OSPF 配合使用时,TI-LFA 可抵御链路故障、节点故障、命运共享故障和分担风险的链路组故障。在链路故障模式下,如果链路失败,目标将得到保护。在节点保护模式下,如果连接到主链路的邻接方发生故障,目标将受到保护。要确定节点保护的融合后路径,假定离开邻接方的所有链路的成本都会增加一定数额。
从 Junos OS 20.3R1 版开始,您可以在 TI-LFA 网络中为分段路由配置命运共享保护,以选择在与拓扑无关的无环路备用 (TI-LFA) 备份路径中包含命运共享组的快速重新路由路径,以避免命运共享故障。借助命运共享保护,在每个 PLR 上配置了命运共享组列表,每个命运共享组中的链路均由其各自的 IP 地址标识。PLR 将成本与每个命运共享组相关联。通过假设与失败的链路相同的命运共享组中每个链路的成本增加了与该组关联的成本,计算命运共享感知后融合路径。
从 Junos OS 20.3R1 版开始,您可以在 TI-LFA 网络中为分段路由配置共享风险链路组 (SRLG) 保护,以选择一个快速重新路由路径,该路径不会在与拓扑无关的无环路备用 (TI-LFA) 备份路径中包含 SRLG 链路。SRLG 共享一个通用的光纤,它们也有链路断开的风险。当 SRLG 中的一个链路出现故障时,该组中的其他链路也可能出现故障。因此,您需要避免与备份路径中的受保护链路具有相同风险的链路。配置 SRLG 保护可防止 TI-LFA 选择包含共享风险链路的备份路径。如果配置了 SRLG 保护,则 OSPFv2 将计算与后融合路径一致的快速重新路由路径,并排除属于受保护链路 SRLG 的链路。来自与受保护链路相同的 SRLG 的所有本地和远程链路均将从 TI-LFA 备份路径中排除。本地修复点 (PLR) 会使用不同的传出接口为快速重新路由路径设置标签堆栈。目前,您无法在 IPv6 网络和多拓扑网络中启用 SRLG 保护。
为了构建遵循融合后路径的备份路径,TI-LFA 可以在定义备份路径的标签堆栈中使用多个标签。如果构造特定融合后备份路径所需的标签数量超过一定数量,则在某些情况下不安装该备份路径会很有用。您可以配置备份路径为了安装的最大标签数量。默认值为 3,范围为 2 到 5。
给定故障的后融合路径实际上是一组等价路径。TI-LFA 尝试在故障后拓扑中使用多个等价路径构造到给定目标的备份路径。根据拓扑结构,TI-LFA 可能需要使用不同的标签堆栈,才能准确构造这些等价备份路径。默认情况下,TI-LFA 只会为给定目标安装一个备份路径。但是,您可以配置 1 到 8 范围内的值。
使用与拓扑无关的无环路替代技术进行分段路由的优势
多年来,无环路替代 (LFA) 和远程 LFA (RLFA) 一直用于提供快速重新路由保护。借助 LFA,本地修复点 (PLR) 可以确定发送至其直邻方之一的数据包是否在不通过 PLR 环路回传的情况下到达其目标位置。在典型的网络拓扑中,大约 40% 到 60% 的目标受 LFA 保护。远程 LFA 进一步扩展了 LFA 的概念,它允许 PLR 对数据包通过隧道传输至修复隧道端点的单个标签,而数据包可以从该端点到达其目标,而无需通过 PLR 进行环路回传。与 LFA 相比,使用远程 LFA,更多的目的地可以受到 PLR 的保护。但是,根据网络拓扑,受远程 LFA 保护的目标百分比通常低于 100%。
独立于拓扑的 LFA (TI-LFA) 允许 PLR 使用更深入的标签堆栈来构建备用路径,从而扩展了 LFA 和远程 LFA 的概念。此外,TI-LFA 还规定,PLR 使用的备份路径与内部网关协议 (IGP) 融合到给定故障场景后数据包采用的路径相同。此路径称为融合后路径。
使用融合后路径作为备用路径有一些理想的特性。对于某些拓扑结构,网络运营商只需确保网络在发生故障后有足够的容量沿着融合后路径传输流量。在这些情况下,由于备份路径遵循后融合路径,因此网络运营商在发生故障后立即无需分配额外容量来处理流量模式,而备份路径则为后融合路径。
与 OSPF 配合使用时,TI-LFA 可提供链路故障和节点故障防护。
为 OSPF 配置与分段路由无关的无环路替代配置
为 OSPF 配置 TI-LFA 之前,请确保配置 SPRING 或分段路由。
从 Junos OS 19.3R1 版开始,Junos 支持创建 OSPF 独立于拓扑的 TI-LFA 备份路径,当 PLR 和映射服务器位于同一 OSPF 区域时,将从分段路由映射服务器播发中获知前缀 SID。
要使用 SPRING for OSPF 配置 TI-LFA,您必须请执行以下操作:
示例:为 OSPF 或 OSPF3 协议配置备份选择策略
此示例说明如何为 OSPF 或 OSPF3 协议配置备份选择策略,以便选择网络中无环路替代 (LFA)。
启用备份选择策略时,Junos OS 允许根据网络中链路和节点的策略规则和属性选择 LFA。这些属性包括管理员组、srlg、带宽、保护类型、指标和节点。
要求
此示例使用以下硬件和软件组件:
这 8 个路由器可以组合使用 M 系列多服务边缘路由器、MX 系列 5G 通用路由平台、PTX 系列数据包传输路由器和 T 系列核心路由器
在所有设备上运行的 Junos OS 15.1 或更高版本
开始之前:
配置设备接口。
配置 OSPF。
概述
在 Junos OS 中,可以使用 LFA 策略覆盖默认无环路替代 (LFA) 选择算法或标准。这些策略会为每个目标(IPv4 和 IPv6)和主下一跃点接口配置。这些备份策略会根据备份路径的管理员组、srlg、带宽、保护类型、指标和节点属性来实施 LFA 选择。在备份最短路径优先 (SPF) 计算期间,每个备份下一跃点存储的备份路径的每个属性(包括节点和链路)都由 IGP 累积。对于 IGP 在内部创建的路由,根据为每个目标(IPv4 和 IPv6) 和主下一跃点接口配置的策略来评估每个备份路径的属性集。第一个或最佳备份路径被选中并安装为路由表中的备份下一跃点。要配置备份选择策略,请在 backup-selection
层级添加配置语句 [edit routing-options]
。命令 show backup-selection
显示给定接口和目标的配置策略。您可以根据特定目标、前缀、接口或逻辑系统过滤显示内容。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入 commit
。
R0
set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.1/30 set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8:10:1:1::1/64 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/1/0 unit 0 family inet address 172.16.15.1/30 set interfaces ge-0/1/0 unit 0 family inet6 address 2001:db8:15:1:1::1/64 set interfaces ge-0/1/0 unit 0 family mpls set interfaces xe-0/2/0 unit 0 family inet address 172.16.20.1/30 set interfaces xe-0/2/0 unit 0 family inet6 address 2001:db8:20:1:1::1/64 set interfaces xe-0/2/0 unit 0 family mpls set interfaces ge-1/0/5 unit 0 family inet address 172.16.150.1/24 set interfaces ge-1/0/5 unit 0 family inet6 address 2001:db8:150:1:1::1/64 set interfaces ge-1/0/5 unit 0 family mpls set interfaces ge-1/1/1 unit 0 family inet address 172.16.30.1/30 set interfaces ge-1/1/1 unit 0 family inet6 address 2001:db8:30:1:1::1/64 set interfaces ge-1/1/1 unit 0 family mpls set interfaces xe-1/3/0 unit 0 family inet address 172.16.25.1/30 set interfaces xe-1/3/0 unit 0 family inet6 address 2001:db8:25:1:1::1/64 set interfaces xe-1/3/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 10.10.10.10/32 primary set interfaces lo0 unit 0 family inet6 address 2001:db8::10:10:10:10/128 primary set interfaces lo0 unit 0 family mpls set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 10.10.10.10 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-0/1/0.0 metric 18 set protocols ospf area 0.0.0.0 interface xe-0/2/0.0 metric 51 set protocols ospf area 0.0.0.0 interface ge-1/1/1.0 metric 23 set protocols ospf area 0.0.0.0 interface xe-1/3/0.0 metric 52 set protocols ospf area 0.0.0.0 interface ge-1/0/5.0 set protocols ospf3 area 0.0.0.0 interface ge-0/0/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/1/0.0 metric 18 set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.0 metric 51 set protocols ospf3 area 0.0.0.0 interface ge-1/1/1.0 metric 23 set protocols ospf3 area 0.0.0.0 interface xe-1/3/0.0 metric 52 set protocols ospf3 area 0.0.0.0 interface ge-1/0/5.0
R1
set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.2/30 set interfaces ge-0/0/0 unit 0 family inet6 address 2001:db8:10:1:1::2/64 set interfaces ge-0/0/0 unit 0 family mpls set interfaces ge-0/0/5 unit 0 family inet address 172.16.35.1/30 set interfaces ge-0/0/5 unit 0 family inet6 address 2001:db8:35:1:1::1/64 set interfaces ge-0/0/5 unit 0 family mpls set interfaces xe-0/2/0 unit 0 family inet address 172.16.40.1/30 set interfaces xe-0/2/0 unit 0 family inet6 address 2001:db8:40:1:1::1/64 set interfaces xe-0/2/0 unit 0 family mpls set interfaces xe-0/3/0 unit 0 family inet address 172.16.45.1/30 set interfaces xe-0/3/0 unit 0 family inet6 address 2001:db8:45:1:1::1/64 set interfaces xe-0/3/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 172.16.1.1/32 primary set interfaces lo0 unit 0 family inet6 address 2001:db8::1:1:1:1/128 primary set interfaces lo0 unit 0 family mpls set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.1.1 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols mpls interface ge-0/0/0.0 srlg srlg9 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 metric 10 set protocols ospf area 0.0.0.0 interface xe-0/2/0.0 metric 10 set protocols ospf area 0.0.0.0 interface xe-0/3/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/0/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/0/5.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-0/3/0.0 metric 10
R 2
set interfaces ge-0/0/2 unit 0 family inet address 172.16.35.2/30 set interfaces ge-0/0/2 unit 0 family inet6 address 2001:db8:35:1:1::2/64 set interfaces ge-0/0/2 unit 0 family mpls set interfaces ge-0/1/0 unit 0 family inet address 172.16.50.1/30 set interfaces ge-0/1/0 unit 0 family inet6 address 2001:db8:50:1:1::1/64 set interfaces ge-0/1/0 unit 0 family mpls set interfaces xe-0/2/1 unit 0 family inet address 172.16.55.1/30 set interfaces xe-0/2/1 unit 0 family inet6 address 2001:db8:55:1:1::1/64 set interfaces xe-0/2/1 unit 0 family mpls set interfaces ge-1/0/2 unit 0 family inet address 172.16.60.1/30 set interfaces ge-1/0/2 unit 0 family inet6 address 2001:db8:60:1:1::1/64 set interfaces ge-1/0/2 unit 0 family mpls set interfaces ge-1/0/9 unit 0 family inet address 172.16.65.1/30 set interfaces ge-1/0/9 unit 0 family inet6 address 2001:db8:65:1:1::1/64 set interfaces ge-1/0/9 unit 0 family mpls set interfaces ge-1/1/5 unit 0 family inet address 172.16.70.1/30 set interfaces ge-1/1/5 unit 0 family inet6 address 2001:db8:70:1:1::1/64 set interfaces ge-1/1/5 unit 0 family mpls set interfaces lo0 unit 0 family inet address 172.16.2.2/32 primary set interfaces lo0 unit 0 family inet6 address 2001:db8::2:2:2:2/128 primary set interfaces lo0 unit 0 family mpls set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.2.2 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols mpls interface ge-0/1/0.0 srlg srlg1 set protocols mpls interface ge-1/0/9.0 srlg srlg1 set protocols mpls interface ge-1/1/5.0 srlg srlg7 set protocols ospf area 0.0.0.0 interface ge-0/0/2.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-0/1/0.0 link-protection set protocols ospf area 0.0.0.0 interface xe-0/2/1.0 metric 12 set protocols ospf area 0.0.0.0 interface ge-1/0/2.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-1/0/9.0 metric 12 set protocols ospf area 0.0.0.0 interface ge-1/1/5.0 metric 13 set protocols ospf3 area 0.0.0.0 interface ge-0/0/2.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/1/0.0 link-protection set protocols ospf3 area 0.0.0.0 interface xe-0/2/1.0 metric 12 set protocols ospf3 area 0.0.0.0 interface ge-1/0/2.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-1/0/9.0 metric 12 set protocols ospf3 area 0.0.0.0 interface ge-1/1/5.0 metric 13
R3
set interfaces ge-0/0/5 unit 0 family inet address 172.16.50.2/30 set interfaces ge-0/0/5 unit 0 family inet6 address 2001:db8:50:1:1::2/64 set interfaces ge-0/0/5 unit 0 family mpls set interfaces xe-0/3/1 unit 0 family inet address 172.16.75.1/30 set interfaces xe-0/3/1 unit 0 family inet6 address 2001:db8:75:1:1::1/64 set interfaces xe-0/3/1 unit 0 family mpls set interfaces ge-1/0/0 unit 0 family inet address 172.16.80.1/30 set interfaces ge-1/0/0 unit 0 family inet6 address 2001:db8:80:1:1::1/64 set interfaces ge-1/0/0 unit 0 family mpls set interfaces ge-1/0/5 unit 0 family inet address 172.16.200.1/24 set interfaces ge-1/0/5 unit 0 family inet6 address 2001:db8:200:1:1::1/64 set interfaces ge-1/0/6 unit 0 family inet address 172.16.85.1/30 set interfaces ge-1/0/6 unit 0 family inet6 address 2001:db8:85:1:1::1/64 set interfaces ge-1/0/6 unit 0 family mpls set interfaces xe-1/3/0 unit 0 family inet address 172.16.90.1/30 set interfaces xe-1/3/0 unit 0 family inet6 address 2001:db8:90:1:1::1/64 set interfaces xe-1/3/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 172.16.3.3/32 primary set interfaces lo0 unit 0 family inet6 address 2001:db8::3:3:3:3/128 primary set interfaces lo0 unit 0 family mpls set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.3.3 set routing-options forwarding-table export ecmp set routing-options backup-selection destination 10.1.1.0/30 interface xe-1/3/0.0 admin-group include-all c2 set routing-options backup-selection destination 10.1.1.0/30 interface all admin-group exclude c3 set routing-options backup-selection destination 10.1.1.0/30 interface all srlg strict set routing-options backup-selection destination 10.1.1.0/30 interface all protection-type node set routing-options backup-selection destination 10.1.1.0/30 interface all bandwidth-greater-equal-primary set routing-options backup-selection destination 10.1.1.0/30 interface all neighbor preference 172.16.7.7 set routing-options backup-selection destination 10.1.1.0/30 interface all root-metric lowest set routing-options backup-selection destination 10.1.1.0/30 interface all metric-order root set routing-options backup-selection destination 172.16.30.0/30 interface all admin-group exclude c5 set routing-options backup-selection destination 172.16.30.0/30 interface all srlg strict set routing-options backup-selection destination 172.16.30.0/30 interface all protection-type node set routing-options backup-selection destination 172.16.30.0/30 interface all bandwidth-greater-equal-primary set routing-options backup-selection destination 172.16.30.0/30 interface all neighbor preference 172.16.7.7 set routing-options backup-selection destination 172.16.30.0/30 interface all root-metric lowest set routing-options backup-selection destination 172.16.30.0/30 interface all metric-order root set routing-options backup-selection destination 172.16.45.0/30 interface all admin-group exclude c5 set routing-options backup-selection destination 172.16.45.0/30 interface all srlg strict set routing-options backup-selection destination 172.16.45.0/30 interface all protection-type node set routing-options backup-selection destination 172.16.45.0/30 interface all bandwidth-greater-equal-primary set routing-options backup-selection destination 172.16.45.0/30 interface all neighbor preference 172.16.7.7 set routing-options backup-selection destination 172.16.45.0/30 interface all root-metric lowest set routing-options backup-selection destination 172.16.45.1/30 interface all metric-order root set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols mpls interface ge-0/0/5.0 admin-group c0 set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 link-protection set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 metric 10 set protocols ospf area 0.0.0.0 interface xe-0/3/1.0 metric 21 set protocols ospf area 0.0.0.0 interface ge-1/0/0.0 metric 13 set protocols ospf area 0.0.0.0 interface ge-1/0/6.0 metric 15 set protocols ospf area 0.0.0.0 interface xe-1/3/0.0 link-protection set protocols ospf area 0.0.0.0 interface xe-1/3/0.0 metric 22 set protocols ospf3 area 0.0.0.0 interface ge-0/0/5.0 link-protection set protocols ospf3 area 0.0.0.0 interface ge-0/0/5.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-0/3/1.0 metric 21 set protocols ospf3 area 0.0.0.0 interface ge-1/0/0.0 metric 13 set protocols ospf3 area 0.0.0.0 interface ge-1/0/6.0 metric 15 set protocols ospf3 area 0.0.0.0 interface xe-1/3/0.0 link-protection set protocols ospf3 area 0.0.0.0 interface xe-1/3/0.0 metric 22 set policy-options policy-statement ecmp term 1 then load-balance per-packet
R4
set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.4.4 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols ospf area 0.0.0.0 interface ge-0/1/0.0 metric 18 set protocols ospf area 0.0.0.0 interface xe-0/2/0.0 metric 10 set protocols ospf area 0.0.0.0 interface xe-1/3/0.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-1/1/0.0 metric 10 set protocols ospf area 0.0.0.0 interface xe-0/3/1.0 metric 21 set protocols ospf3 area 0.0.0.0 interface ge-0/1/0.0 metric 18 set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-1/3/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/0/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-1/1/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-0/3/1.0 metric 21
R5
set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.5.5 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols ospf area 0.0.0.0 interface xe-0/2/0.0 metric 51 set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-0/0/5.0 metric 13 set protocols ospf area 0.0.0.0 interface ge-0/1/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.0 metric 51 set protocols ospf3 area 0.0.0.0 interface ge-0/0/1.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/0/5.0 metric 13 set protocols ospf3 area 0.0.0.0 interface ge-0/1/0.0 metric 10
R6
set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.6.6 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 25 set protocols mpls admin-groups c26 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols ospf area 0.0.0.0 interface xe-0/3/0.0 metric 52 set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 metric 12 set protocols ospf area 0.0.0.0 interface ge-0/0/4.0 metric 15 set protocols ospf area 0.0.0.0 interface xe-0/2/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface xe-0/3/0.0 metric 52 set protocols ospf3 area 0.0.0.0 interface ge-0/0/0.0 metric 12 set protocols ospf3 area 0.0.0.0 interface ge-0/0/4.0 metric 15 set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.0 metric 10
R7
set routing-options srlg srlg1 srlg-value 1001 set routing-options srlg srlg2 srlg-value 1002 set routing-options srlg srlg3 srlg-value 1003 set routing-options srlg srlg4 srlg-value 1004 set routing-options srlg srlg5 srlg-value 1005 set routing-options srlg srlg6 srlg-value 1006 set routing-options srlg srlg7 srlg-value 1007 set routing-options srlg srlg8 srlg-value 1008 set routing-options srlg srlg9 srlg-value 1009 set routing-options srlg srlg10 srlg-value 10010 set routing-options srlg srlg11 srlg-value 10011 set routing-options srlg srlg12 srlg-value 10012 set routing-options router-id 172.16.7.7 set protocols rsvp interface all set protocols mpls admin-groups c0 0 set protocols mpls admin-groups c1 1 set protocols mpls admin-groups c2 2 set protocols mpls admin-groups c3 3 set protocols mpls admin-groups c4 4 set protocols mpls admin-groups c5 5 set protocols mpls admin-groups c6 6 set protocols mpls admin-groups c7 7 set protocols mpls admin-groups c8 8 set protocols mpls admin-groups c9 9 set protocols mpls admin-groups c10 10 set protocols mpls admin-groups c11 11 set protocols mpls admin-groups c12 12 set protocols mpls admin-groups c13 13 set protocols mpls admin-groups c14 14 set protocols mpls admin-groups c15 15 set protocols mpls admin-groups c16 16 set protocols mpls admin-groups c17 17 set protocols mpls admin-groups c18 18 set protocols mpls admin-groups c19 19 set protocols mpls admin-groups c20 20 set protocols mpls admin-groups c21 21 set protocols mpls admin-groups c22 22 set protocols mpls admin-groups c23 23 set protocols mpls admin-groups c24 24 set protocols mpls admin-groups c25 26 set protocols mpls admin-groups c27 27 set protocols mpls admin-groups c28 28 set protocols mpls admin-groups c29 29 set protocols mpls admin-groups c30 30 set protocols mpls admin-groups c31 31 set protocols mpls interface all set protocols mpls interface xe-0/3/0.0 srlg srlg8 set protocols ospf area 0.0.0.0 interface ge-0/1/5.0 metric 23 set protocols ospf area 0.0.0.0 interface xe-0/3/0.0 metric 10 set protocols ospf area 0.0.0.0 interface ge-1/0/0.0 metric 13 set protocols ospf area 0.0.0.0 interface xe-1/3/0.0 metric 22 set protocols ospf area 0.0.0.0 interface xe-1/2/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-0/1/5.0 metric 23 set protocols ospf3 area 0.0.0.0 interface xe-0/3/0.0 metric 10 set protocols ospf3 area 0.0.0.0 interface ge-1/0/0.0 metric 13 set protocols ospf3 area 0.0.0.0 interface xe-1/3/0.0 metric 22 set protocols ospf3 area 0.0.0.0 interface xe-1/2/0.0 metric 10
配置设备 R3
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置设备 R3:
配置接口。
[edit interfaces] user@R3# set ge-0/0/5 unit 0 family inet address 172.16.50.2/30 user@R3# set ge-0/0/5 unit 0 family inet6 address 2001:db8:50:1:1::2/64 user@R3# set ge-0/0/5 unit 0 family mpls user@R3# set xe-0/3/1 unit 0 family inet address 172.16.75.1/30 user@R3# set xe-0/3/1 unit 0 family inet6 address 2001:db8:75:1:1::1/64 user@R3# set xe-0/3/1 unit 0 family mpls user@R3# set ge-1/0/0 unit 0 family inet address 172.16.80.1/30 user@R3# set ge-1/0/0 unit 0 family inet6 address 2001:db8:80:1:1::1/64 user@R3# set ge-1/0/0 unit 0 family mpls user@R3# set ge-1/0/5 unit 0 family inet address 172.16.200.1/24 user@R3# set ge-1/0/5 unit 0 family inet6 address 2001:db8:200:1:1::1/64 user@R3# set ge-1/0/6 unit 0 family inet address 172.16.85.1/30 user@R3# set ge-1/0/6 unit 0 family inet6 address 2001:db8:85:1:1::1/64 user@R3# set ge-1/0/6 unit 0 family mpls user@R3# set xe-1/3/0 unit 0 family inet address 172.16.90.1/30 user@R3# set xe-1/3/0 unit 0 family inet6 address 2001:db8:90:1:1::1/64 user@R3# set xe-1/3/0 unit 0 family mpls user@R3# set lo0 unit 0 family inet address 172.16.3.3/32 primary user@R3# set lo0 unit 0 family inet6 address 2001:db8::3:3:3:3/128 primary user@R3# set lo0 unit 0 family mpls
配置 srlg 值。
[edit routing-options] user@R3# set srlg srlg1 srlg-value 1001 user@R3# set srlg srlg2 srlg-value 1002 user@R3# set srlg srlg3 srlg-value 1003 user@R3# set srlg srlg4 srlg-value 1004 user@R3# set srlg srlg5 srlg-value 1005 user@R3# set srlg srlg6 srlg-value 1006 user@R3# set srlg srlg7 srlg-value 1007 user@R3# set srlg srlg8 srlg-value 1008 user@R3# set srlg srlg9 srlg-value 1009 user@R3# set srlg srlg10 srlg-value 10010 user@R3# set srlg srlg11 srlg-value 10011 user@R3# set srlg srlg12 srlg-value 10012
配置路由器的 ID。
[edit routing-options] user@R3# set router-id 172.16.3.3
将路由策略应用于从路由表导出到转发表的所有等价多路径。
[edit routing-options] user@R3# set forwarding-table export ecmp
配置备份选择策略的属性。
[edit routing-options backup-selection] user@R3# set destination 10.1.1.0/30 interface xe-1/3/0.0 admin-group include-all c2 user@R3# set destination 10.1.1.0/30 interface all admin-group exclude c3 user@R3# set destination 10.1.1.0/30 interface all srlg strict user@R3# set destination 10.1.1.0/30 interface all protection-type node user@R3# set destination 10.1.1.0/30 interface all bandwidth-greater-equal-primary user@R3# set destination 10.1.1.0/30 interface all neighbor preference 172.16.7.7 user@R3# set destination 10.1.1.0/30 interface all root-metric lowest user@R3# set destination 10.1.1.0/30 interface all metric-order root user@R3# set destination 172.16.30.0/30 interface all admin-group exclude c5 user@R3# set destination 172.16.30.0/30 interface all srlg strict user@R3# set destination 172.16.30.0/30 interface all protection-type node user@R3# set destination 172.16.30.0/30 interface all bandwidth-greater-equal-primary user@R3# set destination 172.16.30.0/30 interface all neighbor preference 172.16.7.7 user@R3# set destination 172.16.30.0/30 interface all root-metric lowest user@R3# set destination 172.16.30.0/30 interface all metric-order root user@R3# set destination 192.168.45.0/30 interface all admin-group exclude c5 user@R3# set destination 192.168.45.0/30 interface all srlg strict user@R3# set destination 192.168.45.0/30 interface all protection-type node user@R3# set destination 192.168.45.0/30 interface all bandwidth-greater-equal-primary user@R3# set destination 192.168.45.0/30 interface all neighbor preference 172.16.7.7 user@R3# set destination 192.168.45.0/30 interface all root-metric lowest user@R3# set destination 192.168.45.0/30 interface all metric-order root
在所有接口上启用 RSVP。
[edit protocols] user@R3# set rsvp interface all
配置管理组。
[edit protocols mpls] user@R3# set admin-groups c0 0 user@R3# set admin-groups c1 1 user@R3# set admin-groups c2 2 user@R3# set admin-groups c3 3 user@R3# set admin-groups c4 4 user@R3# set admin-groups c5 5 user@R3# set admin-groups c6 6 user@R3# set admin-groups c7 7 user@R3# set admin-groups c8 8 user@R3# set admin-groups c9 9 user@R3# set admin-groups c10 10 user@R3# set admin-groups c11 11 user@R3# set admin-groups c12 12 user@R3# set admin-groups c13 13 user@R3# set admin-groups c14 14 user@R3# set admin-groups c15 15 user@R3# set admin-groups c16 16 user@R3# set admin-groups c17 17 user@R3# set admin-groups c18 18 user@R3# set admin-groups c19 19 user@R3# set admin-groups c20 20 user@R3# set admin-groups c21 21 user@R3# set admin-groups c22 22 user@R3# set admin-groups c23 23 user@R3# set admin-groups c24 24 user@R3# set admin-groups c25 25 user@R3# set admin-groups c26 26 user@R3# set admin-groups c27 27 user@R3# set admin-groups c28 28 user@R3# set admin-groups c29 29 user@R3# set admin-groups c30 30 user@R3# set admin-groups c31 31
在所有接口上启用 MPLS 并为某个接口配置管理组。
[edit protocols mpls] user@R3# set interface all user@R3# set interface ge-0/0/5.0 admin-group c0
在 OSPF 区域的所有接口上启用链路保护并配置指标值。
[edit protocols ospf] user@R3# set area 0.0.0.0 interface ge-0/0/5.0 link-protection user@R3# set area 0.0.0.0 interface ge-0/0/5.0 metric 10 user@R3# set area 0.0.0.0 interface xe-0/3/1.0 metric 21 user@R3# set area 0.0.0.0 interface ge-1/0/0.0 metric 13 user@R3# set area 0.0.0.0 interface ge-1/0/6.0 metric 15 user@R3# set area 0.0.0.0 interface xe-1/3/0.0 link-protection user@R3# set area 0.0.0.0 interface xe-1/3/0.0 metric 22
在 OSPF3 区域的所有接口上启用链路保护并配置指标值。
[edit protocols ospf3] user@R3# set area 0.0.0.0 interface ge-0/0/5.0 link-protection user@R3# set area 0.0.0.0 interface ge-0/0/5.0 metric 10 user@R3# set area 0.0.0.0 interface xe-0/3/1.0 metric 21 user@R3# set area 0.0.0.0 interface ge-1/0/0.0 metric 13 user@R3# set area 0.0.0.0 interface ge-1/0/6.0 metric 15 user@R3# set area 0.0.0.0 interface xe-1/3/0.0 link-protection user@R3# set area 0.0.0.0 interface xe-1/3/0.0 metric 22
配置路由策略。
[edit policy-options] user@R3# set policy-statement ecmp term 1 then load-balance per-packet
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@R3# show interfaces ge-0/0/5 { unit 0 { family inet { address 192.168.50.2/30; } family inet6 { address 2001:db8:50:1:1::2/64; } family mpls; } } xe-0/3/1 { unit 0 { family inet { address 192.168.75.1/30; } family inet6 { address 2001:db8:75:1:1::1/64; } family mpls; } } ge-1/0/0 { unit 0 { family inet { address 192.168.80.1/30; } family inet6 { address 2001:db8:80:1:1::1/64; } family mpls; } } ge-1/0/5 { unit 0 { family inet { address 172.16.200.1/24; } family inet6 { address 2001:db8:200:1:1::1/64; } } } ge-1/0/6 { unit 0 { family inet { address 192.168.85.1/30; } family inet6 { address 2001:db8:85:1:1::1/64; } family mpls; } } xe-1/3/0 { unit 0 { family inet { address 192.168.90.1/30; } family inet6 { address 2001:db8:90:1:1::1/64; } family mpls; } } lo0 { unit 0 { family inet { address 172.16.3.3/32 { primary; } } family inet6 { address 2001:db8:3:3:3:3/128 { primary; } } family mpls; } }
user@R3# show protocols rsvp { interface all; } mpls { admin-groups { c0 0; c1 1; c2 2; c3 3; c4 4; c5 5; c6 6; c7 7; c8 8; c9 9; c10 10; c11 11; c12 12; c13 13; c14 14; c15 15; c16 16; c17 17; c18 18; c19 19; c20 20; c21 21; c22 22; c23 23; c24 24; c25 25; c26 26; c27 27; c28 28; c29 29; c30 30; c31 31; } interface all; interface ge-0/0/5.0 { admin-group c0; } } ospf { area 0.0.0.0 { interface ge-0/0/5.0 { link-protection; metric 10; } interface xe-0/3/1.0 { metric 21; } interface ge-1/0/0.0 { metric 13; } interface ge-1/0/6.0 { metric 15; } interface xe-1/3/0.0 { link-protection; metric 22; } } } ospf3 { area 0.0.0.0 { interface ge-0/0/5.0 { link-protection; metric 10; } interface xe-0/3/1.0 { metric 21; } interface ge-1/0/0.0 { metric 13; } interface ge-1/0/6.0 { metric 15; } interface xe-1/3/0.0 { link-protection; metric 22; } } }
user@R3# show routing-options srlg { srlg1 srlg-value 1001; srlg2 srlg-value 1002; srlg3 srlg-value 1003; srlg4 srlg-value 1004; srlg5 srlg-value 1005; srlg6 srlg-value 1006; srlg7 srlg-value 1007; srlg8 srlg-value 1008; srlg9 srlg-value 1009; srlg10 srlg-value 10010; srlg11 srlg-value 10011; srlg12 srlg-value 10012; } router-id 172.16.3.3; forwarding-table { export ecmp; } backup-selection { destination 10.1.1.0/30 { interface xe-1/3/0.0 { admin-group { include-all c2; } } interface all { admin-group { exclude c3; } srlg strict; protection-type node; bandwidth-greater-equal-primary; node { preference 172.16.7.7; } root-metric lowest; metric-order root; } } destination 172.16.30.0/30 { interface all { admin-group { exclude c5; } srlg strict; protection-type node; bandwidth-greater-equal-primary; node { preference 172.16.7.7; } root-metric lowest; metric-order root; } } destination 192.168.45.0/30 { interface all { admin-group { exclude c5; } srlg strict; protection-type node; bandwidth-greater-equal-primary; node { preference 172.16.7.7; } root-metric lowest; metric-order root; } } }
完成设备配置后,请从配置模式进入 commit
。
验证
确认配置工作正常。
验证路由
目的
验证是否已学习到预期的路由。
行动
在操作模式下,为路由表运行 show route
命令。
user@R3> show route
inet.0: 48 destinations, 48 routes (48 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
172.16.3.3/32 *[Direct/0] 02:22:27
> via lo0.0
10.4.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.5.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.6.128.0/17 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.9.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.10.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.13.4.0/23 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.13.10.0/23 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.82.0.0/15 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.84.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.85.12.0/22 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.92.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.92.16.0/20 *[Direct/0] 02:22:57
> via fxp0.0
10.92.24.195/32 *[Local/0] 02:22:57
Local via fxp0.0
10.94.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.99.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.102.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.150.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.155.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.157.64.0/19 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.160.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.204.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.205.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.206.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.207.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.209.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.212.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.213.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.214.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.215.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.216.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.218.13.0/24 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.218.14.0/24 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.218.16.0/20 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.218.32.0/20 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
10.227.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
172.16.50.0/30 *[Direct/0] 02:19:55
> via ge-0/0/5.0
172.16.50.2/32 *[Local/0] 02:19:58
Local via ge-0/0/5.0
172.16.75.0/30 *[Direct/0] 02:19:55
> via xe-0/3/1.0
172.16.75.1/32 *[Local/0] 02:19:57
Local via xe-0/3/1.0
172.16.24.195/32 *[Direct/0] 02:22:57
> via lo0.0
172.16.0.0/12 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
192.168.0.0/16 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
192.168.102.0/23 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
192.168.136.0/24 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
192.168.136.192/32 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
192.168.137.0/24 *[Static/5] 02:22:57
> to 10.92.31.254 via fxp0.0
192.168.233.5/32 *[OSPF/10] 00:16:55, metric 1
MultiRecv
iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
47.0005.80ff.f800.0000.0108.0001.1280.9202.4195/152
*[Direct/0] 02:22:57
> via lo0.0
mpls.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
0 *[MPLS/0] 00:16:55, metric 1
Receive
1 *[MPLS/0] 00:16:55, metric 1
Receive
2 *[MPLS/0] 00:16:55, metric 1
Receive
13 *[MPLS/0] 00:16:55, metric 1
Receive
inet6.0: 10 destinations, 11 routes (10 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
2001:db8:50:1:1::/64 *[Direct/0] 02:19:44
> via ge-0/0/5.0
2001:db8:50:1:1::2/128 *[Local/0] 02:19:58
Local via ge-0/0/5.0
2001:db8:75:1:1::/64 *[Direct/0] 02:19:44
> via xe-0/3/1.0
2001:db8:75:1:1::1/128 *[Local/0] 02:19:57
Local via xe-0/3/1.0
2001:db8::3:3:3:3/128 *[Direct/0] 02:22:27
> via lo0.0
2001:db8::128:92:24:195/128
*[Direct/0] 02:22:57
> via lo0.0
fe80::/64 *[Direct/0] 02:19:44
> via ge-0/0/5.0
[Direct/0] 02:19:43
> via xe-0/3/1.0
fe80::205:86ff:fe00:ed05/128
*[Local/0] 02:19:58
Local via ge-0/0/5.0
fe80::205:86ff:fe00:ed3d/128
*[Local/0] 02:19:57
Local via xe-0/3/1.0
fe80::5668:a50f:fcc1:3ca2/128
*[Direct/0] 02:22:57
> via lo0.0
意义
输出显示所有设备 R3 路由。
验证 OSPF 路由
目的
验证 OSPF 的路由表。
行动
在操作模式下,为设备 R3 运行 show ospf route detail
命令。
user@R3> show ospf route detail
Topology default Route Table:
Prefix Path Route NH Metric NextHop Nexthop
Type Type Type Interface Address/LSP
172.16.50.0/30 Intra Network IP 10 ge-0/0/5.0
area 0.0.0.0, origin 172.16.3.3, priority low
172.16.75.0/30 Intra Network IP 21 xe-0/3/1.0
area 0.0.0.0, origin 172.16.3.3, priority low
意义
输出显示 OSPF 路由器的路由表。
验证 OSPF3 路由
目的
验证 OSPF3 的路由表。
行动
在操作模式下,为设备 R3 运行 show ospf3 route detail
命令。
user@R3> show ospf3 route detail
Prefix Path Route NH Metric
Type Type Type
2001:db8:50:1:1::/64 Intra Network IP 10
NH-interface ge-0/0/5.0
Area 0.0.0.0, Origin 172.16.3.3, Priority low
2001:db8:75:1:1::/64 Intra Network IP 21
NH-interface xe-0/3/1.0
Area 0.0.0.0, Origin 172.16.3.3, Priority low
意义
输出显示 OSPF3 路由器的路由表。
验证设备 R3 的备份选择策略
目的
验证设备 R3 的备份选择策略。
行动
在操作模式下,为设备 R3 运行 show backup-selection
命令。
user@R3> show backup-selection
Prefix: 10.1.1.0/30
Interface: all
Admin-group exclude: c3
Neighbor preference: 172.16.7.7
Protection Type: Node, Downstream Paths Only: Disabled, SRLG: Strict, B/w >= Primary: Enabled, Root-metric: lowest, Dest-metric: lowest
Metric Evaluation Order: Root-metric, Dest-metric
Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric
Interface: xe-1/3/0.0
Admin-group include-all: c2
Protection Type: Link, Downstream Paths Only: Disabled, SRLG: Loose, B/w >= Primary: Disabled, Root-metric: lowest, Dest-metric: lowest
Metric Evaluation Order: Dest-metric, Root-metric
Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric Prefix: 172.16.30.0/30
Interface: all
Admin-group exclude: c5
Neighbor preference: 172.16.7.7
Protection Type: Node, Downstream Paths Only: Disabled, SRLG: Strict, B/w >= Primary: Enabled, Root-metric: lowest, Dest-metric: lowest
Metric Evaluation Order: Root-metric, Dest-metric
Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric
Prefix: 172.16.45.0/30
Interface: all
Admin-group exclude: c5
Neighbor preference: 172.16.7.7
Protection Type: Node, Downstream Paths Only: Disabled, SRLG: Strict, B/w >= Primary: Enabled, Root-metric: lowest, Dest-metric: lowest
Metric Evaluation Order: Root-metric, Dest-metric
Policy Evaluation Order: Admin-group, SRLG, Bandwidth, Protection, node, Metric
意义
输出显示每个前缀为每个主下一跃点接口配置的策略。
示例:将 OSPF 路由注入 BGP 路由表中
此示例说明如何创建将 OSPF 路由注入 BGP 路由表中的策略。
要求
开始之前:
配置网络接口。
配置外部对等会话。请参阅 示例:配置外部 BGP 点对点对等会话。
配置对等方之间的内部网关协议 (IGP) 会话。
概述
在此示例中,您将创建一个名为 injectpolicy1
的路由策略和一个名为的 injectterm1
路由术语。该策略将 OSPF 路由注入 BGP 路由表中。
拓扑
配置
配置路由策略
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
set policy-options policy-statement injectpolicy1 term injectterm1 from protocol ospf set policy-options policy-statement injectpolicy1 term injectterm1 from area 0.0.0.1 set policy-options policy-statement injectpolicy1 term injectterm1 then accept set protocols bgp export injectpolicy1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
将 OSPF 路由注入 BGP 路由表中:
创建策略术语。
[edit policy-options policy-statement injectpolicy1] user@host# set term injectterm1
将 OSPF 指定为匹配条件。
[edit policy-options policy-statement injectpolicy1 term injectterm1] user@host# set from protocol ospf
将来自 OSPF 区域的路由指定为匹配条件。
[edit policy-options policy-statement injectpolicy1 term injectterm1] user@host# set from area 0.0.0.1
指定如果匹配先前条件,则路由将被接受。
[edit policy-options policy-statement injectpolicy1 term injectterm1] user@host# set then accept
将路由策略应用于 BGP。
[edit] user@host# set protocols bgp export injectpolicy1
结果
在配置模式下输入和 show protocols bgp
命令,show policy-options
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@host# show policy-options policy-statement injectpolicy1 { term injectterm1 { from { protocol ospf; area 0.0.0.1; } then accept; } }
user@host# show protocols bgp export injectpolicy1;
完成设备配置后,请从配置模式进入 commit
。
为路由策略配置跟踪
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
set policy-options policy-statement injectpolicy1 term injectterm1 then trace set routing-options traceoptions file ospf-bgp-policy-log set routing-options traceoptions file size 5m set routing-options traceoptions file files 5 set routing-options traceoptions flag policy
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
在策略中包含跟踪操作。
[edit policy-options policy-statement injectpolicy1 term injectterm1] user@host# then trace
为输出配置跟踪文件。
[edit routing-options traceoptions] user@host# set file ospf-bgp-policy-log user@host# set file size 5m user@host# set file files 5 user@host# set flag policy
结果
在配置模式下输入和 show routing-options
命令,show policy-options
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@host# show policy-options policy-statement injectpolicy1 { term injectterm1 { then { trace; } } }
user@host# show routing-options traceoptions { file ospf-bgp-policy-log size 5m files 5; flag policy; }
完成设备配置后,请从配置模式进入 commit
。
示例:将静态路由重新分配给 OSPF
此示例说明如何创建将静态路由重新分配到 OSPF 的策略。
要求
开始之前:
配置设备接口。请参阅 安全设备的接口用户指南。
概述
在此示例中,您将创建一个名为 exportstatic1 的路由策略和一个名为 exportstatic1 的路由术语。该策略将静态路由注入 OSPF。此示例包含以下设置:
policy-statement
-定义路由策略。指定策略的名称并进一步定义策略的元素。策略名称必须是唯一的,并且可以包含字母、数字和连字符 ( -),最长为 255 个字符。term
- 定义路由策略的匹配条件和适用操作。术语名称可包含字母、数字和连字符 (-),最长为 255 个字符。您可以指定术语的名称,并通过包含from
语句来定义传入路由必须匹配的标准,包括语句和在路由满足条件then
时要执行的操作。在此示例中,您可以指定静态协议匹配条件和 accept 操作。export
- 在路由表中将路由导出到 OSPF 时,应用您创建的要评估的导出策略。
拓扑
配置
CLI 快速配置
要快速创建将静态路由注入 OSPF 的策略,请将以下命令复制粘贴到 CLI 中。
[edit] set policy-options policy-statement exportstatic1 term exportstatic1 from protocol static set policy-options policy-statement exportstatic1 term exportstatic1 then accept set protocols ospf export exportstatic1
程序
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的修改 Junos OS 配置。
将静态路由注入 OSPF:
创建路由策略。
[edit] user@host# edit policy-options policy-statement exportstatic1
创建策略术语。
[edit policy-options policy-statement exportstatic1] user@host# set term exportstatic1
将静态指定为匹配条件。
[edit policy-options policy-statement exportstatic1 term exportstatic1] user@host# set from protocol static
指定在匹配前一个条件时将路由接受。
[edit policy-options policy-statement exportstatic1 term exportstatic1] user@host# set then accept
将路由策略应用于 OSPF。
注意:对于 OSPFv3,在
ospf3
层次结构级别包括语句[edit protocols]
。[edit] user@host# set protocols ospf export exportstatic1
完成设备配置后,提交配置。
[edit] user@host# commit
结果
输入和 show protocols ospf
命令以确认show policy-options
您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@host# show policy-options policy-statement exportstatic1 { term exportstatic1 { from protocol static; then accept; } }
user@host# show protocols ospf export exportstatic1;
要确认 OSPFv3 配置,请输入 show policy-options
命令和 show protocols ospf3
命令。
验证
确认配置工作正常。
示例:配置 OSPF 导入策略
此示例说明如何创建 OSPF 导入策略。OSPF 导入策略仅适用于外部路由。外部路由是在 OSPF 自治系统 (AS) 外部的路由。
要求
开始之前:
配置 OSPF 网络中设备的路由器标识符。请参阅 示例:配置 OSPF 路由器标识符。
控制 OSPF 指定的路由器选择。请参阅 示例:控制 OSPF 指定路由器选择。
配置单区域 OSPF 网络。请参阅 示例:配置单区域 OSPF 网络 。
概述
AS 边界路由器可学习外部路由。如果配置 AS 边界路由器将路由重新分配给 OSPF,则可以在整个 OSPF 域中播发外部路由。AS 边界路由器可能从 OSPF 以外的路由协议中学习外部路由,或者外部路由可能是您在 AS 边界路由器上配置的静态路由。
对于 OSPFv3,链路状态播发 (LSA) 称为区域间前缀 LSA,其执行功能与网络汇总 LSA 对 OSPFv2 执行的功能相同。区域边界路由器 (ABR) 会为每个 IPv6 前缀发起一个区域间前缀 LSA,该前缀必须播发到一个区域。
OSPF 导入策略允许您防止将外部路由添加到 OSPF 邻接方路由表中。导入策略不会影响 OSPF 数据库。这意味着导入策略对链路状态通告没有影响。过滤仅在 OSPF 中的外部路由上执行。区域内和区域间路由不考虑用于过滤。默认操作是在路由与策略不匹配时接受路由。
此示例包含以下 OSPF 策略设置:
policy-statement
-定义路由策略。指定策略的名称并进一步定义策略的元素。策略名称必须是唯一的,并且可以包含字母、数字和连字符 ( -),最长为 255 个字符。export
- 应用您创建的导出策略,在网络汇总 LSA 泛洪到某个区域时进行评估。在此示例中,导出策略命名为 export_static。import
- 应用您创建的导入策略,以防止将外部路由添加到路由表中。在此示例中,导入策略命名为 filter_routes。
您在此示例中配置的设备代表以下功能:
R1 — 设备 R1 位于 0.0.0.0 区域,与设备 R2 有直接连接。R1 配置了 OSPF 导出策略。导出策略将静态路由从 R1 的路由表重新分配到 R1 的 OSPF 数据库中。由于静态路由位于 R1 的 OSPF 数据库中,因此路由在 LSA 中播发至 R1 的 OSPF 邻接方。R1 的 OSPF 邻接方是设备 R2。
R2 — 设备 R2 位于 0.0.0.0 区域,与设备 R1 有直接连接。R2 配置了 OSPF 导入策略,该策略将静态路由匹配到 10.0.16.0/30 网络,并阻止静态路由安装在 R2 的路由表中。R2 的 OSPF 邻接方是设备 R1。
配置
CLI 快速配置
要快速配置 OSPF 导入策略,请将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
设备 R1 上的配置:
[edit] set interfaces so-0/2/0 unit 0 family inet address 10.0.2.1/30 set protocols ospf export export_static set protocols ospf area 0.0.0.0 interface so-0/2/0 set policy-options policy-statement export_static from protocol static set policy-options policy-statement export_static then accept
设备 R2 上的配置:
[edit] set interfaces so-0/2/0 unit 0 family inet address 10.0.2.2/30 set protocols ospf import filter_routes set protocols ospf area 0.0.0.0 interface so-0/2/0 set policy-options policy-statement filter_routes from route-filter 10.0.16.0/30 exact set policy-options policy-statement filter_routes then reject
程序
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI用户指南中的修改 Junos OS 配置。
要配置 OSPF 导入策略:
配置接口。
[edit] user@R1# set interfaces so-0/2/0 unit 0 family inet address 10.0.2.1/30
[edit] user@R2# set interfaces so-0/2/0 unit 0 family inet address 10.0.2.2/30
在接口上启用 OSPF。
注意:对于 OSPFv3,在
ospf3
层次结构级别包括语句[edit protocols]
。[edit] user@R1# set protocols ospf area 0.0.0.0 interface so-0/2/0
[edit] user@R2# set protocols ospf area 0.0.0.0 interface so-0/2/0
在 R1 上,将静态路由重新分配给 OSPF。
[edit] user@R1# set protocols ospf export export_static user@R1# set policy-options policy-statement export_static from protocol static user@R1# set policy-options policy-statement export_static then accept
在 R2 上,配置 OSPF 导入策略。
[edit] user@R2# set protocols ospf import filter_routes user@R2# set policy-options policy-statement filter_routes from route-filter 10.0.16.0/30 exact user@R2# set policy-options policy-statement filter_routes then reject
完成设备配置后,提交配置。
[edit] user@host# commit
结果
在相应设备上输入 show interfaces
、 show policy-options
和 show protocols ospf
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
R1 输出:
user@R1# show interfaces so-0/2/0 { unit 0 { family inet { address 10.0.2.1/30; } } }
user@R1# show policy-options policy-statement export_static { from protocol static; then accept; }
user@R1# show protocols ospf export export_static; area 0.0.0.0 { interface so-0/2/0.0; }
R2 输出:
user@R2# show interfaces so-0/2/0 { unit 0 { family inet { address 10.0.2.2/30; } } }
user@R2# show policy-options policy-statement filter_routes { from { route-filter 10.0.16.0/30 exact; } then reject; }
user@R2# show protocols ospf import filter_routes; area 0.0.0.0 { interface so-0/2/0.0; }
要确认 OSPFv3 配置,请在show interfaces
相应设备上输入 、 show routing-options
show policy-options
和show protocols ospf3
命令。
示例:配置路由过滤器策略以指定通过 OSPF 学习的前缀的优先级
此示例说明如何创建 OSPF 导入策略,用于确定通过 OSPF 学习到的特定前缀的优先级。
要求
开始之前:
配置设备接口。请参阅 安全设备的接口用户指南。
配置 OSPF 网络中设备的路由器标识符。请参阅 示例:配置 OSPF 路由器标识符。
控制 OSPF 指定路由器选择请参阅 示例:控制 OSPF 指定路由器选择
配置单区域 OSPF 网络。请参阅 示例:配置单区域 OSPF 网络 。
配置多区域 OSPF 网络。请参阅 示例:配置多区域 OSPF 网络。
概述
在具有大量 OSPF 路由的网络中,可以控制路由的更新顺序,以响应网络拓扑更改。在 Junos OS 9.3 及更高版本中,您可以为 OSPF 导入策略中包含的前缀指定高、中或低的优先级。如果 OSPF 拓扑发生变化,将首先更新路由表中的高优先级前缀,然后更新中低优先级前缀。
OSPF 导入策略只能用于设置优先级或过滤 OSPF 外部路由。如果应用了 OSPF 导入策略,从而导致 reject
非外部路由的终止操作,则 reject
操作将被忽略,并且无论如何都接受路由。默认情况下,此类路由已安装在路由表中,优先级为低。此行为可确保 OSPF 域中的一致路由,防止流量黑洞,即默默丢弃的流量。
通常,未显式分配优先级的 OSPF 路由被视为优先级介质,但以下情况除外:
汇总丢弃路由的默认优先级为低。
未添加到路由表中的本地路由将分配低优先级。
被导入策略拒绝,因此未添加到路由表中的外部路由的优先级为低。
适用于 OSPF 路由的任何可用匹配标准都可用于确定优先级。OSPF 的两个最常用的匹配标准是 route-filter
and tag
语句。
在此示例中,路由设备位于 0.0.0.0 区域,带有接口 fe-0/1/0
并 fe-1/1/0
连接到相邻设备。您可以配置名为 ospf-import 的导入路由策略,为通过 OSPF 获知的前缀指定优先级。与这些前缀关联的路由按前缀指定的优先级顺序安装在路由表中。首先安装匹配 192.0.2.0/24 orlonger
的路由,因为它们的优先级 high
为。接下来安装匹配 198.51.100.0/24 orlonger
的路由,因为它们的优先级 medium
为。匹配 203.0.113.0/24 orlonger
的路由安装最晚,因为它们的优先级为 low
。然后,将导入策略应用于 OSPF。
当安装新路由或对现有路由进行更改时,优先级值将生效。
拓扑
配置
CLI 快速配置
要快速配置 OSPF 导入策略,以便确定通过 OSPF 学习到的特定前缀的优先级,请将以下命令复制粘贴到文本文件中,删除所有换行符,更改与网络配置匹配所需的详细信息,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
[edit] set interfaces fe-0/1/0 unit 0 family inet address 192.168.8.4/30 set interfaces fe-0/1/0 unit 0 family inet address 192.168.8.5/30 set policy-options policy-statement ospf-import term t1 from route-filter 203.0.113.0/24 orlonger set policy-options policy-statement ospf-import term t1 then priority low set policy-options policy-statement ospf-import term t1 then accept set policy-options policy-statement ospf-import term t2 from route-filter 198.51.100.0/24 orlonger set policy-options policy-statement ospf-import term t2 then priority medium set policy-options policy-statement ospf-import term t2 then accept set policy-options policy-statement ospf-import term t3 from route-filter 192.0.2.0/24 orlonger set policy-options policy-statement ospf-import term t3 then priority high set policy-options policy-statement ospf-import term t3 then accept set protocols ospf import ospf-import set protocols ospf area 0.0.0.0 interface fe-0/1/0 set protocols ospf area 0.0.0.0 interface fe-1/1/0
程序
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI用户指南中的修改 Junos OS 配置。
要配置 OSPF 导入策略来划分特定前缀的优先级:
配置接口。
[edit] user@host# set interfaces fe-0/1/0 unit 0 family inet address 192.168.8.4/30 user@host# set interfaces fe-0/2/0 unit 0 family inet address 192.168.8.5/30
在接口上启用 OSPF。
注意:对于 OSPFv3,在
ospf3
层次结构级别包括语句[edit protocols]
。[edit] user@host# set protocols ospf area 0.0.0.0 interface fe-0/1/0 user@host# set protocols ospf area 0.0.0.0 interface fe-0/2/0
配置策略以指定通过 OSPF 学习的前缀的优先级。
[edit ] user@host# set policy-options policy-statement ospf-import term t1 from route-filter 203.0.113.0/24 orlonger user@host# set policy-options policy-statement ospf-import term t1 then priority low user@host# set policy-options policy-statement ospf-import term t1 then accept user@host# set policy-options policy-statement ospf-import term t2 from route-filter 198.51.100.0/24 orlonger user@host# set policy-options policy-statement ospf-import term t2 then priority medium user@host# set policy-options policy-statement ospf-import term t2 then accept user@host# set policy-options policy-statement ospf-import term t3 from route-filter 192.0.2.0/24 orlonger user@host# set policy-options policy-statement ospf-import term t3 then priority high user@host# set policy-options policy-statement ospf-import term t3 then accept
将策略应用于 OSPF。
[edit] user@host# set protocols ospf import ospf-import
完成设备配置后,提交配置。
[edit] user@host# commit
结果
输入 show interfaces
、 show policy-options
和命令, show protocols ospf
以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@host# show interfaces fe-0/1/0 { unit 0 { family inet { address 192.168.8.4/30; } } } fe-0/2/0 { unit 0 { family inet { address 192.168.8.5/30; } } }
user@host# show protocols ospf import ospf-import; area 0.0.0.0 { interface fe-0/1/0.0; interface fe-0/2/0.0; }
user@host# show policy-options policy-statement ospf-import { term t1 { from { route-filter 203.0.113.0/24 orlonger; } then { priority low; accept; } } term t2 { from { route-filter 198.51.100.0/24 orlonger; } then { priority medium; accept; } } term t3 { from { route-filter 192.0.2.0/24 orlonger; } then { priority high; accept; } } }
user@host# show protocols ospf import ospf-import; area 0.0.0.0 { interface fe-0/1/0.0; interface fe-0/2/0.0; }
要确认 OSPFv3 配置,请输入 show interfaces
、 show policy-options
和 show protocols ospf3
命令。
网络摘要的导入和导出策略概述
默认情况下,OSPF 使用网络摘要链路状态通告 (LSA) 跨区域边界传输路由信息。每个区域边界路由器 (ABR) 都会将网络汇总 LSA 泛洪到同一区域中的其他路由设备。ABR 还控制来自该地区的路由用于将网络汇总 LSA 生成到其他区域。每个 ABR 都会为其连接的每个区域维护一个单独的拓扑数据库。在 Junos OS 9.1 及更高版本中,您可以为 OSPFv2 和 OSPFv3 配置导出和导入策略,以便控制网络摘要 LSA(其中包含有关区域间 OSPF 前缀的信息)的分发和生成方式。对于 OSPFv3,LSA 被称为区域间前缀 LSA,其执行的功能与网络汇总 LSA 对 OSPFv2 执行的功能相同。ABR 为每个 IPv6 前缀发起一个区域间前缀 LSA,该前缀必须播发到一个区域。
您可以通过导出策略指定将哪些汇总 LSA 泛洪到一个区域。通过导入策略,您可以控制使用从一个区域学习的路由来将汇总 LSA 生成到其他区域。您可以在层次结构级别定义路由策略 [edit policy-options policy-statement policy-name]
。与所有 OSPF 导出策略一样,网络摘要 LSA 导出策略的默认设置是拒绝所有导出策略。同样,与所有 OSPF 导入策略一样,网络摘要 LSA 导入策略的默认设置是接受所有 OSPF 路由。
示例:为网络摘要配置 OSPF 导出策略
此示例说明如何创建 OSPF 导出策略来控制 ABR 泛滥到 OSPF 区域的网络汇总(类型 3)LSA。
要求
开始之前:
配置 OSPF 网络中设备的路由器标识符。请参阅 示例:配置 OSPF 路由器标识符。
控制 OSPF 指定的路由器选择。请参阅 示例:控制 OSPF 指定路由器选择
概述
OSPF 使用网络摘要 LSA 跨区域边界传输路由信息。根据您的网络环境,您可能需要进一步过滤 OSPF 区域之间的网络汇总 LSA。例如,如果您创建 OSPF 区域来定义管理边界,则可能不希望在这些区域之间播发内部路由信息。要进一步改进对多个 OSPF 区域之间的路由分布的控制,可以在 ABR 上为要过滤网络汇总 LSA 通告的区域配置网络摘要策略。
对于 OSPFv3,LSA 被称为区域间前缀 LSA,其执行的功能与网络汇总 LSA 对 OSPFv2 执行的功能相同。ABR 为每个 IPv6 前缀发起一个区域间前缀 LSA,该前缀必须播发到一个区域。在本主题中,网络汇总策略和网络汇总策略用于描述 OSPFv2 和 OSPFv3 功能的术语。
以下准则适用于导出网络摘要策略:
在配置这些策略之前,您应该全面了解自己的网络。网络摘要策略配置不正确可能会导致意外结果,例如路由效果欠佳或流量丢弃。
建议对这些类型的策略使用 路由过滤器 策略匹配条件。
我们建议对这些
accept
类型的策略使用和reject
路由策略条款。
图 3 显示了一个包含三个 OSPF 区域的示例拓扑。R4 为区域 4 中的路由生成网络汇总,并将其从区域 4 发送到区域 0。R3 为区域 3 中的路由生成网络汇总,并将其从区域 3 发送到区域 0。

在此示例中,您将使用名为 export-policy 的导出网络摘要策略配置 R4,该策略仅允许从区域 3 到区域 4 与 10.0.4.4 前缀匹配的路由。导出策略控制 R4 淹没到 4 区域的网络汇总 LSA。这将导致仅允许的区域间路由进入区域 4,并将所有其他区域间路由从 OSPF 数据库和区域 4 中的设备的路由表中清除。首先定义策略,然后通过包括 network-summary-export
OSPFv2 的语句或 OSPFv3 的 inter-area-prefix-export
语句来将其应用到 ABR。
这些设备的运行方式如下:
R1 — 设备 R1 是区域 3 的内部路由器。接口
fe-0/1/0
的 IP 地址为 10.0.4.13/30 并连接到 R3。接口fe-0/0/1
的 IP 地址为 10.0.4.5/30 并连接到 R2。R2 — 设备 R2 是区域 3 中的一个内部路由器。接口
fe-0/0/1
的 IP 地址为 10.0.4.6/30 并连接到 R1。接口fe-1/0/0
的 IP 地址为 10.0.4.1 并连接到 R3。R3 — 设备 R3 参与区域 3 和区域 0。R3 是区域 3 和区域 0 之间的 ABR,并在区域之间传递网络汇总 LSA。接口
fe-1/0/0
的 IP 地址为 10.0.4.2/30 并连接到 R2。接口fe-1/1/0
的 IP 地址为 10.0.4.14/30 并连接到 R1。接口fe-0/0/1
的 IP 地址为 10.0.2.1/30 并连接到 R4。R4 — 设备 R4 参与区域 0 和区域 4。R4 是区域 0 和区域 4 之间的 ABR,并在区域之间传递网络汇总 LSA。接口
fe-0/0/1
的 IP 地址为 10.0.2.4/30 并连接到 R3。接口fe-1/1/0
的 IP 地址为 10.0.8.6/30 并连接到 R5。接口fe-1/0/0
的 IP 地址为 10.0.8.9/30 并连接到 R6。R5 — 设备 R5 是区域 4 中的一个内部路由器。接口
fe-1/1/0
的 IP 地址为 10.0.8.5/30,并连接到 R4。R6 — 设备 R6 是区域 4 中的一个内部路由器。接口
fe-1/0/0
的 IP 地址为 10.0.8.10/30 并连接到 R4。
配置
CLI 快速配置
要为网络摘要快速配置 OSPF 导出策略,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
设备 R1 上的配置:
[edit] set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.13/30 set interfaces fe-0/0/1 unit 0 family inet address 10.0.4.5/30 set protocols ospf area 0.0.0.3 interface fe-0/1/0 set protocols ospf area 0.0.0.3 interface fe-0/0/1
设备 R2 上的配置:
[edit] set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.6/30 set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.1/30 set protocols ospf area 0.0.0.3 interface fe-0/1/0 set protocols ospf area 0.0.0.3 interface fe-1/0/0
设备 R3 上的配置:
[edit] set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.2/30 set interfaces fe-1/1/0 unit 0 family inet address 10.0.4.14/30 set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30 set protocols ospf area 0.0.0.3 interface fe-1/0/0 set protocols ospf area 0.0.0.3 interface fe-1/1/0 set protocols ospf area 0.0.0.0 interface fe-0/0/1
设备 R4 上的配置:
[edit] set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30 set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.6/30 set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.9/30 set policy-options policy-statement export-policy term term1 from route-filter 10.0.4.4/30 prefix-length-range /30-/30 set policy-options policy-statement export-policy term term1 then accept set protocols ospf area 0.0.0.0 interface fe-0/0/1 set protocols ospf area 0.0.0.4 interface fe-0/1/0 set protocols ospf area 0.0.0.4 interface fe-1/0/0 set protocols ospf area 0.0.0.4 network-summary-export export-policy
设备 R5 上的配置:
[edit] set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.5/30 set protocols ospf area 0.0.0.4 interface fe-0/1/0
设备 R6 上的配置:
[edit] set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.10/30 set protocols ospf area 0.0.0.4 interface fe-1/0/0
程序
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的修改 Junos OS 配置。
要为网络摘要配置 OSPF 导出策略,
配置接口。
注意:对于 OSPFv3,请使用 IPv6 地址。
[edit] user@R1# set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.13/30 user@R1# set interfaces fe-0/0/1 unit 0 family inet address 10.0.4.5/30
[edit] user@R2# set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.6/30 user@R2# set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.1/30
[edit] user@R3# set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.2/30 user@R3# set interfaces fe-1/1/0 unit 0 family inet address 10.0.4.14/30 user@R3#set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30
[edit] user@R4# set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30 user@R4# set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.6/30 user@R4# set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.9/30
[edit] user@R5# set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.5/30
[edit] user@R6# set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.10/30
在接口上启用 OSPF。
注意:对于 OSPFv3,在
ospf3
层次结构级别包括语句[edit protocols]
。[edit] user@R1# set protocols ospf area 0.0.0.3 interface fe-0/1/0 user@R1# set protocols ospf area 0.0.0.3 interface fe-0/0/1
[edit] user@R2# set protocols ospf area 0.0.0.3 interface fe-0/1/0 user@R2# set protocols ospf area 0.0.0.3 interface fe-1/0/0
[edit] user@R3# set protocols ospf area 0.0.0.3 interface fe-1/0/0 user@R3# set protocols ospf area 0.0.0.3 interface fe-1/1/0 user@R3# set protocols ospf area 0.0.0.0 interface fe-0/0/1
[edit] user@R4# set protocols ospf area 0.0.0.0 interface fe-0/0/1 user@R4# set protocols ospf area 0.0.0.4 interface fe-1/1/0 user@R4# set protocols ospf area 0.0.0.4 interface fe-1/0/0
[edit] user@R5# set protocols ospf area 0.0.0.4 interface fe-1/1/0
[edit] user@R6# set protocols ospf area 0.0.0.4 interface fe-1/0/0
在 R4 上,配置导出网络摘要策略。
[edit ] user@R4# set policy-options policy-statement export-policy term term1 from route-filter 10.0.4.4/30 prefix-length-range /30-/30 user@R4# set policy-options policy-statement export-policy term term1 then accept
在 R4 上,将导出网络摘要策略应用于 OSPF。
注意:对于 OSPFv3,在
inter-area-prefix-export
层次结构级别包括语句[edit protocols ospf3 area area-id]
。[edit] user@R4# set protocols ospf area 0.0.0.4 network-summary-export export-policy
完成设备配置后,提交配置。
[edit] user@host# commit
结果
在相应设备上输入 show interfaces
、 show policy-options
和 show protocols ospf
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
R1 输出:
user@R1# show interfaces fe-0/0/1 { unit 0 { family inet { address 10.0.4.5/30; } } } fe-1/1/0 { unit 0 { family inet { address 10.0.4.13/30; } } }
user@R1# show protocols ospf area 0.0.0.3 { interface fe-0/1/0.0; interface fe-0/0/1.0; }
R2 输出:
user@R2# show interfaces fe-0/1/0 { unit 0 { family inet { address 10.0.4.6/30; } } } fe-1/0/0 { unit 0 { family inet { address 10.0.4.3/30; } } }
user@R2# show protocols ospf area 0.0.0.3 { interface fe-0/1/0.0; interface fe-1/0/0.0; }
R3 输出:
user@R3# show interfaces fe-0/0/1 { unit 0 { family inet { address 10.0.2.3/30; } } } fe-1/0/0 { unit 0 { family inet { address 10.0.4.2/30; } } } fe-1/1/0 { unit 0 { family inet { address 10.0.4.14/30; } } }
user@R3# show protocols ospf area 0.0.0.0 { interface fe-0/0/1.0; } area 0.0.0.3 { interface fe-1/0/0.0; interface fe-1/1/0.0; }
R4 的输出:
user@R4# show interfaces fe-0/0/1 { unit 0 { family inet { address 10.0.2.4/30; } } } fe-1/0/0 { unit 0 { family inet { address 10.0.8.6/30; } } } fe-1/1/0 { unit 0 { family inet { address 10.0.8.3/30; } } }
user@R4# show protocols ospf area 0.0.0.0 { interface fe-0/0/1.0; } area 0.0.0.4 { network-summary-export export-policy; interface fe-1/0/0.0; interface fe-1/1/0.0; }
user@R4# show policy-options policy-statement export-policy { term term1 { from { route-filter 10.0.4.4/30 prefix-length-range /30-/30; } then accept; } }
R5 输出:
user@R5# show interfaces fe-1/1/0 { unit 0 { family inet { address 10.0.8.5/30; } } }
user@R5# show protocols ospf area 0.0.0.4 { interface fe-1/1/0.0; }
R6 输出:
user@R6# show interfaces fe-1/0/0 { unit 0 { family inet { address 10.0.8.7/30; } } }
user@R6# show protocols ospf area 0.0.0.4 { interface fe-1/0/0.0; }
要确认 OSPFv3 配置,请在 show interfaces
相应设备上输入 、 show policy-options
和 show protocols ospf3
命令。
验证
确认配置工作正常。
验证 OSPF 数据库
目的
验证区域 4 中设备的 OSPF 数据库是否包括我们在 ABR R4 上允许的区域间路由。未指定的其他区域间路由应老化或不再存在于 OSPF 数据库中。
行动
在操作模式下,输入 show ospf database netsummary area 0.0.0.4
OSPFv2 的命令,然后为 OSPFv3 输入 show ospf3 database inter-area-prefix area 0.0.0.4
命令。
示例:为网络摘要配置 OSPF 导入策略
此示例说明如何创建 OSPF 导入策略来控制 ABR 从 OSPF 区域播发的网络汇总(类型 3)LSA。
要求
开始之前:
配置 OSPF 网络中设备的路由器标识符。请参阅 示例:配置 OSPF 路由器标识符。
控制 OSPF 指定的路由器选择。请参阅 示例:控制 OSPF 指定路由器选择。
概述
OSPF 使用网络摘要 LSA 跨区域边界传输路由信息。根据您的网络环境,您可能需要进一步过滤 OSPF 区域之间的网络汇总 LSA。例如,如果您创建 OSPF 区域来定义管理边界,则可能不希望在这些区域之间播发内部路由信息。要进一步改进对多个 OSPF 区域之间的路由分布的控制,可以在 ABR 上为要过滤网络汇总 LSA 通告的区域配置网络摘要策略。
对于 OSPFv3,LSA 被称为区域间前缀 LSA,其执行的功能与网络汇总 LSA 对 OSPFv2 执行的功能相同。ABR 为每个 IPv6 前缀发起一个区域间前缀 LSA,该前缀必须播发到一个区域。在本主题中,网络汇总策略和网络汇总策略用于描述 OSPFv2 和 OSPFv3 功能的术语。
以下准则适用于导入网络摘要策略:
在配置这些策略之前,您应该全面了解自己的网络。网络摘要策略配置不正确可能会导致意外结果,例如路由效果欠佳或流量丢弃。
我们建议对这些
route-filter
类型的策略使用策略匹配条件。我们建议对这些
accept
类型的策略使用和reject
路由策略条款。
图 4 显示了包含三个 OSPF 区域的示例拓扑。R4 为区域 4 中的路由生成网络汇总,并将其从区域 4 发送到区域 0。R3 为区域 3 中的路由生成网络汇总,并将其从区域 3 发送到区域 0。

在此示例中,您将使用名为 import-policy 的导入网络摘要策略配置 R3,因此 R3 仅为路由 10.0.4.12/30 生成网络摘要。导入策略控制路由,因此网络汇总 R3 在区域 3 外播发,因此应用此策略意味着 R3 仅播发区域 3 中的路由 10.0.4.12/30。这将导致从区域 0 和区域 4 的 OSPF 数据库中清除来自其他区域间路由的现有网络摘要,以及区域 0 和区域 4 中设备的路由表。首先定义策略,然后通过包括 network-summary-import
OSPFv2 的语句或 OSPFv3 的 inter-area-prefix-import
语句来将其应用到 ABR。
这些设备的运行方式如下:
R1 — 设备 R1 是区域 3 的内部路由器。接口
fe-0/1/0
的 IP 地址为 10.0.4.13/30 并连接到 R3。接口fe-0/0/1
的 IP 地址为 10.0.4.5/30 并连接到 R2。R2 — 设备 R2 是区域 3 中的一个内部路由器。接口
fe-0/0/1
的 IP 地址为 10.0.4.6/30 并连接到 R1。接口fe-1/0/0
的 IP 地址为 10.0.4.1/30 并连接到 R3。R3 — 设备 R3 参与区域 3 和区域 0。R3 是区域 3 和区域 0 之间的 ABR,并在区域之间传递网络汇总 LSA。接口
fe-1/0/0
的 IP 地址为 10.0.4.2/30 并连接到 R2。接口fe-1/1/0
的 IP 地址为 10.0.4.14/30 并连接到 R1。接口fe-0/0/1
的 IP 地址为 10.0.2.1/30 并连接到 R4。R4 — 设备 R4 参与区域 0 和区域 4。R4 是区域 0 和区域 4 之间的 ABR,并在区域之间传递网络汇总 LSA。接口
fe-0/0/1
的 IP 地址为 10.0.2.1/30 并连接到 R3。接口fe-1/1/0
的 IP 地址为 10.0.8.6/30 并连接到 R5。接口fe-1/0/0
的 IP 地址为 10.0.8.9/30 并连接到 R6。R5 — 设备 R5 是区域 4 中的一个内部路由器。接口
fe-1/1/0
的 IP 地址为 10.0.8.5/30,并连接到 R4。R6 — 设备 R6 是区域 4 中的一个内部路由器。接口
fe-1/0/0
的 IP 地址为 10.0.8.10/30 并连接到 R4。
配置
程序
CLI 快速配置
要为网络摘要快速配置 OSPF 导入策略,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit
。
设备 R1 上的配置:
[edit] set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.13/30 set interfaces fe-0/0/1 unit 0 family inet address 10.0.4.5/30 set protocols ospf area 0.0.0.3 interface fe-0/1/0 set protocols ospf area 0.0.0.3 interface fe-0/0/1
设备 R2 上的配置:
[edit] set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.6/30 set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.1/30 set protocols ospf area 0.0.0.3 interface fe-0/1/0 set protocols ospf area 0.0.0.3 interface fe-1/0/0
设备 R3 上的配置:
[edit] set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.2/30 set interfaces fe-1/1/0 unit 0 family inet address 10.0.4.14/30 set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30 set policy-options policy-statement import-policy term term1 from route-filter 10.0.4.12/30 prefix-length-range /30-/30 set policy-options policy-statement import-policy term term1 then accept set protocols ospf area 0.0.0.3 interface fe-1/0/0 set protocols ospf area 0.0.0.3 interface fe-1/1/0 set protocols ospf area 0.0.0.0 interface fe-0/0/1 set protocols ospf area 0.0.0.3 network-summary-import import-policy
设备 R4 上的配置:
[edit] set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30 set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.6/30 set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.9/30 set protocols ospf area 0.0.0.0 interface fe-0/0/1 set protocols ospf area 0.0.0.4 interface fe-1/1/0 set protocols ospf area 0.0.0.4 interface fe-1/0/0
设备 R5 上的配置:
[edit] set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.5/30 set protocols ospf area 0.0.0.4 interface fe-1/1/0
设备 R6 上的配置:
[edit] set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.10/30 set protocols ospf area 0.0.0.4 interface fe-1/0/0
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的修改 Junos OS 配置。
要为网络摘要配置 OSPF 导入策略:
配置接口。
注意:对于 OSPFv3,请使用 IPv6 地址。
[edit] user@R1# set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.13/30 user@R1# set interfaces fe-0/0/1 unit 0 family inet address 10.0.4.5/30
[edit] user@R2# set interfaces fe-0/1/0 unit 0 family inet address 10.0.4.6/30 user@R2# set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.1/30
[edit] user@R3# set interfaces fe-1/0/0 unit 0 family inet address 10.0.4.2/30 user@R3# set interfaces fe-1/1/0 unit 0 family inet address 10.0.4.14/30 user@R3#set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30
[edit] user@R4# set interfaces fe-0/0/1 unit 0 family inet address 10.0.2.1/30 user@R4# set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.6/30 user@R4# set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.9/30
[edit] user@R5# set interfaces fe-1/1/0 unit 0 family inet address 10.0.8.5/30
[edit] user@R6# set interfaces fe-1/0/0 unit 0 family inet address 10.0.8.10/30
在接口上启用 OSPF。
注意:对于 OSPFv3,在
ospf3
层次结构级别包括语句[edit protocols]
。[edit] user@R1# set protocols ospf area 0.0.0.3 interface fe-0/1/0 user@R1# set protocols ospf area 0.0.0.3 interface fe-0/0/1
[edit] user@R2# set protocols ospf area 0.0.0.3 interface fe-0/1/0 user@R2# set protocols ospf area 0.0.0.3 interface fe-1/0/0
[edit] user@R3# set protocols ospf area 0.0.0.3 interface fe-1/0/0 user@R3# set protocols ospf area 0.0.0.3 interface fe-1/1/0 user@R3# set protocols ospf area 0.0.0.0 interface fe-0/0/1
[edit] user@R4# set protocols ospf area 0.0.0.0 interface fe-0/0/1 user@R4# set protocols ospf area 0.0.0.4 interface fe-1/1/0 user@R4# set protocols ospf area 0.0.0.4 interface fe-1/0/0
[edit] user@R5# set protocols ospf area 0.0.0.4 interface fe-1/1/0
[edit] user@R6# set protocols ospf area 0.0.0.4 interface fe-1/0/0
在 R3 上,配置导入网络摘要策略。
[edit ] user@R3# set policy-options policy-statement import-policy term term1 from route-filter 10.0.4.12/30 prefix-length-range /30-/30 user@R3# set policy-options policy-statement import-policy term term1 then accept
在 R3 上,将导入网络摘要策略应用于 OSPF。
注意:对于 OSPFv3,在
inter-area-prefix-export
层次结构级别包括语句[edit protocols ospf3 area area-id]
。[edit] user@R3# set protocols ospf area 0.0.0.3 network-summary-import import-policy
完成设备配置后,提交配置。
[edit] user@host# commit
结果
在相应设备上输入 show interfaces
、 show policy-options
和 show protocols ospf
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
R1 输出:
user@R1# show interfaces fe-0/0/1 { unit 0 { family inet { address 10.0.4.5/30; } } } fe-0/1/0 { unit 0 { family inet { address 10.0.4.13/30; } } }
user@R1# show protocols ospf area 0.0.0.3 { interface fe-0/1/0.0; interface fe-0/0/1.0; }
R2 输出:
user@R2# show interfaces fe-0/1/0 { unit 0 { family inet { address 10.0.4.6/30; } } } fe-1/0/0 { unit 0 { family inet { address 10.0.4.1/30; } } }
user@R2# show protocols ospf area 0.0.0.3 { interface fe-0/1/0.0; interface fe-1/0/0.0; }
R3 输出:
user@R3# show interfaces fe-0/0/1 { unit 0 { family inet { address 10.0.2.1/30; } } } fe-1/0/0 { unit 0 { family inet { address 10.0.4.2/30; } } } fe-1/1/0 { unit 0 { family inet { address 10.0.4.14/30; } } }
user@R3# show protocols ospf area 0.0.0.0 { interface fe-0/0/1.0; } area 0.0.0.3 { network-summary-import import policy; interface fe-1/0/0.0; interface fe-1/1/0.0; }
user@R3# show policy-options policy-statement import-policy { term term1 { from { route-filter 10.0.4.12/30 prefix-length-range /30-/30; } then accept; } }
R4 的输出:
user@R4# show interfaces fe-0/0/1 { unit 0 { family inet { address 10.0.2.1/30; } } } fe-1/0/0 { unit 0 { family inet { address 10.0.8.9/30; } } } fe-1/1/0 { unit 0 { family inet { address 10.0.8.6/30; } } }
user@R4# show protocols ospf area 0.0.0.0 { interface fe-0/0/1.0; } area 0.0.0.4 { interface fe-0/1/0.0; interface fe-1/0/0.0; }
R5 输出:
user@R5# show interfaces fe-1/1/0 { unit 0 { family inet { address 10.0.8.5/30; } } }
user@R5# show protocols ospf area 0.0.0.4 { interface fe-1/1/0.0; }
R6 输出:
user@R6# show interfaces fe-1/0/0 { unit 0 { family inet { address 10.0.8.10/30; } } }
user@R6# show protocols ospf area 0.0.0.4 { interface fe-1/0/0.0; }
要确认 OSPFv3 配置,请在 show interfaces
相应设备上输入 、 show policy-options
和 show protocols ospf3
命令。
验证
确认配置工作正常。
验证 OSPF 数据库
目的
验证区域 4 中设备的 OSPF 数据库是否包括我们从 R3 发发的区域间路由。来自区域 3 的任何其他路由都不应播发到区域 4,因此这些条目应老化或不再存在于 OSPF 数据库中。
行动
在操作模式下,输入 show ospf database netsummary area 0.0.0.4
OSPFv2 的命令,然后为 OSPFv3 输入 show ospf3 database inter-area-prefix area 0.0.0.4
命令。
示例:将 OSPF 路由重新分配给 IS-IS
此示例说明如何将 OSPF 路由重新分配到 IS-IS 网络中。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
概述
导出策略可应用于 IS-IS,以方便路由重新分配。
Junos OS 不支持为 IS-IS 等链路状态路由协议应用导入策略,因为此类策略会导致链路状态数据库 (LSDB) 条目不一致,进而可能导致路由不一致。
在此示例中,OSPF 路由 192.168.0/24 至 192.168.3/24 将从设备 R2 重新分配到 IS-IS 区域 49.0002。
此外,配置了策略以确保设备 R1 能够到达 10.0.0.44/30 网络上的目标,并且设备 R3 可以到达 10.0.0.36/30 网络上的目标。这样可以实现端到端可达性。
图 5 显示了此示例中使用的拓扑。

CLI 快速配置 显示了 图 5 中所有设备的配置。第 d109e62__d109e232 节介绍了设备 R2 上的步骤。 #d109e62__d109e361 介绍了设备 R3 上的步骤。
拓扑
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层级的 [edit]
CLI 中。
设备 R1
set interfaces fe-1/2/0 unit 0 description to-R7 set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.38/30 set interfaces fe-1/2/0 unit 0 family iso set interfaces lo0 unit 0 family inet address 172.16.3.5/32 set interfaces lo0 unit 0 family iso address 49.0002.0172.0016.0305.00 set protocols isis interface fe-1/2/0.0 set protocols isis interface lo0.0
设备 R2
set interfaces fe-1/2/1 unit 0 description to-R5 set interfaces fe-1/2/1 unit 0 family inet address 10.0.0.37/30 set interfaces fe-1/2/1 unit 0 family iso set interfaces fe-1/2/0 unit 0 description to-OSPF-network set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.45/30 set interfaces lo0 unit 0 family inet address 172.16.9.7/32 set interfaces lo0 unit 0 family iso address 49.0002.0172.0016.0907.00 set protocols isis export ospf-isis set protocols isis export send-direct-to-isis-neighbors set protocols isis interface fe-1/2/1.0 set protocols isis interface lo0.0 set protocols ospf export send-direct-to-ospf-neighbors set protocols ospf area 0.0.0.1 interface fe-1/2/0.0 set protocols ospf area 0.0.0.1 interface lo0.0 passive set policy-options policy-statement ospf-isis term 1 from protocol ospf set policy-options policy-statement ospf-isis term 1 from route-filter 192.168.0.0/22 longer set policy-options policy-statement ospf-isis term 1 then accept set policy-options policy-statement send-direct-to-isis-neighbors from protocol direct set policy-options policy-statement send-direct-to-isis-neighbors from route-filter 10.0.0.44/30 exact set policy-options policy-statement send-direct-to-isis-neighbors then accept set policy-options policy-statement send-direct-to-ospf-neighbors from protocol direct set policy-options policy-statement send-direct-to-ospf-neighbors from route-filter 10.0.0.36/30 exact set policy-options policy-statement send-direct-to-ospf-neighbors then accept
设备 R3
set interfaces fe-1/2/0 unit 0 family inet address 10.0.0.46/30 set interfaces lo0 unit 0 family inet address 192.168.1.1/32 set interfaces lo0 unit 0 family inet address 192.168.2.1/32 set interfaces lo0 unit 0 family inet address 192.168.3.1/32 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set protocols ospf export ospf set protocols ospf area 0.0.0.1 interface fe-1/2/0.0 set protocols ospf area 0.0.0.1 interface lo0.0 passive set policy-options policy-statement ospf term 1 from protocol static set policy-options policy-statement ospf term 1 then accept set routing-options static route 192.168.0.0/24 discard set routing-options static route 192.168.1.0/24 discard set routing-options static route 192.168.3.0/24 discard set routing-options static route 192.168.2.0/24 discard
逐步过程
要配置设备 R2:
配置网络接口。
[edit interfaces] user@R2# set fe-1/2/1 unit 0 description to-R5 user@R2# set fe-1/2/1 unit 0 family inet address 10.0.0.37/30 user@R2# set fe-1/2/1 unit 0 family iso user@R2# set fe-1/2/0 unit 0 description to-OSPF-network user@R2# set fe-1/2/0 unit 0 family inet address 10.0.0.45/30 user@R2# set lo0 unit 0 family inet address 172.16.9.7/32 user@R2# set lo0 unit 0 family iso address 49.0002.0172.0016.0907.00
在面向设备 R1 的接口和环路接口上配置 IS-IS。
[edit protocols isis] user@R2# set interface fe-1/2/1.0 user@R2# set interface lo0.0
配置使设备 R1 能够访问 10.0.0.44/30 网络的策略。
[edit policy-options policy-statement send-direct-to-isis-neighbors] user@R2# set from protocol direct user@R2# set from route-filter 10.0.0.44/30 exact user@R2# set then accept
应用使设备 R1 能够到达 10.0.0.44/30 网络的策略。
[edit protocols isis] user@R2# set export send-direct-to-isis-neighbors
在接口上配置 OSPF。
[edit protocols ospf] user@R2# set area 0.0.0.1 interface fe-1/2/0.0 user@R2# set area 0.0.0.1 interface lo0.0 passive
配置 OSPF 路由重新分配策略。
[edit policy-options policy-statement ospf-isis term 1] user@R2# set from protocol ospf user@R2# set from route-filter 192.168.0.0/22 longer user@R2# set then accept
将 OSPF 路由重新分配策略应用于 IS-IS 实例。
[edit protocols isis] user@R2# set export ospf-isis
配置使设备 R3 能够到达 10.0.0.36/30 网络的策略。
[edit policy-options policy-statement send-direct-to-ospf-neighbors] user@R2# set from protocol direct user@R2# set from route-filter 10.0.0.36/30 exact user@R2# set then accept
应用使设备 R3 能够到达 10.0.0.36/30 网络的策略。
[edit protocols ospf] user@R2# set export send-direct-to-ospf-neighbors
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置多级别 IS-IS:
配置网络接口。
环路接口上配置了多个地址,以模拟多个路由目标。
[edit interfaces] user@R3# set fe-1/2/0 unit 0 family inet address 10.0.0.46/30 user@R3# set lo0 unit 0 family inet address 192.168.1.1/32 user@R3# set lo0 unit 0 family inet address 192.168.2.1/32 user@R3# set lo0 unit 0 family inet address 192.168.3.1/32 user@R3# set lo0 unit 0 family inet address 192.168.0.1/32
配置到环路接口地址的静态路由。
这些是重新分配到 IS-IS 中的路由。
[edit routing-options static] user@R3# set route 192.168.0.0/24 discard user@R3# set route 192.168.1.0/24 discard user@R3# set route 192.168.3.0/24 discard user@R3# set route 192.168.2.0/24 discard
在接口上配置 OSPF。
[edit protocols ospf area 0.0.0.1] user@R3# set interface fe-1/2/0.0 user@R3# set interface lo0.0 passive
配置 OSPF 策略以导出静态路由。
[edit policy-options policy-statement ospf term 1] user@R3# set from protocol static user@R3# set then accept
应用 OSPF 导出策略。
[edit protocols ospf] user@R3# set export ospf
结果
在配置模式下,输入 show interfaces
、 show protocols
、 show policy-options
和 show routing-options
命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
设备 R2
user@R2# show interfaces
fe-1/2/1 {
unit 0 {
description to-R5;
family inet {
address 10.0.0.37/30;
}
family iso;
}
}
fe-1/2/0 {
unit 0 {
description to-OSPF-network;
family inet {
address 10.0.0.45/30;
}
}
}
lo0 {
unit 0 {
family inet {
address 172.16.9.7/32;
}
family iso {
address 49.0002.0172.0016.0907.00;
}
}
}
user@R2# show protocols
isis {
export [ ospf-isis send-direct-to-isis-neighbors ];
interface fe-1/2/1.0;
interface lo0.0;
}
ospf {
export send-direct-to-ospf-neighbors;
area 0.0.0.1 {
interface fe-1/2/0.0;
interface lo0.0 {
passive;
}
}
}
user@R2# show policy-options
policy-statement ospf-isis {
term 1 {
from {
protocol ospf;
route-filter 192.168.0.0/22 longer;
}
then accept;
}
}
policy-statement send-direct-to-isis-neighbors {
from {
protocol direct;
route-filter 10.0.0.44/30 exact;
}
then accept;
}
policy-statement send-direct-to-ospf-neighbors {
from {
protocol direct;
route-filter 10.0.0.36/30 exact;
}
then accept;
}
设备 R3
user@R3# show interfaces
fe-1/2/0 {
unit 0 {
family inet {
address 10.0.0.46/30;
}
}
}
lo0 {
unit 0 {
family inet {
address 192.168.1.1/32;
address 192.168.2.1/32;
address 192.168.3.1/32;
address 192.168.0.1/32;
}
}
}
user@R3# show protocols
ospf {
export ospf;
area 0.0.0.1 {
interface fe-1/2/0.0;
interface lo0.0 {
passive;
}
}
}
user@R3# show policy-options
policy-statement ospf {
term 1 {
from protocol static;
then accept;
}
}
user@R3# show routing-options
static {
route 192.168.0.0/24 discard;
route 192.168.1.0/24 discard;
route 192.168.3.0/24 discard;
route 192.168.2.0/24 discard;
}
完成设备配置后,请从配置模式进入 commit
。
验证
确认配置工作正常。
验证 OSPF 路由播发
目的
请确保预期的路由由 OSPF 播发。
行动
在设备 R2 的操作模式下,输入 show route protocol ospf
命令。
user@R2> show route protocol ospf inet.0: 15 destinations, 15 routes (15 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 192.168.0.0/24 *[OSPF/150] 03:54:21, metric 0, tag 0 > to 10.0.0.46 via fe-1/2/0.0 192.168.0.1/32 *[OSPF/10] 03:54:21, metric 1 > to 10.0.0.46 via fe-1/2/0.0 192.168.1.0/24 *[OSPF/150] 03:54:21, metric 0, tag 0 > to 10.0.0.46 via fe-1/2/0.0 192.168.1.1/32 *[OSPF/10] 03:54:21, metric 1 > to 10.0.0.46 via fe-1/2/0.0 192.168.2.0/24 *[OSPF/150] 03:54:21, metric 0, tag 0 > to 10.0.0.46 via fe-1/2/0.0 192.168.2.1/32 *[OSPF/10] 03:54:21, metric 1 > to 10.0.0.46 via fe-1/2/0.0 192.168.3.0/24 *[OSPF/150] 03:54:21, metric 0, tag 0 > to 10.0.0.46 via fe-1/2/0.0 192.168.3.1/32 *[OSPF/10] 03:54:21, metric 1 > to 10.0.0.46 via fe-1/2/0.0 224.0.0.5/32 *[OSPF/10] 03:56:03, metric 1 MultiRecv iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
意义
192.168/16 路由由 OSPF 播发。
验证路由重新分配
目的
请确保预期的路由已从 OSPF 重新分配到 IS-IS。
行动
在设备 R1 上的操作模式下,输入 show route protocol isis
命令。
user@R1> show route protocol isis inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both 10.0.0.44/30 *[IS-IS/160] 03:45:24, metric 20 > to 10.0.0.37 via fe-1/2/0.0 172.16.9.7/32 *[IS-IS/15] 03:49:46, metric 10 > to 10.0.0.37 via fe-1/2/0.0 192.168.0.0/24 *[IS-IS/160] 03:49:46, metric 10 > to 10.0.0.37 via fe-1/2/0.0 192.168.0.1/32 *[IS-IS/160] 03:49:46, metric 11, tag2 1 > to 10.0.0.37 via fe-1/2/0.0 192.168.1.0/24 *[IS-IS/160] 03:49:46, metric 10 > to 10.0.0.37 via fe-1/2/0.0 192.168.1.1/32 *[IS-IS/160] 03:49:46, metric 11, tag2 1 > to 10.0.0.37 via fe-1/2/0.0 192.168.2.0/24 *[IS-IS/160] 03:49:46, metric 10 > to 10.0.0.37 via fe-1/2/0.0 192.168.2.1/32 *[IS-IS/160] 03:49:46, metric 11, tag2 1 > to 10.0.0.37 via fe-1/2/0.0 192.168.3.0/24 *[IS-IS/160] 03:49:46, metric 10 > to 10.0.0.37 via fe-1/2/0.0 192.168.3.1/32 *[IS-IS/160] 03:49:46, metric 11, tag2 1 > to 10.0.0.37 via fe-1/2/0.0 iso.0: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
意义
192.168/16 路由重新分配给 IS-IS。
验证连接性
目的
检查设备 R1 是否可以到达设备 R3 上的目标。
行动
在操作模式下,输入 ping
命令。
user@R1> ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1): 56 data bytes 64 bytes from 192.168.1.1: icmp_seq=0 ttl=63 time=2.089 ms 64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=1.270 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=2.135 ms
意义
这些结果确认设备 R1 可以到达 OSPF 网络中的目标。