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:

#R1
hostname R1
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet1
 ip address 10.1.2.1 255.255.255.0
 ip ospf network point-to-point
 no shut
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
line con 0
 logging synchronous

#R2
hostname R2
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!
interface GigabitEthernet1
 ip address 10.1.2.2 255.255.255.0
 ip ospf network point-to-point
 no shut
!
interface GigabitEthernet2
 ip address 10.2.4.2 255.255.255.0
 ip ospf network point-to-point
 no shut
!
interface GigabitEthernet3
 ip address 10.2.3.2 255.255.255.0
 ip ospf network point-to-point
 no shut
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
line con 0
 logging synchronous

#XR3
hostname XR3
!
interface Loopback0
 ipv4 address 3.3.3.3 255.255.255.255
!
interface GigabitEthernet0/0/0/0
 ipv4 address 10.3.4.3 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 ipv4 address 10.2.3.3 255.255.255.0
!
interface GigabitEthernet0/0/0/2
 ipv4 address 10.3.6.3 255.255.255.0
!
router ospf 1
 area 0
  interface GigabitEthernet0/0/0/0
   network point-to-point
  !
  interface GigabitEthernet0/0/0/1
   network point-to-point
  !
  interface GigabitEthernet0/0/0/2
   network point-to-point
  !
  int Lo0
  !
 !
!
mpls oam
!
end

#R4
hostname R4
!
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet1
 ip address 10.2.4.4 255.255.255.0
 ip ospf network point-to-point
 no shut
!
interface GigabitEthernet2
 ip address 10.3.4.4 255.255.255.0
 ip ospf network point-to-point
 no shut
!
interface GigabitEthernet3
 ip address 10.4.6.4 255.255.255.0
 ip ospf network point-to-point
 no shut
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
line con 0
 logging synchronous

#R6
hostname R6
!
interface Loopback0
 ip address 6.6.6.6 255.255.255.255
!
interface GigabitEthernet1
 ip address 10.3.6.6 255.255.255.0
 ip ospf network point-to-point
 no shut
!
interface GigabitEthernet2
 ip address 10.5.6.6 255.255.255.0
 ip ospf network point-to-point
 no shut
!
interface GigabitEthernet3
 ip address 10.4.6.6 255.255.255.0
 ip ospf network point-to-point
 no shut
!
router ospf 1
 network 0.0.0.0 255.255.255.255 area 0
!
line con 0
 logging synchronous

#XR5
hostname XR5
!
interface Loopback0
 ipv4 address 5.5.5.5 255.255.255.255
!
interface GigabitEthernet0/0/0/0
 ipv4 address 10.5.6.5 255.255.255.0
!
router ospf 1
 area 0
  interface Loopback0
  !
  interface GigabitEthernet0/0/0/0
   network point-to-point
  !
 !
!
mpls oam
!
end

First we’ll turn on SR on R1 and specifiy index 1 for its loopback:

#R1
segment-routing mpls
 connected-prefix-sid-map 
  address-family ipv4
   1.1.1.1/32 index 1

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:

#R1
router ospf 
 segment-routing mpls

Opaque LSAs

Notice all the Type 10 Opaque LSAs that R1 has originated:

R1#show ip ospf data | begin Type-10
                Type-10 Opaque Area Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Opaque ID
1.0.0.0         1.1.1.1         108         0x80000001 0x0058D1 0       
1.0.0.1         1.1.1.1         103         0x80000003 0x006DAC 1       
4.0.0.0         1.1.1.1         103         0x80000003 0x00CE8E 0       
7.0.0.0         1.1.1.1         103         0x80000003 0x00EBA9 0       
8.0.0.7         1.1.1.1         103         0x80000003 0x00EBAE 7

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.

LS age: 163
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.0
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 0
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x58D1
  Length: 28
  Fragment number : 0

    MPLS TE router ID : 1.1.1.1

    Number of Links : 0

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?

LS age: 25
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 1.0.0.1
  Opaque Type: 1 (Traffic Engineering)
  Opaque ID: 1
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000002
  Checksum: 0x6FAB
  Length: 80
  Fragment number : 1

    Link connected to Point-to-Point network
      Link ID : 2.2.2.2
      Neighbor Address : 10.1.2.2
      Interface Address : 10.1.2.1
      Admin Metric : 1
      Maximum bandwidth : 125000000
      IGP Metric : 1

    Number of Links : 1

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.

LS age: 25
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 4.0.0.0
  Opaque Type: 4 (Router Information)
  Opaque ID: 0
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000002
  Checksum: 0xD08D
  Length: 76

    TLV Type: Router Information
    Length: 4
    Capabilities:
      Graceful Restart Helper
      Stub Router Support

    TLV Type: Segment Routing Algorithm
    Length: 2
      Algorithm: SPF
      Algorithm: Strict SPF

    TLV Type: Segment Routing Range
    Length: 12
      Range Size: 8000

      Sub-TLV Type: SID/Label
      Length: 3
        Label: 16000

    TLV Type: Segment Routing Node MSD
    Length: 2
      Sub-type: Node Max Sid Depth, Value: 13

    TLV Type: Segment Routing Local Block
    Length: 12
      Range Size: 1000

      Sub-TLV Type: SID/Label
      Length: 3
        Label: 15000

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.

LS age: 25
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 7.0.0.0
  Opaque Type: 7 (Extended Prefix)
  Opaque ID: 0
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000002
  Checksum: 0xEDA8
  Length: 44

    TLV Type: Extended Prefix
    Length: 20
      Prefix    : 1.1.1.1/32
      AF        : 0
      
      Flags     : N-bit

      Sub-TLV Type: Prefix SID
      Length: 8
        Flags : None
        MTID  : 0
        Algo  : SPF
        SID   : 1

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.

LS age: 25
  Options: (No TOS-capability, DC)
  LS Type: Opaque Area Link
  Link State ID: 8.0.0.7
  Opaque Type: 8 (Extended Link)
  Opaque ID: 7
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000002
  Checksum: 0xEDAD
  Length: 92

    TLV Type: Extended Link
    Length: 68
    Link connected to : another Router (point-to-point)
    (Link ID) Neighboring Router ID: 2.2.2.2
    (Link Data) Interface IP address: 10.1.2.1

      Sub-TLV Type: Adj SID
      Length : 7
        Flags  : L-Bit, V-bit
        MTID   : 0
        Weight : 0
        Label  : 16

      Sub-TLV Type: Remote Intf Addr
        Remote Interface Address   : 10.1.2.2

      Sub-TLV Type: Local / Remote Intf ID
        Local Interface ID   : 7
        Remote Interface ID   : 7

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.

R1#show mpls forwarding-table 
Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop    
Label      Label      or Tunnel Id     Switched      interface              
16         Pop Label  10.1.2.2-A       0             Gi1        10.1.2.2    

A  - Adjacency SID

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.

#XR3
router ospf 1
 segment-routing mpls
 area 0
  int Lo0
   prefix-sid index 3

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:

XR3#show mpls forwarding 
Sat Aug 20 21:24:58.539 UTC
Local  Outgoing    Prefix             Outgoing     Next Hop        Bytes       
Label  Label       or ID              Interface                    Switched    
------ ----------- ------------------ ------------ --------------- ------------
16001  16001       SR Pfx (idx 1)     Gi0/0/0/1    10.2.3.2        0           
16002  Pop         SR Pfx (idx 2)     Gi0/0/0/1    10.2.3.2        0           
16004  Pop         SR Pfx (idx 4)     Gi0/0/0/0    10.3.4.4        0           
16005  16005       SR Pfx (idx 5)     Gi0/0/0/2    10.3.6.6        0           
16006  Pop         SR Pfx (idx 6)     Gi0/0/0/2    10.3.6.6        0           
24000  Pop         SR Adj (idx 0)     Gi0/0/0/0    10.3.4.4        0           
24001  Pop         SR Adj (idx 0)     Gi0/0/0/1    10.2.3.2        0           
24002  Pop         SR Adj (idx 0)     Gi0/0/0/2    10.3.6.6        0

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:

R1#show ip ospf data | begin Type-10
                Type-10 Opaque Area Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Opaque ID
1.0.0.0         1.1.1.1         894         0x80000001 0x0058D1 0       
1.0.0.0         2.2.2.2         233         0x80000001 0x005CC5 0       
1.0.0.0         4.4.4.4         199         0x80000001 0x0064AD 0       
1.0.0.0         6.6.6.6         120         0x80000001 0x006C95 0       
1.0.0.1         1.1.1.1         889         0x80000003 0x006DAC 1       
1.0.0.1         2.2.2.2         233         0x80000001 0x000913 1       
1.0.0.1         4.4.4.4         199         0x80000001 0x004EB8 1       
1.0.0.1         6.6.6.6         120         0x80000001 0x00935E 1       
1.0.0.2         2.2.2.2         233         0x80000001 0x0015F0 2       
1.0.0.2         4.4.4.4         199         0x80000001 0x00F40A 2       
1.0.0.2         6.6.6.6         120         0x80000001 0x00EAF7 2       
1.0.0.3         2.2.2.2         233         0x80000001 0x0058B3 3       
1.0.0.3         4.4.4.4         199         0x80000001 0x0001E7 3       
1.0.0.3         6.6.6.6         120         0x80000001 0x0030B8 3       
4.0.0.0         1.1.1.1         889         0x80000003 0x00CE8E 0       
4.0.0.0         2.2.2.2         233         0x80000001 0x00B4A6 0       
4.0.0.0         3.3.3.3         292         0x80000002 0x00B491 0       
4.0.0.0         4.4.4.4         199         0x80000001 0x0078DA 0       
4.0.0.0         5.5.5.5         96          0x80000002 0x0078C5 0       
4.0.0.0         6.6.6.6         120         0x80000001 0x003C0F 0       
7.0.0.0         1.1.1.1         889         0x80000003 0x00EBA9 0       
7.0.0.0         2.2.2.2         233         0x80000001 0x001E70 0       
7.0.0.0         4.4.4.4         199         0x80000001 0x007A02 0       
7.0.0.0         6.6.6.6         120         0x80000001 0x00D693 0       
7.0.0.1         3.3.3.3         297         0x80000001 0x004242 1       
7.0.0.1         5.5.5.5         101         0x80000001 0x009ED3 1       
8.0.0.4         3.3.3.3         292         0x80000003 0x002590 4       
8.0.0.4         5.5.5.5         96          0x80000003 0x00F2A6 4       
8.0.0.5         3.3.3.3         292         0x80000003 0x00358A 5       
8.0.0.6         3.3.3.3         292         0x80000003 0x00CED3 6       
8.0.0.7         1.1.1.1         889         0x80000003 0x00EBAE 7       
8.0.0.7         2.2.2.2         233         0x80000001 0x009704 7       
8.0.0.7         4.4.4.4         199         0x80000001 0x00B1CE 7       
8.0.0.7         6.6.6.6         120         0x80000001 0x003E2D 7       
8.0.0.8         2.2.2.2         233         0x80000001 0x00A7D6 8       
8.0.0.8         4.4.4.4         199         0x80000001 0x00DBA1 8       
8.0.0.8         6.6.6.6         120         0x80000001 0x005803 8       
8.0.0.9         2.2.2.2         233         0x80000001 0x000A7F 9       
8.0.0.9         4.4.4.4         199         0x80000001 0x0082D3 9       
8.0.0.9         6.6.6.6         120         0x80000001 0x005DFA 9

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