段路由

Flex-Algo in OcNOS: Fundamentals of Customized Path Selection

Part of IP Infusion's guide to 段路由.

Traditional IS-IS routing uses a single shortest-path algorithm (SPF) based on the link metric. Every router computes one topology, so every packet to a given destination follows the same path. Segment Routing Flexible Algorithm (Flex-Algo) removes that limit by letting operators run more than one routing plane over the same physical network. This post covers the fundamentals: how a Flex-Algo is defined, how routers opt in to it, and how per-algorithm prefix-SIDs steer traffic. To keep the moving parts to a minimum, the lab uses two algorithms that share the same metric and differ only by which routers participate in each one.

What is Flex-Algo?

Flex-Algo is an extension of IS-IS Segment Routing that lets operators define additional SPF computations. In the general case each algorithm can use its own optimization metric (IGP metric, link delay, or TE metric) and its own link affinity constraints. Every algorithm gets a Flex-Algo ID (128 to 255), its own set of prefix-SIDs, and its own forwarding entries. Traffic is steered into an algorithm by placing that algorithm's prefix-SID in the segment stack.

A key point that is easy to miss: an algorithm only forms a topology across the routers that explicitly advertise participation in it. Two algorithms can be defined identically and still produce different paths, purely because a different set of routers opts in. That is exactly what this lab demonstrates. Both Flex-Algo 128 and Flex-Algo 129 are defined with the same metric type (igp-metric) and the same priority (5). Neither uses link delay, TE metric, or admin-group affinity. The only thing that separates them is participation.

Algorithm ID Metric type Participating routers (this lab) Result
0 IGP metric (standard SPF) All routers (R1 to R7) Default best-path routing
128 IGP metric, priority 5 R3, R4, R5, R6, R7 (not R1, R2) A routing plane that only forms across the routers advertising participation in 128
129 IGP metric, priority 5 R1, R2, R4, R5, R6, R7 (not R3) A separate routing plane across the routers advertising participation in 129

Because R4 through R7 participate in both algorithms, the distinguishing routers are R3 (which participates in 128 only) and R1 and R2 (which participate in 129 only). Optimizing paths by minimum link delay and by minimum TE metric is covered in the companion posts; this post keeps every algorithm on the IGP metric so the effect of participation is easy to see on its own.

How Flex-Algo Works in IS-IS

The lab is a seven-node IS-IS mesh (R1 through R7) running a single instance named OCNOS, with an SRGB of 16000 to 23999. Each router that wants to take part in an algorithm advertises capability flex-algo routing and lists the algorithm number under IS-IS. Routers that do not advertise a given algorithm are simply left out of that algorithm's topology. In the per-algorithm topology output, a non-participating router shows as ** (invalid) rather than as a reachable node, so its neighbors route around it for that algorithm.

In this lab that produces two distinct planes over one set of links. In algorithm 128, R1 and R2 are absent, so R4 reaches R5, R6, and R7 through R3. In algorithm 129, R3 is absent, so R4 reaches the same destinations through R1 and R2 instead. The metric is identical in both cases; only the reachable set changes.

R4 participates in 128 and 129 R7 participates in 128 and 129 R1 / R2 participate in 129 only R3 participates in 128 only Algo 128 (igp-metric): R4 to R7 via R3 Algo 129 (igp-metric): R4 to R7 via R1/R2
Two Flex-Algorithms over one physical mesh. Both 128 and 129 use the IGP metric, so neither optimizes for delay or capacity. The paths differ only because R3 participates in 128 while R1 and R2 participate in 129, so R4 reaches R7 through R3 in algorithm 128 and through R1 or R2 in algorithm 129.

Configuring Flex-Algo in OcNOS

The configuration has three parts: enable Flex-Algo and define the algorithm numbers under IS-IS on every router that should participate, assign per-algorithm prefix-SIDs on the loopback, and keep the core interfaces in IS-IS and MPLS. Because both algorithms take the definition defaults, there is no delay, TE-metric, or affinity to configure.

! OcNOS running-config (router R4): enable Flex-Algo and define the algorithms under IS-IS.
! Repeat on every router that participates in an algorithm.
!
router isis OCNOS
 is-type level-2-only
 capability flex-algo routing
 !
 flex-algo 128
  ti-lfa
 exit-flex-algo
 !
 flex-algo 129
  ti-lfa
 exit-flex-algo
 !
 metric-style wide
 mpls traffic-eng router-id 10.10.100.4
 mpls traffic-eng level-2
 capability cspf
 dynamic-hostname
 fast-reroute ti-lfa level-2 proto ipv4
 bfd all-interfaces
 net 49.0001.0000.0000.0004.00
 segment-routing mpls
!
! Definition defaults on this lab: metric-type igp-metric, priority 5
! (verified with: show isis flex-algo all status usercfg summary)
! OcNOS running-config (router R4): per-algorithm prefix-SIDs on the loopback.
! SRGB on this network is 16000 to 23999 (base 16000, range 8000).
!
interface loopback1
 ip address 10.10.100.4/32
 prefix-sid index 104
 prefix-sid algorithm-num 128 index 804
 prefix-sid algorithm-num 129 absolute 16904
 ip router isis OCNOS
!
! Resulting labels: algo 0 = 16104, algo 128 = 16804, algo 129 = 16904
! OcNOS running-config (router R4): enable IS-IS and MPLS on a core link.
! Representative core interface; this lab uses no per-link delay, TE-metric, or affinity.
!
interface cd0
 description To-R2-cd0
 load-interval 30
 ip address 10.66.24.4/24
 mtu 9216
 label-switching
 isis network point-to-point
 isis circuit-type level-2-only
 ip router isis OCNOS
 no isis hello padding

Steering Traffic with Flex-Algo SIDs

Validation starts by confirming Segment Routing and per-algorithm participation, then compares the topology and routing table for each algorithm. This is where the participation difference becomes visible: in show isis topology algorithm 128 the non-participating routers appear as **, and the per-algorithm routing tables show R4 reaching the far routers through R3 for algorithm 128 and through R1 and R2 for algorithm 129. Data-plane checks then send a labeled probe along each algorithm's prefix-SID.

! Confirm Segment Routing / SRGB and per-algorithm participation
show isis segment-routing state
show isis segment-routing capability
show isis flex-algo all status usercfg summary
!
! Per-algorithm topology and routing table
show isis topology algorithm 128
show isis topology algorithm 129
show ip isis route algorithm 128
show ip isis route algorithm 129
!
! Per-algorithm MPLS forwarding entries
show mpls forwarding-table algorithm 128
show mpls forwarding-table algorithm 129
!
! Data-plane validation along each algorithm path
ping mpls isis-sr ipv4 10.10.100.5/32 algorithm 128 detail
ping mpls isis-sr ipv4 10.10.100.5/32 algorithm 129 detail
trace mpls isis-sr ipv4 10.10.100.5/32 detail

With the fundamentals in place, the companion posts build on the same network to show how a Flex-Algo can optimize for something other than the IGP metric: steering by minimum link delay and by minimum TE metric.


IP Infusion Engineering Team

分享