为 OSPF 协议配置备份选择策略
对 OSPF 无环路备用 (LFA) 路由的支持实质上为 OSPF 增加了 IP 快速重新路由功能。Junos OS 为所有 OSPF 路由预先计算多个无环路备份路由。这些备份路由预安装在数据包转发引擎中,当特定路由的主下一跃点的链接不再可用时,该引擎将执行本地修复并实施备份路径。LFA的选择是通过选择任何匹配的LFA来随机完成的,以进入给定的目的地。这不能确保为网络提供最佳备份覆盖范围。为了选择最佳 LFA,Junos OS 允许您为每个目标(IPv4 和 IPv6)配置网络范围的备份选择策略和下一跃点主接口。这些策略根据管理员组、srlg、带宽、保护类型、指标和节点信息进行评估。
开始为 OSPF 协议配置备份选择策略之前:
配置路由器接口。请参阅 《路由设备 Junos OS 网络管理管理指南》。
配置内部网关协议或静态路由。请参阅 Junos OS 路由协议库了解路由设备。
要为 OSPF 协议配置备份选择策略,请执行以下操作:
- 配置按数据包的负载均衡。
[edit policy-options] user@host# set policy-statement ecmp term 1 then load-balance per-packet
- 在所有接口上启用 RSVP。
[edit protocols] user@host# set rsvp interface all
- 配置管理组。
[edit protocols mpls] user@host# set admin-groups group-name
- 配置 srlg 值。
[edit routing-options] user@host# set srlg srlg-name srlg-value srlg-value
- 在所有接口上启用 MPLS。
[edit protocols mpls] user@host# set interface all
- 将 MPLS 应用于配置了管理组的接口。
[edit protocols mpls] user@host# set interface interface-name admin-group group-name
- 配置路由器的 ID。
[edit routing-options] user@host# set router-id router-id
- 将路由策略应用于从路由表导出到转发表的所有等价多路径。
[edit routing-options] user@host# set forwarding-table export ecmp
- 启用链路保护并在区域的所有接口上配置指标值。
[edit protocols ospf] user@host# set area area-id interface interface-name link-protection user@host# set area area-id interface interface-name metric metric
- 为 IP 地址配置备份选择策略的管理组。
您可以选择从备份路径中排除、包括全部、包括任何或首选管理组。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name admin-group
指定要排除的管理组。
[edit routing-options backup-selection destination ip-address interface interface-name admin-group] user@host# set exclude group-name
如果备份路径中的任何链接具有任何一个列出的管理组,则不会选择该备份路径作为无环路备用 (LFA) 或备份下一跃点。
例如,要从管理组中排除组 c1:
[edit routing-options backup-selection destination 0.0.0.0/0 interface all admin-group] user@host# set exclude c1
如果备份路径中的每个链接都需要所有列出的管理组才能接受该路径,请配置所有管理组。
[edit routing-options backup-selection destination ip-address interface interface-name admin-group] user@host# set include-all group-name
例如,如果每个链接都需要所有列出的管理组才能接受路径,要设置所有管理组:
[edit routing-options backup-selection destination 0.0.0.0/0 interface all admin-group] user@host# set include-all c2
如果备份路径中的每个链接都需要至少一个列出的管理组才能选择路径,则配置任何管理组。
[edit routing-options backup-selection destination ip-address interface interface-name admin-group] user@host# set include-any group-name
例如,如果备份路径中的每个链接至少需要一个列出的管理组才能选择路径,要设置任何管理组:
[edit routing-options backup-selection destination 0.0.0.0/0 interface all admin-group] user@host# set include-any c3
定义一组有序的管理组,用于指定备份路径的首选项。
集合中最左侧的元素具有最高的优先级。
[edit routing-options backup-selection destination ip-address interface interface-name admin-group] user@host# set preference group-name
例如,要设置指定备份路径首选项的管理组的有序集:
[edit routing-options backup-selection destination 0.0.0.0/0 interface all admin-group] user@host# set preference c4
- 将备份路径配置为仅当带宽大于或等于主下一跃点的带宽时,才允许选择备份下一跃点。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name bandwidth-greater-equal-primary
- 配置备份路径以指定从单跃点邻居或远程路由器(如 RSVP 备份标签交换路径 (LSP) 尾端路由器)到最终目标的指标。
目标指标可以是最高指标,也可以是最低指标。
配置具有最高目标指标的备份路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name dest-metric highest
配置具有最低目标指标的备份路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name dest-metric lowest
- 配置备份路径,该路径是目标的下游路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name downstream-paths-only
- 在选择备份路径期间设置根指标和目标指标的优先顺序。
优先顺序可以是:
[根目标] — 备份路径的选择或首选项首先基于根衡量标准。如果所有根衡量指标的条件相同,则选择或首选项基于目标衡量指标。
[目标根] — 备份路径选择或首选项首先基于目标指标标准。如果所有目标衡量指标的条件相同,则选择基于根衡量指标。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name metric-order dest user@host# set backup-selection destination ip-address interface interface-name metric-order root
- 配置备份路径以定义要在备份路径选择中排除或首选的相邻邻接方的环回 IP 地址列表。
邻接方可以是本地(相邻路由器)邻接方、远程邻接方或备份路径中的任何其他路由器。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name node
配置要排除的邻接方列表。
[edit routing-options backup-selection destination ip-address interface interface-name node] user@host# set exclude node-address
不会选择包含列表中路由器的备份路径作为无环路替代跃点或备份下一跃点。
将一组有序的邻居配置为首选。
[edit routing-options backup-selection destination ip-address interface interface-name node] user@host# set preference node-address
将选择具有最左侧邻居的备份路径。
- 配置备份路径以将备份路径所需的保护类型指定为链路、节点或节点链路。
选择提供链路保护的备份路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name protection-type link
选择提供节点保护的备份路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name protection-type node
选择允许节点或链路保护 LFA 的备份路径,其中节点保护 LFA 优先于链路保护 LFA。
[edit routing-options] user@host# set backup-selection destination ip-address interface interface-name protection-type node-link
- 为单跃点邻居或远程路由器(如 RSVP 备份标签交换路径 (LSP) 尾端路由器)指定指标。
选择具有最高根衡量指标的路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface all root-metric highest
选择根跃点数最低的路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface all root-metric lowest
- 配置备份选择路径以允许或拒绝主链路与备份路径中每个链路之间的公共共享风险链路组 (SRLG)。
配置备份路径以允许主链路与备份路径中的每个链路之间存在公共 srlg。
[edit routing-options] user@host# set backup-selection destination ip-address interface all srlg loose
最好使用具有较少 srlg 冲突次数的备份路径。
配置备份路径以拒绝在主下一跃点链路和备份路径中的每个链路之间具有共同 srlg 的备份路径。
[edit routing-options] user@host# set backup-selection destination ip-address interface all srlg strict
- 配置备份路径以控制基于管理组、srlg、带宽、保护类型、节点和衡量指标评估备份路径的顺序和条件。
默认评估顺序为管理员组、srlg、带宽、保护类型、节点和指标。
[edit routing-options] user@host# set backup-selection destination ip-address interface all evaluation-order admin-group user@host# set backup-selection destination ip-address interface all evaluation-order srlg user@host# set backup-selection destination ip-address interface all evaluation-order bandwidth