Introduction, Lab (OSPF) Pt.2
Now that you’ve been exposed to the general ideas behind Segment Routing, let’s configure it and see how it works. Don’t worry if you don’t fully understand everything from the Theory section. After experimenting with Segment Routing in the lab, I encourage you to go back to the Theory section and read through it again.
Lab
We’ll reuse the modified MPLS-TE topology from the FRR section, with R6 added. This allows us to test ECMP routing, as R2 has two ECMP routes to XR5.

You can either configure this from scratch or use the MPLS-TE lab and remove all the TE tunnels, RSVP config, and LDP (if configured - it wasn’t in the MPLS-TE lab).
Here are the startup configs:
First we’ll turn on SR on R1 and specifiy index 1 for its loopback:
You can either use an index or the absolute value. In this case, 1.1.1.1/32 absolute 16001 would be the same as index 1, because the router is using the default SRGB of 16000-23999.
Now we need to enable segment-routing for the IGP:
Opaque LSAs
Notice all the Type 10 Opaque LSAs that R1 has originated:
Let’s break these down. If you’re not familiar with Opaque LSAs, they are extensions to OPSF which are used to carry non-OSPF necessary information such as TE information. SR uses Opaque LSAs to disseminate SR specific information and labels.
The Link ID is in the format of an IP address but has nothing to do with IPv4. The first 8 bits are the Type. You can see the possible Opaque Types here: https://www.iana.org/assignments/ospf-opaque-types/ospf-opaque-types.xhtml
The next 24 bits is the Opaque ID, which is also present in the furthest right-hand column.
1.0.0.0
Opaque Type 1 indicates “Traffic Engineering LSA.” Currently we have not enabled MPLS-TE, so zero links are enabled for TE.
1.0.0.1
This is advertises the TE information for the link connected to R2. Bandwidth is in bytes/sec. The output indicates 1gbps. Even though the link is not enabled for MPLS-TE, I suppose the information is generated anyways?
4.0.0.0
Opaque Type 4 is used for “Router Information.” This advertises SR information about the router itself, including the SRGB. 16000-23999 is inferred by the label base being 16000, and range being 8000, which includes the 0th index.
7.0.0.0
Opaque Type 7 is “OSPFv2 Extended Prefix Opaque LSA.” This advertises the segment ID of the prefix 1.1.1.1/32.
The route-type is intra as in intra-area. Other options for route-type are inter-area and AS external but you are unlikely to see these. I believe you will only see inter-area when doing SR for multi-area OSPF.
The AF is the address-family, and currently only IPv4 is supported, which is code 0.
Under flags, the N-bit represents a Node SID. This prefix represents the router (Node), so the N-bit is set. It is set by default when you allocate a prefix-SID to the loopback interface. The other possible flag is the A-flag, which represents an ABR that is attached to another area. You would only see this when the prefix is inter-area.
The Sub-TLV is where flags such as the following would be set. In our example, we have none.
NP - No PHP, or PHP off. If this is set, the penultimate hop must not preform PHP
M - Mapping server. If this is set, it means the segment ID is advertised from a mapping server (more on this in another article).
E - Explicit Null. If this is set, then the penultimate hop must replace the label with the explicit null label.
V - Value. If this is set, the prefix SID is an absolute value instead of an index. You should never see this set.
L - Local. If this is set, the prefix SID has local significance. You shouldn’t see this, as prefix SIDs have global significance.
8.0.0.7
Opaque Type 8 is “OSPFv2 Extended Link Opaque LSA.” This advertises the adjacency segment ID for the adjacency with R2 on Gi1. Internally, Gi1 is assigned link ID 7, which explains why 7 is in the fourth octect of the LSA ID. The router dynamically allocated label 16 to represent the adjacency segment.
Under Flags, the L bit indicates that this is a Local label, which has local significance. The V bit indicates that the label is the absolute value, not an index. Remember that an adjacency SID is a local segment which is allocated from the dynamic label space, not the SRGB.
Looking at labels in the LFIB
Before looking at the LFIB, can you guess what entries there will be? Write down your answers and then check with the CLI.
Only the label allocated for the Adjacency SID is present. The instruction is to pop the label and forward out Gi1. The Prefix SID for 1.1.1.1/32 is not necessary on R1, as it will receive unlabeled traffic for this Prefix SID - the penultimate hop will preform PHP.
Let’s enable SR on XR3 now. SR on XR is a little more straight-forward. Everything is enabled within the IGP.
We have the same option for prefix-sid absolute 16003 if we’d like. Either way, the type 7 Opaque LSA will always indicate an index instead of an absolute value.
Enable SR for R2, R4, R6, and XR5 in the same manner, using the router number for the prefix-sid index value. Feel free to experiment with absolute instead of index for the prefix-sid.
Examine the LFIB on XR3 now:
The LFIB contains every global segment, except for its own loopback prefix-SID. All directly connected neighbors’ prefix-SID have an action of pop.
It also only contains its own adjacency SIDs, because adjacency SIDs are local segments.
On any router examine the OSPF database:
Interestingly, the XR routers do not originate type 1 Opaque LSAs when MPLS-TE is not enabled, but the IOS-XE routers do. All routers advertise a single Type 4 Opaque LSA, a single Type 7 Opaque LSA (for the loopback prefix-SID), and one Type 8 Opaque LSA per link.
You can experiment with other show commands such as show ip ospf segment-routing sid-database and show ip ospf segment-routing adjacency-sid
In the next section, we’ll briefly explore SR for ISIS. Feel free to go back to the Theory section first and re-read it, now that you have some hands-on experience with SR.
Last updated