示例:配置路由策略以区分 IS-IS 路由的优先级
在具有大量 IS-IS 路由的网络中,控制路由的更新顺序以响应网络拓扑更改会很有用。此示例说明如何定义路由策略,以区分某些 IS-IS 路由的优先级。如果 IS-IS 拓扑发生变化,将首先更新路由表中的高优先级前缀,然后更新中低优先级前缀。互联网服务提供商 (ISP) 可以使用此功能来确保重要客户更快融合。
要求
配置此示例之前,不需要除设备初始化之外的特殊配置。
此示例使用以下硬件和软件组件:
三个路由器,可以是 M 系列、MX 系列或 T 系列路由器的组合
设备上的 Junos OS 17.1 或更高版本
概述
从 Junos OS 17.1 版开始,您可以确定路由表中安装的 IS-IS 路由的优先级或拒绝这些路由的优先级。 reject
使用策略选项可拒绝来自特定前缀或标有特定标记的路由的路由。
您可以确定 IS-IS 路由的优先级,以便更好地融合并提供差异化服务。如果网络中大量具有 BGP 第 3 层 VPN 或基于标签的 psuedowire 服务,则控制转发表中路由的更新顺序非常重要。您可以配置导入策略并使用路由标记,或者根据路由前缀过滤路由,然后再将优先级 high
设置为 , medium
或 low
根据您的网络要求。IS-IS 协议根据配置的优先级将路由下载到 rpd 路由表。如果未配置导入策略,则默认会将所有路由设置为中等优先级。
IS-IS 导入策略可用于设置优先级或根据以下标准过滤 IS-IS 外部路由:
Prefix | 使用 |
Route Tag | 使用 |
如果应用 reject
了导致非外部路由的终止操作的 IS-IS 导入策略,则 reject
操作将被忽略,并且无论如何都接受路由。默认情况下,此类路由已安装在路由表中,优先级为低。此行为可确保一致的路由,防止出现流量黑洞,即默默丢弃的流量。但是,您可以使用 reject
策略选项基于前缀或配置的标记拒绝路由。
您可能会看到,随着路由下载更改的顺序,微环路流量有所增加。
拓扑
在 图 1 中,路由器 R1 通过路由器 R2 连接到路由器 R3。我们需要为路由器 R3 的路由设置高优先级,以确保更快融合。在路由器 R1 上配置了导入路由策略,这会为连接到路由器 R3 的路由设置高优先级。匹配 203.0.113.3/32 的路由将首先安装,因为它们的优先级为高。LDP 从 IS-IS 导入路由及其配置优先级。如果网络拓扑发生变化,将首先还原此路由。
配置
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到层级的 [edit]
CLI 中,然后从配置模式进入提交。
路由器 R1
set interfaces ge-1/0/1 unit 0 description R1->R2 set interfaces ge-1/0/1 unit 0 family inet address 192.0.2.1/24 set interfaces ge-1/0/1 unit 0 family iso set interfaces ge-1/0/1 unit 0 family inet6 address 2001:db8:1:2::1/64 set interfaces ge-1/0/1 unit 0 family mpls set interfaces ge-5/0/9 unit 0 description R1->R2 set interfaces ge-5/0/9 unit 0 family inet address 192.0.10.1/24 set interfaces ge-5/0/9 unit 0 family iso set interfaces ge-5/0/9 unit 0 family inet6 address 2001:db8:1:1::1/64 set interfaces ge-5/0/9 unit 0 family mpls set interfaces lo0 unit 0 family inet address 203.0.113.1/32 set interfaces lo0 unit 0 family iso address 49.0002.0103.0000.0010.00 set interfaces lo0 unit 0 family inet6 address 2001:db8:1:1::1/128 set interfaces lo0 unit 0 family mpls set protocols mpls ipv6-tunneling set protocols mpls interface ge-5/0/9.0 set protocols mpls interface ge-1/0/1.0 set protocols isis level 1 disable set protocols isis interface ge-1/0/1.0 set protocols isis interface ge-5/0/9.0 set protocols isis interface lo0.0 passive set protocols ldp interface ge-1/0/1.0 set protocols ldp interface ge-5/0/9.0 set protocols ldp interface lo0.0 set policy-options policy-statement test_rf term t1 from route-filter 203.0.113.3/32 exact set policy-options policy-statement test_rf term t1 then priority high set protocols isis import test_rf set routing-options router-id 203.0.113.1 set routing-options autonomous-system 64496
路由器 R2
set interfaces ge-0/0/1 unit 0 description R2->R1 set interfaces ge-0/0/1 unit 0 family inet address 192.0.2.2/24 set interfaces ge-0/0/1 unit 0 family iso set interfaces ge-0/0/1 unit 0 family inet6 address 2001:db8:1:2::2/64 set interfaces ge-0/0/1 unit 0 family mpls set interfaces ge-0/0/7 unit 0 description R2->R3 set interfaces ge-0/0/7 unit 0 family inet address 198.0.2.1/24 set interfaces ge-0/0/7 unit 0 family iso set interfaces ge-0/0/7 unit 0 family inet6 address 2001:db8:1:2::1/64 set interfaces ge-0/0/7 unit 0 family mpls set interfaces ge-1/0/5 unit 0 description R2->R1 set interfaces ge-1/0/5 unit 0 family inet address 192.0.10.2/24 set interfaces ge-1/0/5 unit 0 family iso set interfaces ge-1/0/5 unit 0 family inet6 address 2001:db8:1:1::2/64 set interfaces ge-1/0/5 unit 0 family mpls set interfaces ge-1/1/0 unit 0 family inet address 198.0.10.1/24 set interfaces ge-1/1/0 unit 0 family iso set interfaces ge-1/1/0 unit 0 family inet6 address 2001:db8:::1::1/64 set interfaces ge-1/1/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 203.0.113.2/32 set interfaces lo0 unit 0 family iso address 49.0002.0103.0000.0030.00 set interfaces lo0 unit 0 family inet6 address 2001:db8:2:2::1/128 set interfaces lo0 unit 0 family mpls set protocols mpls interface ge-1/0/5.0 set protocols mpls interface ge-0/0/1.0 set protocols mpls interface ge-1/1/0.0 set protocols mpls interface ge-0/0/7.0 set protocols isis level 1 disable set protocols isis interface ge-0/0/1.0 set protocols isis interface ge-0/0/7.0 set protocols isis interface ge-1/0/5.0 set protocols isis interface ge-1/1/0.0 set protocols isis interface lo0.0 passive set protocols ldp interface ge-0/0/1.0 set protocols ldp interface ge-0/0/7.0 set protocols ldp interface ge-1/0/5.0 set protocols ldp interface ge-1/1/0.0 set protocols ldp interface lo0.0 set routing-options router-id 203.0.113.2 set routing-options autonomous-system 64496
路由器 R3
set interfaces ge-2/0/3 unit 0 description R3->R2 set interfaces ge-2/0/3 unit 0 family inet address 198.1.2.2/24 set interfaces ge-2/0/3 unit 0 family iso set interfaces ge-2/0/3 unit 0 family inet6 address 2001:db8:1:2::2/64 set interfaces ge-2/0/3 unit 0 family mpls set interfaces ge-3/0/10unit 0 description R3->R4 set interfaces ge-3/0/0 unit 0 family inet address 198.0.1.2/24 set interfaces ge-3/0/0 unit 0 family iso set interfaces ge-3/0/0 unit 0 family inet6 address 2001:db8::1:1::2/64 set interfaces ge-3/0/0 unit 0 family mpls set interfaces lo0 unit 0 family inet address 203.0.113.3/32 set interfaces lo0 unit 0 family iso address 49.0002.0103.0000.0020.00 set interfaces lo0 unit 0 family inet6 address 2001:db8:3:3::3/128 set interfaces lo0 unit 0 family mpls set protocols mpls ipv6-tunneling set protocols mpls interface ge-3/0/0.0 set protocols mpls interface ge-2/0/3.0 set protocols isis level 1 disable set protocols isis interface ge-2/0/3.0 set protocols isis interface ge-3/0/0.0 set protocols isis interface lo0.0 passive set protocols ldp interface ge-2/0/3.0 set protocols ldp interface ge-3/0/0.0 set protocols ldp interface lo0.0 set policy-options policy-statement add_tag term t1 from route-filter 203.0.113.3/32 exact set policy-options policy-statement add_tag term t1 then tag 18 set protocols isis export add_tag set routing-options router-id 203.0.113.3 set routing-options autonomous-system 64496
配置路由器 R1
逐步过程
以下示例要求您在配置层次结构中的各个级别上导航。有关导航 CLI 的信息,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置路由器 R1:
修改相应的接口名称、地址和其他参数后,对其他路由器重复此过程。
使用 IPv4 和 IPv6 地址配置接口。
[edit interfaces] user@R1# set ge-1/0/1 unit 0 description R1->R2 user@R1# set ge-1/0/1 unit 0 family inet address 192.0.2.1/24 user@R1# set ge-1/0/1 unit 0 family iso user@R1# set ge-1/0/1 unit 0 family inet6 address 2001:db8:1:2::1/64 user@R1# set ge-1/0/1 unit 0 family mpls user@R1# set ge-1/0/1 unit 0 description R1->R2 user@R1# set ge-5/0/9 unit 0 family inet address 192.0.10.1/24 user@R1# set ge-5/0/9 unit 0 family iso user@R1# set ge-5/0/9 unit 0 family inet6 address 2001:db8:1:1::1/64 user@R1# set ge-5/0/9 unit 0 family mpls
配置环路地址。
[edit interfaces] user@R1# set lo0 unit 0 family inet address 203.0.113.1/32 user@R1# set lo0 unit 0 family iso address 49.0002.0103.0000.0010.00 user@R1# set lo0 unit 0 family inet6 address 2001:db8:1:1::1/128 user@R1# set lo0 unit 0 family mpls
配置 MPLS。
[edit protocols] user@R1# set mpls ipv6-tunneling user@R1# set mpls interface ge-5/0/9.0 user@R1# set mpls interface ge-1/0/1.0
在接口上启用 IS-IS 协议。
[edit protocols] user@R1# set isis level 1 disable user@R1# set isis interface ge-1/0/1.0 user@R1# set isis interface ge-5/0/9.0 user@R1# set isis interface lo0.0 passive user@R1# set isis import test_rf
在接口上配置 LDP 协议。
[edit protocols] user@R1# set ldp interface ge-1/0/1.0 user@R1# set ldp interface ge-5/0/9.0 user@R1# set ldp interface lo0.0
定义一个策略,以确定到路由器 R3 的 IS-IS 路由的优先级。.
[edit policy-options] user@R1# set policy-statement test_rf term t1 from route-filter 203.0.113.3/32 exact user@R1# set policy-statement test_rf term t1 then priority high
配置路由器 ID 和自治系统 (AS) 编号。
[edit routing--options] user@R1# set routing-options router-id 203.0.113.1 user@R1# set routing-options autonomous-system 64496
结果
在配置模式下,输入 、 show protocolsshow policy-options 和show routing-options命令,show interfaces以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
[edit] user@R1> show interfaces ge-1/0/1 { unit 0 { family inet { address 192.0.2.1/24; } family iso; family inet6 { address 2001:db8:1:2::1/64; } family mpls; } } ge-5/0/9 { unit 0 { family inet { address 192.0.2.1/24; } family iso; family inet6 { address 2001:db8:1:1::1/64; } family mpls; } } lo0 { unit 0 { family inet { address 203.0.113.1/32; } family iso { address 49.0002.0103.0000.0010.00; } family inet6 { address 2001:db8:1:1::1/128; } family mpls; } }
[edit] user@R1> show protocols mpls { ipv6-tunneling; interface ge-5/0/9.0; interface ge-1/0/1.0; } isis { import test_rf; level 1 disable; interface ge-1/0/1.0; interface ge-5/0/9.0; interface lo0.0 { passive; } } ldp { interface ge-1/0/1.0; interface ge-5/0/9.0; interface lo0.0; }
[edit] user@R1> show routing-options router-id 203.0.113.1; autonomous-system 64496;
user@R1> sshow configuration policy-options policy-statement test_rf { term t1 { from { route-filter 203.0.113.3/32 exact; } then priority high; } }
验证
验证 LDP 路由的优先级
目的
验证 LDP 是否已从 IS-IS 协议继承路由 203.0.113.3。
行动
在操作模式下,在 show route extensive 路由器 R1 上运行命令。
user@R1> show route 203.0.113.3 extensive inet.0: 26 destinations, 26 routes (26 active, 0 holddown, 0 hidden) 203.0.113.3/32 (1 entry, 1 announced) State: <FlashAll> TSI: KRT in-kernel 203.0.113.3/32 -> {16.1.2.2} *IS-IS Preference: 18 Level: 2 Next hop type: Router, Next hop index: 0 Address: 0x4a1f43c Next-hop reference count: 4 Next hop: 16.1.2.2 via ge-1/0/1.0, selected Session Id: 0x0 Next hop: 16.1.1.2 via ge-5/0/9.0 Session Id: 0x0 State: <Active Int HighPriority> Local AS: 64496 Age: 59 Metric: 20 Validation State: unverified ORR Generation-ID: 0 Tag: 18 Task: IS-IS Announcement bits (2): 0-KRT 4-LDP AS path: I inet.3: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden) 203.0.113.3/32 (1 entry, 1 announced) State: <FlashAll> *LDP Preference: 9 Next hop type: Router, Next hop index: 0 Address: 0x4a1e55c Next-hop reference count: 2 Next hop: 16.1.2.2 via ge-1/0/1.0, selected Label operation: Push 299776 Label TTL action: prop-ttl Load balance label: Label 299776: None; Label element ptr: 0x4b99100 Label parent element ptr: 0x0 Label element references: 2 Label element child references: 0 Label element lsp id: 0 Session Id: 0x0 Next hop: 16.1.1.2 via ge-5/0/9.0 Label operation: Push 299776 Label TTL action: prop-ttl Load balance label: Label 299776: None; Label element ptr: 0x4b99100 Label parent element ptr: 0x0 Label element references: 2 Label element child references: 0 Label element lsp id: 0 Session Id: 0x0 State:<Active Int HighPriority> Local AS: 64496 Age: 59 Metric: 1 Validation State: unverified Task: LDP Announcement bits (1): 2-Resolve tree 1 AS path: I Secondary Tables: inet6.3
意义
输出显示 LDP 继承路由 203.0.113.3,优先级 high
来自 IS-IS。
验证 IS-IS 路由的优先级
目的
验证是否已为 IS-IS 中的路由 203.0.113.3 设置优先级。
行动
user@R1> show isis route download-priority IS-IS routing table Current version: L1: 0 L2: 122 IPv4/IPv6 Routes ---------------- Prefix L Version Metric Type Interface NH Via Backup Score 203.0.113.3/32 2 122 20 int ge-1/0/1.0 IPV4 R2 ge-5/0/9.0 IPV4 R2 203.0.113.2/32 2 122 10 int ge-1/0/1.0 IPV4 R2 ge-5/0/9.0 IPV4 R2 198.1.1.0/24 2 122 20 int ge-1/0/1.0 IPV4 R2 ge-5/0/9.0 IPV4 R2 198.1.2.0/24 2 122 20 int ge-1/0/1.0 IPV4 R2 ge-5/0/9.0 IPV4 R2 2001:db8:2:2::1/128 2 122 10 int ge-1/0/1.0 IPV6 R2 ge-5/0/9.0 IPV6 R2 2001:db8:3:3::3/128 2 122 20 int ge-1/0/1.0 IPV6 R2 ge-5/0/9.0 IPV6 R2 2001:db8:1:1::/64 2 122 20 int ge-1/0/1.0 IPV6 R2 ge-5/0/9.0 IPV6 R2 2001:db8:1:2::/64 2 122 20 int ge-1/0/1.0 IPV6 R2 ge-5/0/9.0 IPV6 R2
意义
路由按设置的优先级顺序显示。以 high
优先级设置的 Route 203.0.113.3 显示在优先级的顶部,然后是优先级为中低的路由。