Complete Cisco IOS XR Segment Routing with OSPF Configuration Guide - Part 2
In this second part of the Cisco IOS XR MPLS and Segment Routing series, we will migrate the existing MPLS L3VPN topology toward Segment Routing using OSPF.
This lab is built directly on the MPLS L3VPN topology configured in Part 1.
๐ Important
Before starting this lab, complete Part 1 because all configurations in this article depend on the MPLS L3VPN core already being operational.
๐ Table of Contents
- 1. Segment Routing Introduction
- 2. Why Segment Routing?
- 3. Existing MPLS Topology
- 4. Understanding SRGB
- 5. Task 1 - Configure SRGB
- 6. Understanding Prefix-SID
- 7. Task 2 - Configure OSPF Segment Routing
- 8. Verification Before SR Prefer
- 9. Task 3 - Configure SR Prefer
- 10. Verification After SR Prefer
- 11. Segment Routing Mathematics
- 12. Troubleshooting
- 13. Related Articles
1. Segment Routing Introduction
Segment Routing is the modern evolution of MPLS networks.
Traditional MPLS depends heavily on protocols such as:
- LDP
- RSVP-TE
- Complex signaling protocols
Segment Routing simplifies MPLS architecture by removing many signaling protocols and replacing them with source-routed instructions called Segments.
๐ฏ Main Benefits of Segment Routing
- Simpler MPLS architecture
- Reduced control-plane complexity
- Faster convergence
- Traffic engineering without RSVP
- Scalable modern SP architecture
- Excellent SDN integration
- Supports automation and programmability
Segment Routing Path Formula
$$ Path = SID_1 + SID_2 + SID_3 + \dots + SID_n $$Each SID represents:
- A node
- An adjacency
- A service
- A specific instruction
2. Why Segment Routing Over LDP?
LDP dynamically allocates labels independently.
Segment Routing creates deterministic label allocation.
With SR:
- No targeted LDP sessions
- No RSVP signaling
- No label exchange complexity
- Labels become topology-aware
LDP vs SR Comparison
$$ LDP = Dynamic\\ Label\\ Allocation $$$$ SR = Deterministic\\ Prefix\\ SID $$
3. Existing MPLS Topology
CE1 ---- XR1 ---- XR2 ---- XR3 ---- XR4 ---- XR5 ---- CE2
PE P RR P PE
The topology from Part 1 already includes:
- OSPF Core
- MPLS LDP
- MP-BGP VPNv4
- VRFs
- MPLS L3VPN services
Now we are enabling Segment Routing on top of the same infrastructure.
4. Understanding SRGB
SRGB stands for Segment Routing Global Block.
The SRGB defines the global label range used by Segment Routing.
SRGB Formula
$$ PrefixSID\\ Label = SRGB\\ Base + PrefixSID\\ Index $$Example:
$$ 16000 + 5 = 16005 $$Therefore:
$$ PrefixSID\\ 5 = Label\\ 16005 $$๐ก Important Concept
Every router in the SR domain should ideally use the same SRGB range.
In this lab:
$$ SRGB = 16000 - 23999 $$5. Task 1 - Configure Segment Routing Global Block
Now we configure SRGB on all routers XR1 through XR5.
XR1 SRGB Configuration
segment-routing global-block 16000 23999 commit
XR2 SRGB Configuration
segment-routing global-block 16000 23999 commit
XR3 SRGB Configuration
segment-routing global-block 16000 23999 commit
XR4 SRGB Configuration
segment-routing global-block 16000 23999 commit
XR5 SRGB Configuration
segment-routing global-block 16000 23999 commit
Deep Explanation of SRGB
The SRGB defines the local label allocation space reserved for Segment Routing.
Labels within this range become globally meaningful across the SR domain.
For example:
| Prefix SID | Computed Label |
|---|---|
| 1 | 16001 |
| 2 | 16002 |
| 3 | 16003 |
| 4 | 16004 |
| 5 | 16005 |
6. Understanding Prefix-SID
A Prefix-SID identifies a network prefix using a globally known MPLS label.
Instead of dynamically assigning labels using LDP, routers advertise Prefix-SIDs through OSPF.
Prefix SID Formula
$$ SID\\ Label = SRGB\\ Base + SID\\ Index $$For XR3:
$$ 16000 + 3 = 16003 $$XR3 loopback uses label:
$$ 16003 $$7. Task 2 - Configure OSPF Segment Routing
Now we enable Segment Routing under OSPF.
We also assign Prefix-SID indexes using Loopback0 interfaces.
๐ฏ Prefix SID Mapping
- XR1 = SID 1
- XR2 = SID 2
- XR3 = SID 3
- XR4 = SID 4
- XR5 = SID 5
XR1 Segment Routing OSPF
router ospf 1 segment-routing mpls area 0 interface loopback0 prefix-sid index 1 ! commit
XR2 Segment Routing OSPF
router ospf 1 segment-routing mpls area 0 interface loopback0 prefix-sid index 2 ! commit
XR3 Segment Routing OSPF
router ospf 1 segment-routing mpls area 0 interface loopback0 prefix-sid index 3 ! commit
XR4 Segment Routing OSPF
router ospf 1 segment-routing mpls area 0 interface loopback0 prefix-sid index 4 ! commit
XR5 Segment Routing OSPF
router ospf 1 segment-routing mpls area 0 interface loopback0 prefix-sid index 5 ! commit
What Happens Internally?
Once Segment Routing is enabled:
- OSPF advertises Prefix-SIDs inside LSAs
- Routers compute SR labels automatically
- MPLS forwarding uses SR labels
- LDP still remains active initially
8. Verification Before SR Prefer
Before enabling SR prefer, the network still prefers traditional LDP labels.
Traceroute Verification
traceroute 10.1.1.2 source 10.1.1.1
Expected Result
The MPLS core should still use:
๐ Non-SR Label Block
The labels should be from:
$$ 24XXX $$This indicates LDP labels are still preferred.
Sample MPLS Forwarding Output
XR1#show mpls forwarding 24001 Pop SR Pfx (10.1.1.2/32)
LDP Label Logic
$$ LDP\\ Labels \in 24000-24999 $$These are dynamically allocated labels.
9. Task 3 - Configure SR Prefer
Now we instruct OSPF to prefer Segment Routing labels instead of LDP labels.
๐ฏ Purpose of SR Prefer
- Prefer Prefix-SIDs over LDP labels
- Migrate toward SR forwarding
- Keep LDP as fallback if needed
- Simplify MPLS operations
XR1 SR Prefer
router ospf 1 segment-routing sr-prefer ! commit
XR2 SR Prefer
router ospf 1 segment-routing sr-prefer ! commit
XR3 SR Prefer
router ospf 1 segment-routing sr-prefer ! commit
XR4 SR Prefer
router ospf 1 segment-routing sr-prefer ! commit
XR5 SR Prefer
router ospf 1 segment-routing sr-prefer ! commit
10. Verification After SR Prefer
Now verify the forwarding behavior again.
Traceroute Verification
traceroute 10.1.1.2 source 10.1.1.1
๐ฏ Expected Result
Now the MPLS core should use:
$$ 16000 - 23999 $$Specifically:
$$ 16002 $$for XR2 loopback.
Expected MPLS Forwarding Output
XR1#show mpls forwarding 16002 Pop SR Pfx (10.1.1.2/32)
SR Label Computation
For XR2:
$$ SRGB = 16000 $$ $$ PrefixSID = 2 $$Final label:
$$ 16000 + 2 = 16002 $$11. Segment Routing Mathematics and Deep Technical Concepts
Node SID Formula
$$ NodeSID = SRGB + PrefixIndex $$Label Stack Example
$$ Packet = TransportSID + ServiceSID + Payload $$Traffic Engineering Path
$$ Path = SID_1 \rightarrow SID_2 \rightarrow SID_3 $$Shortest Path First Calculation
$$ SPF = Min(Cost_1 + Cost_2 + Cost_n) $$Segment Routing Scalability
$$ Complexity_{SR} < Complexity_{LDP+RSVP} $$Segment Routing significantly reduces operational complexity.
12. Troubleshooting Segment Routing
| Issue | Cause | Solution |
|---|---|---|
| No Prefix SID | OSPF SR disabled | Enable segment-routing mpls |
| Wrong labels | Incorrect SRGB | Verify SRGB consistency |
| LDP labels still used | SR prefer missing | Enable sr-prefer |
| No SR forwarding | Missing Prefix SID | Configure prefix-sid index |
Useful Verification Commands
show ospf segment-routing show segment-routing mpls forwarding show mpls forwarding show route show cef
13. Related Articles
- Cisco IOS XR MPLS L3VPN Configuration Guide Part 1
- Cisco IOS XR Segment Routing with IS-IS Configuration Guide | MPLS SR Tutorial Part 3
- Complete Cisco IOS XR SR-LDP Mapping Server Configuration Guide | Segment Routing Interoperability Part 4
๐ฏ Final Conclusion
In this second part of the MPLS and Segment Routing series, we successfully migrated the existing MPLS topology toward Segment Routing using OSPF.
We configured:
- SRGB
- Prefix-SIDs
- OSPF Segment Routing
- SR label computation
- SR preferred forwarding
- MPLS SR verification
We also learned the difference between:
- LDP labels
- Segment Routing labels
- Dynamic vs deterministic label allocation
No comments:
Post a Comment