简介
本文档介绍ISIS中灵活算法(Flex-Algo)的运行过程,并提供用于验证和故障排除的相关命令。
先决条件
要求
- 思科建议您具备ISIS分段路由流量工程的基本知识。
使用的组件
- 本文档中的信息基于Device:聚合服务路由器9000(ASR9K)。
- 本文档中的信息都是基于特定实验室环境中的设备编写的。用于本文的所有设备始于初始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
Flex-Algo概述
- Flexible Algo(Flex-Algo)是以0-255范围内的数值来标识的;保留值0-127,而用户定义的值为128-255。
- Flex-Algo由度量类型(内部网关协议(IGP)度量、延迟度量或TE度量)和约束集(例如链路相关性、共享风险链路组(SRLG))定义。
- 利用Flex-Algo,网络可以实施网络切片,即网络的逻辑分段,其中路径计算被限制在满足所定义约束的拓扑中。

图 1:Prefix-SID Sub-TLV Format(带算法字段)

图 2:Flex-Algo定义(FAD)TLV格式
网络拓扑

图 3:网络拓扑图
网络
- 算法128 →定义延迟优化切片。
- 算法129→定义TE优化切片。
- ABR1和ABR2在IS-IS链路状态协议数据单元(LSP)中通告其Flex-Algo定义(FAD TLV)。
- FAD发起方可以是IS-IS域中的任何路由器;路由器无需参与每个Flex-Algo即可通告其定义。
Flex-Acl配置
router isis core
flex-algo 128
interface Loopback100
passive
address-family ipv4 unicast
prefix-sid index 11 explicit-null
prefix-sid algorithm 128 index 811 explicit-null
注意:
- 索引11 — 绑定到Flex-Algo 0的前缀SID(默认最短路径优先(SPF))。
- 索引811 — 绑定到Flex-Algo 128的前缀SID。
- Flex-Algo Prefix-SIDs enable network slicing(启用网络切片)。对于给定前缀(例如Loopback100),可以通告多个前缀SID — 每个前缀绑定到特定Flex-Algo。
- 第一个Prefix-SID(索引11)自动与Flex-Algo 0(默认IGP最短路径算法)关联。
- 第二个Prefix-SID(索引811)与Flex-Algo 128(用户定义的算法)显式关联。
Flex-Algo 129由度量类型TE定义
配置
在ABR2上:
router isis core
flex-algo 129
priority 50
metric-type te
advertise-definition
interface Loopback100
address-family ipv4 unicast
prefix-sid algorithm 129 index 92 explicit-null >> Prefix-SID bound to Flex-Algo 129
interface HundredGigE0/1/0/2
point-to-point
address-family ipv4 unicast
fast-reroute per-prefix
fast-reroute per-prefix ti-lfa
te-metric flex-algo 20 level 2 >> 20 is the TE metric value for this link , need to be enabled on the links only between those routers participating in Flex-Algo 129
确认
PE3#show isis flex-algo 129
IS-IS core Flex-Algo Database
Flex-Algo 129:
Level-2:
Definition Priority: 100
Definition Source: ASR9906-2-ABR-1.00
Definition Equal to Local: No
Definition Metric Type: TE
Definition Flex-Algo Prefix Metric: No
<snip>
FRR Disabled: No
Microloop Avoidance Disabled: No
UCMP Disabled: No
Data Plane Segment Routing: Yes
Data Plane IP: Yes
PE3#show isis database 55A1-2-PE4.00-00 verbose internal
IS-IS core (Level-2) Link State Database
LSPID LSP Seq Num LSP Checksum LSP Holdtime/Rcvd ATT/P/OL Len Received From On Reason
55A1-2-PE4.00-00 0x00000149 0xfe2f 995 /1200 0/0/0 282 09:21:39 ASR9910-4-ABR-2 Hu0/1/0/0 Flooded
<snip>
TLV code:242 length:28
Router Cap: 10.10.44.44 D:0 S:0
SubTLV code:2 length:9
Segment Routing: I:1 V:0, SRGB Base: 16000 Range: 8000
SubTLV code:23 length:2
Node Maximum SID Depth:
Label Imposition: 12
SubTLV code:19 length:3
SR Algorithm:
Algorithm: 0
Algorithm: 1
Algorithm: 129
SubTLV code:29 length:1
IP Algorithm:
Algorithm: 129
TLV code:22 length:117
Metric: 10 IS-Extended ASR9910-4-ABR-2.00
SubTLV code:4 length:8
Local Interface ID: 32, Remote Interface ID: 38
SubTLV code:6 length:4
Interface IP Address: 10.10.244.44
SubTLV code:8 length:4
Neighbor IP Address: 10.10.244.2
SubTLV code:9 length:4
Physical BW: 10000000 kbits/sec
SubTLV code:16 length:9
Application Specific Link Attributes:
L flag: 0, SA-Length: 1, UDA-Length: 1
Standard Applications: 0x10 FLEX-ALGO
User Defined Applications: 0x10
SubTLV code:18 length:3
Admin. Weight: 20 >>>>>>>>>> configured TE metric
PE3#show isis topology flex-algo 129
IS-IS core paths to IPv4 Unicast (Level-2) routers
System Id Metric Next-Hop Interface SNPA
ASR9910-4-ABR-2 20 ASR9910-4-ABR-2 Hu0/1/0/0 *PtoP* >> 1 hop away from PE3
55A1-2-PE4 40 ASR9910-4-ABR-2 Hu0/1/0/0 *PtoP* >> 2 hops away from PE3
PE3#show isis database 55A1-2-01EEA29-PE4.00-00 verbose internal
IS-IS core (Level-2) Link State Database
LSPID LSP Seq Num LSP Checksum LSP Holdtime/Rcvd ATT/P/OL Len Received From On Reason
55A1-2-01EEA29-PE4.00-00 0x00000149 0xfe2f 995 /1200 0/0/0 282 09:21:39 ASR9910-4-01F8486-ABR-2 Hu0/1/0/0 Flooded
TLV code:242 length:28
Router Cap: 10.10.44.44 D:0 S:0
SubTLV code:2 length:9
Segment Routing: I:1 V:0, SRGB Base: 16000 Range: 8000
SubTLV code:23 length:2
Node Maximum SID Depth:
Label Imposition: 12
SubTLV code:19 length:3
SR Algorithm:
Algorithm: 0
Algorithm: 1
Algorithm: 129
SubTLV code:29 length:1
IP Algorithm:
Algorithm: 129
TLV code:22 length:117
Metric: 10 IS-Extended ASR9910-4-01F8486-ABR-2.00
SubTLV code:4 length:8
Local Interface ID: 32, Remote Interface ID: 38
SubTLV code:6 length:4
Interface IP Address: 10.10.244.44
SubTLV code:8 length:4
Neighbor IP Address: 10.10.244.2
SubTLV code:9 length:4
Physical BW: 10000000 kbits/sec
SubTLV code:16 length:9
Application Specific Link Attributes:
L flag: 0, SA-Length: 1, UDA-Length: 1
Standard Applications: 0x10 FLEX-ALGO
User Defined Applications: 0x10
SubTLV code:18 length:3
Admin. Weight: 20 >>>>>>>>>> configured TE metric
由度量类型延迟定义的Flex-Algo 128
配置
router isis core
flex-algo 128
priority 100
metric-type delay
advertise-definition
performance-measurement
interface HundredGigE0/1/0/0
delay-measurement >>> this CLI needs to be enabled only on those interfaces between those routers participating in Flex-Algo 128
!
!
interface HundredGigE0/1/0/3
delay-measurement
确认
PE1#show isis flex-algo 128
IS-IS core Flex-Algo Database
Flex-Algo 128:
Level-2:
Definition Priority: 100
Definition Source: ASR9906-2-ABR-1.00
Definition Equal to Local: No
Definition Metric Type: Delay
Definition Flex-Algo Prefix Metric: No
注意:在PE2上,静态配置了PE2和ABR 1 delay-measurement advertise-delay 100 >>延迟之间的性能测量接口HundredGigE0/1/0/1 >>链路。这会将从PE2到PE1的延迟度量增加+100,因此从PE2到达ABR 1的延迟为100。
PE1#show isis database ASR-9904-5-PE2.00-00 verbose internal
IS-IS core (Level-2) Link State Database
LSPID LSP Seq Num LSP Checksum LSP Holdtime/Rcvd ATT/P/OL LSP Length
ASR-9904-5-PE2.00-00 0x00000231 0x6084 1131 /1200 0/0/0 310
<snip>
TLV code:242 length:25
<snip>
SubTLV code:19 length:3
SR Algorithm:
Algorithm: 0
Algorithm: 1
Algorithm: 128
TLV code:22 length:144
Metric: 10 IS-Extended ASR9906-2-ABR-1.00
SubTLV code:4 length:8
Local Interface ID: 17, Remote Interface ID: 22
SubTLV code:6 length:4
Interface IP Address: 10.10.221.22
SubTLV code:8 length:4
Neighbor IP Address: 10.10.221.1
SubTLV code:9 length:4
Physical BW: 99999998 kbits/sec
SubTLV code:33 length:4
Link Average Delay: 100 us
SubTLV code:34 length:8
Link Min/Max Delay: 100/100 us
SubTLV code:35 length:4
Link Delay Variation: 0 us
SubTLV code:16 length:14
Application Specific Link Attributes:
L flag: 0, SA-Length: 1, UDA-Length: 1
Standard Applications: 0x10 FLEX-ALGO
User Defined Applications: 0x10
SubTLV code:34 length:8
Link Min/Max Delay: 100/100 us >>> delay calculated on this link due to the confoguration
PE2#show isis topology flex-algo 128
IS-IS core paths to IPv4 Unicast (Level-2) routers
System Id Metric Next-Hop Interface SNPA
ASR9906-2-ABR-1 100 ASR9906-2-ABR-1 Hu0/1/0/1 *PtoP*
ASR9906-1-PE1 112 ASR9906-2-ABR-1 Hu0/1/0/1 *PtoP*
如果接口上未配置手动通告延迟,并且使用接口上启用的默认延迟测量配置文件,则会在链路上发送探测功能以测量接口上的延迟。
ABR-1#show performance-measurement sessions
----------------------------------------------------------------------------------------------------------------------------------------------------------------
0/1/CPU0
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Transport type : Interface
Measurement type : Delay Measurement
Interface name : HundredGigE0/1/0/0
Nexthop : Unknown
Delay Measurement session:
Session ID : 4097
Profile Keys:
Profile name : default
Profile type. : Interface Delay Measurement
Last advertisement:
Advertised at: Sep 26 2025 14:00:36.179 (247623.282 seconds ago)
Advertised reason: Periodic timer, min delay threshold crossed
Advertised delays (uSec): avg: 12, min: 12, max: 13, variance: 0
A flag set: False
Next advertisement:
Threshold check scheduled in 2 more probes (roughly every 120 seconds)
Aggregated delays (uSec): avg: 12, min: 11, max: 12, variance: 1
Rolling average (uSec): 11
Current computation:
Started at: Sep 29 2025 10:47:17.373 (22.88 seconds ago)
Packets Sent: 8, received: 8
Measured delays (uSec): avg: 12, min: 11, max: 12, variance: 1 >>>>>>>>>>>> the delay measured using probes on this interface
Next probe scheduled at: Sep 29 2025 10:47:47.369 (in 7.908 seconds)
Next packet will be sent in 1.908 seconds
Packet sent every 3.0 seconds
Responder IP : 10.10.111.11
Number of Hops : 1
ABR-1#show isis database ASR9906-1-PE1.00-00 verbose internal
IS-IS core (Level-2) Link State Database
LSPID LSP Seq Num LSP Checksum LSP Holdtime/Rcvd ATT/P/OL LSP Length
ASR9906-1-PE1.00-00 0x00000777 0x13ef 497 /1200 0/0/0 370
<snip>
TLV code:22 length:197
Metric: 10 IS-Extended ASR9906-2-ABR-1.00
SubTLV code:4 length:8
Local Interface ID: 40, Remote Interface ID: 21
SubTLV code:6 length:4
Interface IP Address: 10.10.111.11
SubTLV code:8 length:4
Neighbor IP Address: 10.10.111.1
SubTLV code:9 length:4
Physical BW: 99999998 kbits/sec
SubTLV code:33 length:4
Link Average Delay: 12 us >>>>>>>>>>>>>> the calculated delay is propagated via ISIS which is used by the Headend router to calculate the path with minimum delay
SubTLV code:34 length:8
Link Min/Max Delay: 12/13 us
SubTLV code:35 length:4
Link Delay Variation: 0 us
SubTLV code:16 length:14
Application Specific Link Attributes:
L flag: 0, SA-Length: 1, UDA-Length: 1
Standard Applications: 0x10 FLEX-ALGO
User Defined Applications: 0x10
SubTLV code:34 length:8
Link Min/Max Delay: 12/13 us
PE1#show isis topology flex-algo 128
IS-IS core paths to IPv4 Unicast (Level-2) routers
System Id Metric Next-Hop Interface SNPA
ASR9906-2-ABR-1 12 ASR9906-2-ABR-1 Hu0/1/0/0 *PtoP*
ASR-9904-5-PE2 24 ASR9906-2-ABR-1 Hu0/1/0/0 *PtoP*
注意:
- 从PE1到ABR 1,只有12个用户延迟
- 从PE1到PE2,存在24个用户延迟
FLEX-ALGO 129上的拓扑无关无环备用(TI-LFA)和微环规避(MLA)

图 4:用于演示Flex-Algo 129的TI-LFA和MLA的网络拓扑图
ABR-1#show isis fast-reroute flex-algo 129 10.10.2.2/32 detail
L2 10.10.2.2/32 [20/115] Label: 16092, medium priority
Installed Sep 17 10:40:08.503 for 00:16:25
via 10.10.12.2, HundredGigE0/1/0/1, Label: Exp-Null-v4, ASR9910-4-ABR-2, SRGB Base: 16000, Weight: 0
Backup path: TI-LFA (link), via 10.10.221.22, HundredGigE0/1/0/3 ASR-9904-5-PE2, SRGB Base: 16000, Weight: 0, Metric: 60
P node: ASR9910-3-PE3.00 [10.10.33.33], Label: 16933 >>>>>>>>>> TI-LFA precomputed path for FRR
Prefix label: 16092
Backup-src: ASR9910-4-ABR-2.00
P: No, TM: 60, LC: No, NP: No, D: No, SRLG: Yes
src ASR9910-4-ABR-2.00-00, 10.10.2.2, prefix-SID index 92, R:0 N:1 P:1 E:1 V:0 L:0, Alg:129
注意:
- 16933 PE3 Flex-Algo 129标签
- 16092 ABR -2 Flex-Algo 129标签
- TI-LFA路径也使用flex algo 129的逻辑网络片进行限制
在ABR-1上,当ABR 1和2之间的链路关闭时,会触发MLA隧道:
ABR-1 #show isis microloop avoidance 10.10.2.2/32 flex-algo 129 detail
10.10.2.2/32 participated in 1 of 6 microloop avoidance events
number start spf duration cleanup duration pins: ipv4 ipv6
--- --- --- --- --- --- --- ---
5 restart 10:59:16.440 0 ms 10:59:16.643 3 0
trigger: Link down, near node: ASR9906-2-ABR-1.00, far node: ASR9910-4-ABR-2.00
via 10.10.221.22, Hu0/1/0/3, Labels: 16933
在TI-LFA和MLA中,Flex-Algo 129运行其自身的约束SPF,预计算符合Algo 129约束的快速重路由隧道,仅使用FLEX-ALGO 129标签。
链路关联映射限制
- 关联性是与IGP链路关联的32位属性,由操作员管理性分配。
- 每个位位置对应于由运算符定义的语义含义。
- 这些关联位在IGP(OSPF/IS-IS)中作为链路TE属性的一部分进行通告。
当Flex-Algo计算其最短路径树(SPF)时,它在路径选择期间应用关联约束:
- Include-Any(IA):计算出的路径必须至少经过设置了任何指定关联位的链路。
- Include-All(IAll):计算出的路径必须仅遍历包含所有指定关联位的链路。
- 排除 — 任意(EA):计算出的路径必须避免包含任何指定关联位的所有链路。
配置
在ABR 1和2上:
On ABR 1and 2
router isis core
affinity-map ALGO-129 bit-position 6
flex-algo 129
priority 100
metric-type te
advertise-definition
affinity exclude-any ALGO-129
在通告的FAD上发布此配置。
确认
PE4#show isis database ASR9906-2-ABR-1.00-00 verbose internal
IS-IS core (Level-2) Link State Database
LSPID LSP Seq Num LSP Checksum LSP Holdtime/Rcvd ATT/P/OL Len Received From On Reason
ASR9906-2-ABR-1.00-00 0x0000023f 0xa89f 871 /1200 0/0/0 453 11:12:43 ASR9906-1-PE1 Hu0/0/0/5 Flooded
TLV code:242 length:44
Router Cap: 10.10.1.1 D:0 S:0
<snip>
SubTLV code:19 length:4
SR Algorithm:
Algorithm: 0
Algorithm: 1
Algorithm: 128
Algorithm: 129
SubTLV code:26 length:4
Flex-Algo Definition:
Algorithm: 129 Metric-Type: 2 Alg-type: 0 Priority: 100
SubTLV code:1 length:4
Flex-Algo Exclude-Any Ext Admin Group: >>> FAD to exclude any link with this bit position set
0x00000040
PE4#show isis flex-algo 129
IS-IS core Flex-Algo Database
Flex-Algo 129:
Level-2:
Definition Priority: 100
Definition Source: ASR9906-2-ABR-1.00
Definition Equal to Local: No
Definition Metric Type: TE
Definition Flex-Algo Prefix Metric: No
Exclude Any Affinity Bit Positions: 6
未在任何链路上配置链路关联映射时从PE4到PE3的路径:
PE4#traceroute sr-mpls labels 16933 lsp-end-point 10.10.33.33
Type escape sequence to abort.
0 10.10.244.44 MRU 1500 [Labels: 16933/explicit-null Exp: 0/0] >>>>>>>>>>>>>>>>>>>> PE4
L 1 10.10.244.2 MRU 1500 [Labels: explicit-null/explicit-null Exp: 0/0] 5 ms >>>>>>>>ABR2
! 2 10.10.32.33 4 ms >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PE3

图 5:在没有定义关联映射的PE4到PE3之间的Traceroute
关联映射的ABR-2上的配置
router isis core
affinity-map ALGO-129 bit-position 6 >> define the bit position and associate it with a name
router isis core
interface HundredGigE0/1/0/2 >>> link between ABR-2 to PE3
affinity flex-algo ALGO-129 >>>>> link affinity map
point-to-point
address-family ipv4 unicast
fast-reroute per-prefix
fast-reroute per-prefix ti-lfa
te-metric flex-algo 20 level 2
确认
PE4#show isis database ASR9910-4-ABR-2.00-00 verbose internal
<snip>
TLV code:22 length:193
<snip>
SubTLV code:6 length:4
Interface IP Address: 10.10.32.2
SubTLV code:8 length:4
Neighbor IP Address: 10.10.32.33
SubTLV code:9 length:4
Physical BW: 99999998 kbits/sec, 12499999744 bytes/sec
SubTLV code:16 length:21
Application Specific Link Attributes:
L flag: 0, SA-Length: 1, UDA-Length: 1
Standard Applications: 0x10 FLEX-ALGO
User Defined Applications: 0x10
SubTLV code:14 length:4
Ext Admin Group:
0x00000040 >>>>>> link affinity flooded via IGP
SubTLV code:3 length:4
Affinity: 0x00000040
SubTLV code:18 length:3
Admin. Weight: 20
根据Flex Algo 129从PE4到PE3的FAD,它需要排除任何具有关联映射位位置6的链路。
PE4#traceroute sr-mpls labels 16933 lsp-end-point 10.10.33.33
0 10.10.244.44 MRU 1500 [Labels: 16933/explicit-null Exp: 0/0]
L 1 10.10.244.2 MRU 1500 [Labels: 16933/explicit-null Exp: 0/0] 5 ms >>>>>>>>>>>>> ABR2
L 2 10.10.12.1 MRU 1500 [Labels: 16933/explicit-null Exp: 0/0] 4 ms >>>>>>>>>>>>>> ABR1
L 3 10.10.221.22 MRU 1500 [Labels: explicit-null/explicit-null Exp: 0/0] 15 ms >>> PE2
! 4 10.10.233.33 4 ms >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PE3

图 6:配置关联映射后从PE4到PE3的路径
注意:同样,在flex algo的FAD中使用“include any”和“include all”,我们可以影响从头端到尾端的路径计算。
结论
本文档介绍如何使用灵活算法(Flex-Algo)将IS-IS域逻辑切分为多个网络切片。每个片可以定义自己的路径计算规则和限制,从而根据SLA要求或流量敏感性对流量流进行区别处理。
命令
show isis flex-algo <>
show isis flex-algo 129 neighbors
show isis topology flex-algo
show isis database <> verbose detail
show isis route <> flex-algo <> detail
show mpls forwarding labels <> detail
show isis microloop avoidance <> flex-algo <> detail
show isis fast-reroute flex-algo <> <prefix> detail