Useful Articles


How Segment Routing Works?

How Segment Routing Works?

Segment Routing (SR) is a new label switching technology that will evolve and enhance the working of IP and MPLS networks. Segment Routing (SR) uses a new and efficient way of routing which is more flexible and scalable compared to legacy MPLS technology. In Segment Routing, the labels are not generated by Label Distribution Protocol (LDP) or RSVP. Then how do the labels be generated now? The label distribution mechanism has now been incorporated in the Link State Routing Protocols OSPF and ISIS. New extensions, also known as TLVs and Sub-TLVs have been added in both the IGPs advertise the Segment Routing labels. In addition to that, like Traffic Engineering in MPLS networks, Segment Routing also utilizes its own FRR (Fast Re Route) protection mechanisms known as TI-LFA (Topology Independent Loop Free Alternate) for faster convergence in Service Provider Core network.Before we deep dive into how Segment Routing works? I advise to have go through basic building blocks of Segment routing (Introduction to Segment Routing)

To understand how Segment Routing Works, we are taking the simple label ranges just to understand the concept, however, in real config environment, the label ranges are allocated on the based of Segment Routing Global Block (SRGB) for Prefix or Node SIDs
As per the topology shown below, Router R8 advertises its loopback0 IPv4 prefix with attached prefix-SID (or Node SID) 1008 through IGP (OSPF or ISIS) sub-TLV extensions. A Node SID is bound to the SPF like algorithm.

All remote nodes install the Node Segment to  R8 in their forwarding plane (LFIB).

In Segment Routing, one Segment is equal to one Label and a Segment List is equal to Label Stack. 
 How Segment Routing Works?


How Segment Routing works? - Scenario 1 

Switching the packets using only Node SIDs

As per picture below, for the traffic destined from Router R1 to Router R8 (via shortest path R1-R2-R3-R4-R8 - Segment shown with blue arrow), R1 pushes label 1008 over the packet and send it to R2. Routers R2 and R3 in the path will lookup their forwarding tables and perform Swap operation with same label 1008. PHP Router R4 will perform Pop operation and send packet to R8.
How Segment Routing Works?

How Segment Routing works? - Scenario 2

Switching the packets using both Node SID and Adjacency SID

Segment identifiers (SID) can also be combined as an ordered list (stack of labels) to perform traffic engineering. A segment list can contain several adjacency segments, several node segments, or a combination of both depending on the forwarding requirements. As shown in picture below, Router R1 could alternatively push label stack (1004, 2019) to reach Router R8 using the shortest path (say R1-R2-R3-R4-R7-R8) and all applicable ECMPs to Router 4 and then through an explicit interface onto the destination. Router R1 does not need to signal the new path, and the state information remains constant in the network. Router R1 ultimately enforces a forwarding policy that determines which flows destined to router R8 are switched through a particular path.   


How Segment Routing Works?

R1 pushed a stack of Segments (1004 and 2019) over the packet destined for R8. We are using a combination of both Node SID as well as Adjacency SID (labels) to reach R8. Segment 1004 is Node Segment ID of R4 and Segment 2019 is Adjacency SID of R4-R7 link. After pushing both segments on the packet, R1 switches the packet to R2. Afterwards, R2 performs a SWAP operation and switches the packet to R3 with same Segment ID 1004. R3 performs a PoP operation for Node SID (1004) and switches the packet to R4. Based on received Adjacency SID label of 2019, Router R4 switches the packet via R4-R7 link towards R7. Finally, R7 performs Penultimate Hop Popping (PHP) over the last Segment of stack and switches the packet to R8.

How Segment Routing Works? - Commands (IOS-XR)

To check label pushed on R1 for an IPv4 prefix - show cef
To check label pushed on R1 for an IPv6 Prefix - show cef ipv6 2001::0001:1008/128
To check forwarding plane on other routers (say R2) - show mpls forwarding labels 1008


Post a comment