Segment Routing With OSPFv2 Node SID

This chapter describes how Segment Routing works with OSPFv2 node SID.

Information About Segment Routing With OSPFv2 Node SID

Segment Routing relies on a small number of extensions to Open Shortest Path First (OSPF) protocols. There are two levels of configuration required to enable segment routing for a routing protocol instance. The top level segment routing configuration which is managed by segment routing infrastructure component enables segment routing, whereas, segment routing configuration at the router ospf level enables segment routing for the ospf instance. There are three segment routing states:
  • SR_NOT_CONFIGURED

  • SR_DISABLED

  • SR_ENABLED

Segment routing configuration under the IGPs is allowed only if the SR state is either SR_DISABLED or SR_ENABLED. The SR_ENABLED state indicates that there is at least a valid SRGB range reserved. You can enable segment routing for IGPs under the router configuration sub mode, through commands. However, IGP segment routing are enabled only after the global SR is configured.

The SR_ENABLED is a necessary state for any protocol to enable SR, however, it is not a sufficient for enabling SR for a protocol instance. The reason being that the OSPF still does not have any information about segment routing global block (SRGB) information. When the request to receive information about the SRGB is processed successfully, the OSPF SR operational state is enabled.

Segment Routing requires each router to advertise its segment routing data-plane capability and the range of MPLS label values that are used for segment routing in the case where global SIDs are allocated. Data-plane capabilities and label ranges are advertised using the SR-capabilities sub-TLV inserted into the OSPF Router Information Opaque LSA.

OSPF SR-capabilities sub TLV includes all reserved SRGB ranges. However, the Cisco implementation supports only one SRGB range.

Prefix-SID Received in Label Switched Path From Remote Routers

OSPF sends the prefix SIDs associated with the connected prefix using the Extended Prefix Sub TLV in its opaque Extended prefix LSA. Prefix SIDs received in a LSA which have got reachability are downloaded to the routing information base (RIB) in the same way as BGP downloads per prefix VPN labels, only if the following conditions are met:

  • Segment routing is enabled for the topology and address-family.

  • Prefix-SID is valid.

  • The local label binding to MFI is successful.


Note


For SIDs that do not fit in the specified SID range, labels are not used when updating the RIB. For the cases, where SID fits in the SID range, but does not fit the next-hop neighbor SID range, remote label associated with that path is not installed.


Segment Routing Adjacency SID Advertisement

Effective with Cisco IOS-XE Release 3.17, OSPF supports the advertisement of segment routing adjacency SID. An Adjacency Segment Identifier (Adj-SID) represents a router adjacency in Segment Routing.

A segment routing-capable router may allocate an Adj-SID for each of its adjacencies and an Adj-SID sub-TLV is defined to carry this SID in the Extended Opaque Link LSA.

OSPF allocates the adjacency SID for each OSPF neighbor if the OSPF adjacency which are in two way or in FULL state. OSPF allocates the adjacency SID only if the Segment Routing is enabled. The label for adjacency SID is dynamically allocated by the system. This eliminates the chances of misconfiguration, as this has got only the local significance.

Multiple Adjacency-SIDs

Effective with Cisco IOS-XE Release 16.3, multiple adjacency-SIDs are supported. For each OSPF adjacency, OSPF allots to Adj SIDs, unprotected and protected Adj-SIDs which are carried in the extended link LSAs. The protected adjacency SID (or back up Adj-SID) is allocated and advertised only when FRR is enabled on the router and also on the interface where SR is enabled on the system. When FRR or SR is disabled, the protected Adj-SID is released.

The persistence of protected adj-SID in forwarding plane is supported. When the primary link is down, OSPF delays the release of its backup Adj-SID until the delay timer (30 sec) expires. This allows the forwarding plane to continue to forward the traffic through the backup path until the router is converged.

The allocated and advertised backup Adj-SIDs can be displayed in the output of show ip ospf neighbor detail and show ip ospf segment-routing protected-adjacencies command.

Segment Routing Mapping Server

Segment Routing Mapping Server (SRMS) allows configuration and maintenance of the Prefix-SID mapping policy entries. Effective with Cisco IOS-XE Release 3.17, the IGPs use the active policy of the SRMS to determine the SID values when programming the forwarding plane.

The SRMS provides prefixes to SID/Label mapping policy for the network. IGPs, on the other hand, are responsible for advertising prefixes to SID/Label mapping policy through the Prefix-SID/Label Binding TLV.

Active policy information and changes are notified to the IGPs, which use active policy information to update forwarding information.

Connected Prefix SIDs

When a router installs a prefix with a SID that is different than what it advertises to the LSP, for example, if more than one protocol or more than one IGP instance is announcing the same prefix with different SIDs to the SRMS, the SRMS resolves the conflict and announces the winning prefix and SID that may not be the same as the local instance. In that case, the IGP always advertises what it learns from its source LSP although it still tries to install the SID which may be different than what it learns in its LSP. This is done to prevent the IGP from redistributing the SIDs from another protocol or another protocol instance.

SRGB Range Changes

When OSPF segment routing is configured, OSPF must request an interaction with the SRGB before OSPF SR operational state can be enabled. If no SRGB range is created, OSPF will not be enabled.

When an SRGB change event occurs, OSPF makes the corresponding changes in its sub-block entries. OSPF also advertises the newly created or extended SRGB range in SR-capabilities sub-TLV and updates the prefix-sid sub TLV advertisement.

MPLS Forwarding on an Interface

MPLS forwarding must be enabled before segment routing can use an interface. OSPF is responsible for enabling MPLS forwarding on an interface.

When segment routing is enabled for a OSPF topology, or OSPF segment routing operational state is enabled, it enables MPLS for any interface on which the OSPF topology is active. Similarly, when segment routing is disabled for a OSPF topology, it disables the MPLS forwarding on all interfaces for that topology.

Conflict Handling of SID Entries

When there is a conflict between the SID entries and the associated prefix entries use any of the following methods to resolve the conflict:

  • When the system receives two SID entries for the same prefix, then the prefix received by higher router ID is treated as the SID corresponding to the prefix. The prefix is installed with the SID entry which was advertised by the higher router ID.
  • When the system receives two SID entries one by OSPF protocol and the other by IS-IS protocol, then the SID entry received by OSPF protocol is treated as valid SID. The prefix is installed with the SID entry which was received by OSPF protocol.

  • When two prefixes are advertised with the same SID entry, then the prefix which is advertised by the higher router ID is installed with the SID entry and the other prefix is installed without any SID entry.

In an ideal situation, each prefix should have unique SID entries assigned.

How to Configure Segment Routing With OSPFv2 Node SID

Perform the following steps to configure segment routing with OSPFv2 node SID.

Configuring Segment Routing With OSPF

Before You Begin

Before configuring OSPF to support segment routing you must first configure the segment routing feature in global configuration mode.

SUMMARY STEPS

    1.    enable

    2.    configure terminal

    3.    segment-routing mpls

    4.    connected-prefix-sid-map

    5.    address-family ipv4

    6.    1.1.1.1/32 index 100 range 1

    7.    exit-address-family


DETAILED STEPS
     Command or ActionPurpose
    Step 1enable


    Example:
    Device# enable
     

    Enables privileged EXEC mode.

    • Enter your password if prompted.
     
    Step 2configure terminal


    Example:
    Device# configure terminal
     

    Enters global configuration mode.

     
    Step 3 segment-routing mpls

    Example:
    Device(config-sr)# segment-routing mpls
     

    Enables the segment feature using the mpls data plane.

     
    Step 4 connected-prefix-sid-map

    Example:
    Device(config-srmpls)# connected-prefix-sid-map
     

    Enters a sub-mode where you can configure address-family specific mappings for local prefixes and SIDs.

     
    Step 5 address-family ipv4

    Example:
    Device(config-srmpls-conn)# address-family ipv4
     

    Specifies IPv4 address prefixes.

     
    Step 61.1.1.1/32 index 100 range 1

    Example:
    Device(config-srmpls-conn-af)# 1.1.1.1/32 100 range 1
     

    Associates SID 100 with the address 1.1.1.1/32.

     
    Step 7exit-address-family

    Example:
    Device(config-srmpls-conn-af)# exit-address-family
     

    Exits the address family.

     

    Configuring Segment Routing on OSPF Network

    Before You Begin

    Before you configure segment routing on OSPF network, OSPF must be enabled on your network.

    SUMMARY STEPS

      1.    router ospf 10

      2.    router-id<id>

      3.    segment-routing mpls

      4.    segment-routing area <area id> mpls

      5.    show ip ospf 10 segment-routing


    DETAILED STEPS
       Command or ActionPurpose
      Step 1router ospf 10


      Example:
      Device(config)# router ospf 10
       

      Enables the OSPF mode.

       
      Step 2router-id<id>


      Example:
      Device(config-router)# router-id 1.0.0.0
       

      Configures OSPF routes.

       
      Step 3segment-routing mpls


      Example:
      Device(config-router)# segment-routing mpls
       

      Configures segment routing mpls mode.

       
      Step 4segment-routing area <area id> mpls


      Example:
      Device(config-router) # segment-routing area 0 mpls
       

      Configures segment routing mpls mode in a specific area.

       
      Step 5show ip ospf 10 segment-routing


      Example:
      Device# show ip ospf 10 segment-routing
       

      Shows the output for configuring SR under OSPF.

      The following example displays output from the show ip ospf segment-routing state command for the segment routing under OSPF:

      Device#show ip ospf 10 segment-routing              
      
                  OSPF Router with ID (0.0.0.1) (Process ID 10)
      
      Global segment-routing state: Enabled
      
      Segment Routing enabled:
                 Area        Topology name   Forwarding
                    0                 Base      MPLS
                    1                 Base      MPLS
      
      SR Attributes
          Prefer non-SR (LDP) Labels
          Do not advertise Explicit Null
      
      Local MPLS label block (SRGB):
          Range: 16000 - 23999
          State: Created
      
      Registered with SR App, client handle: 3
        Connected map notifications active (handle 0x4), bitmask 0x1
        Active policy map notifications active (handle 0x5), bitmask 0xC
      Registered with MPLS, client-id: 100
      
      Bind Retry timer not running
      Adj Label Bind Retry timer not running
      
       

      Configuring Prefix-SID for OSPF

      This task explains how to configure prefix segment identifier (SID) index under each interface.

      Before You Begin

      Segment routing must be enabled on the corresponding address family.

      SUMMARY STEPS

        1.    enable

        2.    configure terminal

        3.    segment-routing mpls

        4.    connected-prefix-sid-map

        5.    address-family ipv4

        6.    1.1.1.1/32 index 100 range 1

        7.    exit


      DETAILED STEPS
         Command or ActionPurpose
        Step 1 enable

        Example:
        Device# enable
         

        Enables privileged EXEC mode.

         
        Step 2 configure terminal

        Example:
        Device# configure terminal
         

        Enters global configuration mode.

         
        Step 3segment-routing mpls


        Example:
        Device(config)# segment-routing mpls
         

        Configures segment routing mpls mode.

         
        Step 4connected-prefix-sid-map


        Example:
        Device(config-srmpls)# connected-prefix-sid-map
         

        Enters a sub-mode where you can configure address-family specific mappings for local prefixes and SIDs.

         
        Step 5address-family ipv4


        Example:
        Device(config-srmpls-conn)# address-family ipv4
         

        Specifies the IPv4 address family and enters router address family configuration mode.

         
        Step 61.1.1.1/32 index 100 range 1

        Example:
        Device(config-srmpls-conn-af)# 1.1.1.1/32 100 range 1
         

        Associates SID 100 with the address 1.1.1.1/32.

         
        Step 7 exit

        Example:
        Device(config-router)# exit
         

        Exits segment routing mode and returns to the configuration terminal mode.

         

        Configuring Prefix Attribute N-flag-clear

        OSPF advertises prefix SIDs via Extended Prefix TLV in its opaque LSAs. It carries flags for the prefix and one of them is N flag (Node) indicating that any traffic sent along to the prefix is destined to the router originating the LSA. This flag typically marks host routes of router's loopback.

        SUMMARY STEPS

          1.    enable

          2.    configure terminal

          3.    interface loopback3

          4.    ip ospf prefix-attributes n-flag-clear


        DETAILED STEPS
           Command or ActionPurpose
          Step 1enable


          Example:
          Device# enable
           

          Enables privileged EXEC mode.

          • Enter your password if prompted.
           
          Step 2configure terminal


          Example:
          Device# configure terminal
           

          Enters global configuration mode.

           
          Step 3 interface loopback3

          Example:
          Device(config)# interface loopback3
           

          Specifies the interface loopback.

           
          Step 4 ip ospf prefix-attributes n-flag-clear

          Example:
          Device(config-if)# ip ospf prefix-attributes n-flag-clear
           

          Clears the prefix N-flag.

           

          Configuring Explicit Null Attribute With OSPF

          To disable penultimate-hop-popping (PHP) and add explicit-Null label, explicit-null option needs to be specified. Once the option is given, OSPF sets the E flag in the Extended prefix-SID TLV in its LSAs.

          By default, a flag called E-flag (Explicit-Null flag) is set to 0 by OSPF when advertising a Prefix SID which is associated with a loopback address. If you wish to set this flag add explicit configuration.

          SUMMARY STEPS

            1.    enable

            2.    configure terminal

            3.    segment-routing mpls

            4.    set-attributes

            5.    address-family ipv4

            6.    explicit-null

            7.    exit-address-family


          DETAILED STEPS
             Command or ActionPurpose
            Step 1enable


            Example:
            Device# enable
             

            Enables privileged EXEC mode.

            • Enter your password if prompted.
             
            Step 2configure terminal


            Example:
            Device# configure terminal
             

            Enters global configuration mode.

             
            Step 3segment-routing mpls

            Example:
            Device(config)# segment-routing mpls
             

            Configures segment routing mpls mode.

             
            Step 4set-attributes

            Example:
            Device(config-srmpls)# set-attributes
             

            Sets the attribute.

             
            Step 5address-family ipv4


            Example:
            Device(config-srmpls-attr)# address-family ipv4
             

            Specifies the IPv4 address family and enters router address family configuration mode.

             
            Step 6explicit-null


            Example:
            Device(config-srmpls-attr-af)# explicit-null
             

            Specifies the explicit-null.

             
            Step 7exit-address-family


            Example:
            Device(config-srmpls-attr-af)# exit-address-family
             

            Exits the address family.

             

            Configuring Segment Routing Label Distribution Protocol Preference With OSPF

            SUMMARY STEPS

              1.    enable

              2.    configure terminal

              3.    segment-routing mpls

              4.    set-attributes

              5.    address-family ipv4

              6.    sr-label-preferred

              7.    exit-address-family


            DETAILED STEPS
               Command or ActionPurpose
              Step 1enable


              Example:
              Device# enable
               

              Enables privileged EXEC mode.

              • Enter your password if prompted.
               
              Step 2configure terminal


              Example:
              Device# configure terminal
               

              Enters global configuration mode.

               
              Step 3segment-routing mpls

              Example:
              Device(config)# segment-routing mpls
               

              Configures segment routing mpls mode.

               
              Step 4set-attributes

              Example:
              Device(config-srmpls)# set-attributes
               

              Sets the attribute.

               
              Step 5address-family ipv4


              Example:
              Device(config-srmpls-attr)# address-family ipv4
               

              Specifies the IPv4 address family and enters router address family configuration mode.

               
              Step 6sr-label-preferred


              Example:
              Device(config-srmpls-attr-af)# sr-label-preferred
               

              Specifies SR label to be preferred over the LDP.

               
              Step 7exit-address-family


              Example:
              Device(config-srmpls-attr-af)# exit-address-family
               

              Exits the address family.

               

              Configuring OSPF SRMS

              The following command enables the OSPF SRMS and allows OSPF to advertise local mapping entries. OSPF does not send remote entries to the SRMS library. However, OSPF uses the SRMS active policy, which is computed based only on the locally configured mapping entries.

              [no] segment-routing prefix-sid-map advertise-local 
              

              Configuring OSPF SRMS Client

              By default, the OSPF SRMS client mode is enabled. OSPF always sends remote prefix-sid-mapping entries received through LSAs, to SRMS. The SRMS active policy is calculated based on both, local and remote mapping entries.

              The following command disables the prefix-sid-mapping client functionality and it is configured on the receiver side.

              segment-routing prefix-sid-map receive [disable] 
              

              Additional References for Segment Routing With OSPFv2 Node SID

              Related Documents

              Related Topic

              Document Title

              Cisco IOS commands

              Cisco IOS Master Command List, All Releases http:/​/​www.cisco.com/​c/​en/​us/​td/​docs/​ios-xml/​ios/​mcl/​allreleasemcl/​all-book.html

              IP Routing ISIS commands

              Cisco IOS IP Routing ISIS commands http:/​/​www.cisco.com/​c/​en/​us/​td/​docs/​ios-xml/​ios/​mcl/​allreleasemcl/​all-book.html

              Feature Information for Segment Routing With OSPFv2 Node SID

              Table 1 Feature Information for Segment Routing With OSPFv2 Node SID

              Feature Name

              Releases

              Feature Information

              Segment Routing With OSPF

              Cisco IOS XE Release 3.16S

              Cisco IOS XE Fuji 16.7.1

              The Segment Routing OSPFv2 node SID feature provides support for segment routing on OSPF networks.

              The following commands were introduced or modified: connected-prefix-sid-map, show ip ospf 10 segment-routing, sr-label-preferred, ip ospf prefix-attributes n-flag-clear .

              In Cisco IOS XE Fuji 16.7.1, this feature is supported on Cisco 4000 Series Integrated Service Routers.