This article will show you how to Configure Basic Segment Routing with MPLS Data Plane (SR-MPLS) using OSPF routing protocol. At the end of the article, H2Ttool will guide you through a simulation of basic segment routing. You can download the simulation resources in the comments section.
Mục lục
Segment Routing in Shortest Path Forwarding
Segment routing adds to OSPF routing protocols the ability to perform shortest path routing and source routing using the concept of abstract segment. A segment can represent a local prefix of a node, a specific adjacency of the node (interface/next-hop), a service context, or a specific explicit path over the network. For each segment, the IGP advertises an identifier referred to as Segment ID (SID).
When segment routing is used together with MPLS data plane, the SID is a standard MPLS label. A router forwarding a packet using segment routing pushes one or more MPLS labels.
Configuring Segment Routing in Shortest Path with OSPF
Step 1: Configure the Segment Routing Global Block (SRBG)
First, configures the global label block, referred to as Segment Routing Global Block (SRGB), which is reserved for assigning labels to segment routing prefix SIDs originated by this router. This range is carved from the system dynamic label range and is not instantiated by default:
/configure router mpls-labels sr-labels start 20000 end 29999
Step 2: Configure segment routing parameters within OSPF
/configure router ospf segment-routing prefix-sid-range global
After OSPF instance selected the global option for the prefix SID range, all instances on the system are restricted to do the same.
Step 3: Enabled the router-capability option in the OSPF
Segment routing is a new capability and needs to be advertised to all routers in a given domain so that routers which support the capability only programs the node SID in the data path towards neighbors which support it.
Configure the flooding scope to area in OSPF and to area or as in IS-IS
/configure router ospf advertise-router-capability area
Step 4: Assigns a node SID Index
Assigns a node SID index or label to the prefix representing the primary address of an IPv4 or IPv6 network interface of type loopback (system) using the following commands:
/configure router ospf area 0.0.0.0 interface "system" node-sid index 1
Step 5: Brings up segment routing on that IGP instances by un-shutting
/configure router ospf segment-routing no shutdown
Segment Routing Simulation with Nokia Router

Basic Configuration
####################### R1 ################################
#System Name#
/configure system name R1
#Port#
/configure port 1/1/1 no shutdown
#Interface#
/configure router interface system address 10.250.88.1/32
/configure router interface to-R2 address 10.1.2.1/24
/configure router interface to-R2 port 1/1/1
#OSPF#
/configure router ospf area 0
/configure router ospf area 0 interface system
/configure router ospf area 0 interface to-R2 interface-type point-to-point
/configure router ospf no shutdown
####################### R2 ################################
#System Name#
/configure system name R2
#Port#
/configure port 1/1/1 no shutdown
/configure port 1/1/2 no shutdown
#Interface#
/configure router interface system address 10.250.88.2/32
/configure router interface to-R1 address 10.1.2.2/24
/configure router interface to-R1 port 1/1/1
/configure router interface to-R3 address 10.2.3.2/24
/configure router interface to-R3 port 1/1/2
#OSPF#
/configure router ospf area 0
/configure router ospf area 0 interface system
/configure router ospf area 0 interface to-R1 interface-type point-to-point
/configure router ospf area 0 interface to-R3 interface-type point-to-point
/configure router ospf no shutdown
####################### R3 ################################
#System Name#
/configure system name R3
#Port#
/configure port 1/1/2 no shutdown
#Interface#
/configure router interface system address 10.250.88.3/32
/configure router interface to-R2 address 10.2.3.3/24
/configure router interface to-R2 port 1/1/2
#OSPF#
/configure router ospf area 0
/configure router ospf area 0 interface system
/configure router ospf area 0 interface to-R2 interface-type point-to-point
/configure router ospf no shutdown
Segment Routing Configuration
####################### R1 ################################
#Configure the Segment Routing Global Block (SRBG)#
/configure router mpls-labels
sr-labels start 20000 end 29999
#Enable Segment Routing Features in the OSPF context#
/configure router ospf
advertise-router-capability area
segment-routing prefix-sid-range global
area 0.0.0.0 interface "system" node-sid index 1
segment-routing no shutdown
####################### R2 ################################
#Configure the Segment Routing Global Block (SRBG)#
/configure router mpls-labels
sr-labels start 20000 end 29999
#Enable Segment Routing Features in the OSPF context#
/configure router ospf
advertise-router-capability area
segment-routing prefix-sid-range global
area 0.0.0.0 interface "system" node-sid index 2
segment-routing no shutdown
####################### R3 ################################
#Configure the Segment Routing Global Block (SRBG)#
/configure router mpls-labels
sr-labels start 20000 end 29999
#Enable Segment Routing Features in the OSPF context#
/configure router ospf
advertise-router-capability area
segment-routing prefix-sid-range global
area 0.0.0.0 interface "system" node-sid index 3
segment-routing no shutdown
Verification
The following is a list of useful commands to check that segment-routing is working properly.
show router fp-tunnel-table 1 protocol ospf
show router tunnel-table
show router tunnel-table alternative
show router tunnel-table protocol ospf
tools dump router ospf 0 sr-adjacencies
tools dump router ospf 0 sr-database
A:R1# show router tunnel-table
===============================================================================
IPv4 Tunnel Table (Router: Base)
===============================================================================
Destination Owner Encap TunnelId Pref Nexthop Metric
Color
-------------------------------------------------------------------------------
10.1.2.2/32 ospf (0) MPLS 524289 10 10.1.2.2 0
10.250.88.2/32 ospf (0) MPLS 524290 10 10.1.2.2 2
10.250.88.3/32 ospf (0) MPLS 524292 10 10.1.2.2 4
-------------------------------------------------------------------------------
Flags: B = BGP or MPLS backup hop available
L = Loop-Free Alternate (LFA) hop available
E = Inactive best-external BGP route
k = RIB-API or Forwarding Policy backup hop
===============================================================================
A:R1# tools dump router ospf 0 sr-database
===============================================================================
Rtr Base OSPFv2 Instance 0 Segment Routing Database
===============================================================================
SID Label St Type Prefix Stitching
AdvRtr Area Flags FRR
-------------------------------------------------------------------------------
1 20001 +R LT1 10.250.88.1/32 -
10.250.88.1 0.0.0.0 [NnP ] -
2 20002 +R T1 10.250.88.2/32 -
10.250.88.2 0.0.0.0 [NnP ] -
3 20003 +R T1 10.250.88.3/32 -
10.250.88.3 0.0.0.0 [NnP ] -
-------------------------------------------------------------------------------
No. of Entries: 3
-------------------------------------------------------------------------------
St: R:reported I:incomplete W:wrong N:not reported F:failed
+:SR-ack -:no route
Type: L:local M: mapping Srv Tx: route type
FRR: L:Lfa R:RLfa T:TiLfa (R):Reported (F):Failed
Ln, Rn, Tn: FRR providing node-protection
===============================================================================