In traditional IGP-based routing, shortest path selection is dictated by link metrics, often leading to suboptimal path choices in certain network scenarios. Segment Routing Flexible Algorithm (Flex-Algo) enables network operators to define customized routing policies based on application needs, optimizing traffic flow while leveraging the scalability of Segment Routing (SR). This blog delves into the core concepts of Flex-Algo, its advantages, and real-world configuration examples.
What is Flex-Algo?
Flexible Algorithm (Flex-Algo) is an extension of Segment Routing (SR) that allows a network to run multiple routing algorithms within a single IGP domain (IS-IS or OSPF). Each algorithm (Flex-Algo ID) enables custom path selection based on operator-defined constraints such as:
- Lowest metric paths (default IGP behavior)
- Explicit constraints (e.g., avoid congested or low-bandwidth links)
- SR-based optimization (e.g., low-latency paths)
Flex-Algo enables the coexistence of multiple logical topologies over the same physical infrastructure, supporting network slicing and ensuring application-aware traffic engineering.
Key Components of Flex-Algo:
- Algorithm ID (Flex-Algo ID) – Identifies a specific algorithm within the IGP domain.
- Metric Type – Defines path selection criteria (e.g., IGP default, TE, delay).
- Affinity Constraints – Allows inclusion or exclusion of links based on administrative tags.
- SR-Based Computation – Uses prefix-SIDs to steer traffic along computed paths.
Use Case: Traffic Segmentation with Flex-Algo:
Consider an ISP that needs to differentiate low-latency and high-bandwidth traffic:
- Flex-Algo 128: Routes critical, low-latency traffic over dedicated high-speed links.
- Flex-Algo 129: Optimizes bandwidth usage for bulk data transfers.
By assigning prefix-SIDs to each Flex-Algo, the network ensures application-aware routing without requiring SR-TE or complex MPLS tunnels.
Flex-Algo in ISIS-SR:
Topology: R4, R5, and R6 will function as Provider Edge (PE) routers, while R1, R2, R3, and R7 will serve as Provider (P) routers. The PE routers (R4, R5, and R6) will run both algorithms, Flex-Algo 128 and Flex-Algo 129. Among the P routers, R3 will run Flex-Algo 128, R1 and R2 will run Flex-Algo 129, and R7 will support both Flex-Algo 128 and Flex-Algo 129.
Topology-1: Flex-Algo-0 i.e. default Flexible Algorithm
Topology-2: Flex-Algo-128
Topology-3: Flex-Algo-129
Sample configuration from R4 device:
Loopback interface configuration:
Assigns the Prefix-SID to loopback interfaces for both the default and specific algorithms on the respective devices.
Physical interface configuration:
Enables “label-switching” with network type “point-to-point” (can be broadcast also) and configures ISIS process “OCNOS” under the interface.
Router ISIS configuration:
Note: To enable SR-MPLS under IS-IS, it is mandatory to configure ‘metric-style wide’ and ‘mpls traffic-engineering’ for the respective level. For Flex-Algo, ‘capability flex-algo routing’ must be enabled before configuring the required Flex-Algo.
Validation Steps:
Check the ISIS neighborship:
Verifies ISIS neighborship status, outgoing interface, and type.
Check the ISIS neighborship detail:
Provides additional details like uptime, adjacency SID etc.
Check the ISIS topology:
Shows topology details, including metrics and next-hop information for the default and specified algorithms. In the Metric field, ‘–’ indicates the local device, while ‘**’ signifies exclusion from the respective algorithm.
Check the ISIS routes:
Analyzes IS-IS routes along with their associated metrics and next-hop details for the default and specified algorithms.
Check the ISIS SR state:
Verifies ISIS-SR state and used SRGB on the router.
Check the ISIS SR capabilities:
Identifies IS-IS SR-capable routers in the network, the enabled Flex-Algo instances, and their respective SRGB.
Check the ISIS SR flex-algo status user-config summary:
Shows a summary of the user-configured settings for all Flex-Algos on the local router node.
Shows a summary of the user-configured Flex-Algo settings on the local router node
Check the ISIS SR flex-algo status user-config detail:
Provides a detailed view of the user-configured settings for all Flex-Algos on the local router node, showcasing an example for algorithm 128.
Provides a detailed view of the user-configured Flex-Algo settings on the local router node.
Check the ISIS SR flex-algo status election summary:
Shows a summary of all Flex-Algo FADs learned from participating routers in the election process.
Shows a summary of a Flex-Algo FAD learned from all routers in the SR domain that participated in the election process.
Check the ISIS SR flex-algo status election detail:
Provides a detailed view of all Flex-Algo FADs learned from routers that participated in the election process, showcasing few routers an example from algorithm 128.
Provides a detailed view of a Flex-Algo FAD learned from all routers in the SR domain that participated in the election process, showcasing few routers an example from algorithm 129.
Check the ISIS SR flex-algo status winner summary:
Shows a summary of all Flex-Algo FAD elected as the winner across all routers in the SR domain.
Shows a summary of the Flex-Algo FAD elected as the winner across all routers in the SR domain.
Check the ISIS SR flex-algo status winner detail:
Provides a detailed view of all Flex-Algo FAD elected as the winner across all routers in the SR domain.
Provides a detailed view of the Flex-Algo FAD elected as the winner across all routers in the SR domain.
Check the ISIS database:
Verifies the ISIS-SR database.
Check the ISIS database verbose:
Provides detailed IS-IS SR database information, including SRGB, Prefix-SID for default and respective algorithm, Adjacency SID. Also includes Flex-Algo details such as metric type, calculation type, priority etc.
Check the MPLS forwarding-table (FTN) entries in software (NSM) for default and respective algorithm:
Verify the MPLS Forwarding Table (FTN) entries for the loopback addresses of all other routers in the network. This command displays key details such as the outbound label (out-label), outbound interface (out-interface), next-hop, and more. Additionally, for Flex-Algo, it ensures that the correct forwarding paths are established based on the algorithm-specific constraints and metrics. Performing this check on the source router is crucial for validating proper routing and label allocation.
Check the MPLS ilm-table entries in software (NSM) for default and respective algorithm:
Verify the MPLS ILM (Incoming Label Mapping) table entries for the loopback addresses of all other routers and network links. This command provides critical details, including the inbound label (in-label), outbound label (out-label), outbound interface (out-interface), next-hop, and more. For Flex-Algo, it ensures that label forwarding aligns with the algorithm-specific constraints and path selection. Performing this check on the transit router is essential for validating correct label switching and path computation.
Check the P space nodes, Q space node and PQ node (if we have common PQ) for respective algorithm:
Check the ISIS-SR primary route and TI-LFA backup route along with backup tunnel for respective algorithm.
Verifies Flexible Algorithm specific ISIS TI-LFA routing table.
Check the ISIS-SR primary route and TI-LFA backup route along with backup tunnel for a particular FEC in respective algorithm:
Verifies Flexible Algorithm specific ISIS TI-LFA routing table for particular FEC.
Check the MPLS ping and trace:
MPLS ping and trace are available for the default algorithm. For specific algorithms, MPLS ping is currently supported, while MPLS trace will be introduced in the next release.
Conclusion:
Flex-Algo introduces a new level of control over network traffic, allowing operators to customize routing based on specific performance requirements. By leveraging IGP integration with Segment Routing, Flex-Algo simplifies traffic engineering, improves application performance, and enhances network resiliency.
Next Topic: Flex-Algo in OcNOS: Exploring Metric Type Variations for Path Optimization
Contact us today to learn how OcNOS will work for your network.
Suraj Kumar Singh is Senior Solution Lead at IP Infusion.