BGP On-Demand Next Hop and Auto Steering
This chapter contains configurations of BGP on-demand next hop (ODN) and auto steering with segment routing.
SR Policy is identified by three main components which are: Headend, Endpoint and Color.
When redistributing routing information across domains, provisioning of multi-domain services (Layer 2 VPN and Layer 3 VPN) has its own complexity and scalability issues.
Segment Routing On-Demand Next Hop (ODN) or SR TE auto steering triggers delegation of computation of an end-to-end LSP using dynamic computation (isis/ospf/pcep) including constraints and policies without doing any redistribution. It then installs the reapplied multi-domain LSP for the duration of the service into the local forwarding information base (FIB).
Coloring plays very important role in automated steering solution. Color information is exchanged by BGP extended community attribute (sub tlv) and BGP tunnel encapsulation attribute in the VPN route UPDATE messages. Egress PE node colors the service routes (VPN routes), advertises to ingress PE with colors that signifies SRTE SLA requirement. Ingress node uses this color to match SR policy, once node identifies SR policy by matching color, it automatically steers traffic onto the SR policy. This is called Automated Steering.
Topology
%20and%20Auto%20Steering.png)
BGP On-Demand Next Hop (ODN) and Auto Steering
Configuring 
Configuring and bring up BGP On-demand next hop and auto steering with Segment-routing on PE1 (Ingress) and PE2 (Egress) nodes.
Note:	Segment routing ODN template must be configured before receiving FTN update in NSM. 
Ingress PE1
Create VRF 
| P1#configure terminal | Enter configure mode | 
| P1(config)#interface ce51 | Enter interface mode | 
| P1(config-if)# ipv6 address 5001::2/64 | Configure the IPv6 address of the interface | 
| P1(config-if)# ipv6 router isis 1 | Make the interface part of the router ISIS 1 instance | 
| P1(config)#interface ce50 | Enter interface mode | 
| P1(config-if)# ipv6 address 3001::1/64 | Configure the IP address of the interface | 
| P1(config-if)# ipv6 router isis 1 | Make the interface part of the router ISIS 1 instance | 
| P1(config-if)#exit | Exit interface mode | 
 
Access Interface Configuration 
| PE1(config)# interface eth1 | Enter the interface mode for eth1 | 
| PE1(config-if)# ip vrf forwarding vrf1 | Bind the VRF instance to the interface | 
| PE1(config-if)# ip address 101.1.1.1/24 | Configure IPv4 address | 
| PE1(config-if)# label-switching | Commit interface configurations | 
| PE1(config-if)# exit | Exit interface mode | 
Configuring Segment-Routing ODN Template  
| PE1#configure terminal | Enter configure mode | 
| PE1(config)#segment-routing | Enter the Segment Routing mode | 
| PE1(config-sr)#traffic-engineering | Enter traffic-engineering mode | 
| PE1(config-sr-te)#on-demand-nexthop 1001 | Configure SRODN template | 
| PE1(config-sr-odn)#candidate-path 1 | Enter candidate path mode | 
| PE1(config-sr-odn-cp)#dynamic-path ospf 100 | Configure dynamic path OSPF | 
| PE1(config-sr-odn-cp)#exit-odn-cp | Exit candidate-path mode | 
| PE1(config-sr-odn)#exit-sr-odn | Exit ODN template mode | 
| PE1(config-sr-te)#exit-te | Exit from traffic-engineering mode | 
| PE1(config-sr)#commit | Commit SR configuration | 
| PE1(config-sr)#exit | Exit from Segment-routing mode | 
Configuring BGP and Redistribute Connected VRF   
| PE1(config)#router bgp 100 | Enter Router BGP mode | 
| PE1(config-router)#bgp router-id 1.1.1.1 | Configure BGP router-id | 
| PE1(config-router)#neighbor 4.4.4.4 remote-as 100  | Configuring PE2 as iBGP neighbor using it's loopback ip | 
| PE1(config-router)# neighbor 4.4.4.4 update-source lo | Source of routing updates as loopback | 
| PE1(config-router)#address-family vpnv4 unicast | Enter VPNv4 Address family mod | 
| PE1(config-router-af)# neighbor 4.4.4.4 activate | Enabling VPNv4 Address family for neighbor | 
| PE1(config-router-af)# exit-address-family | Exit Address-family mode | 
| PE1(config-router)#address-family ipv4 vrf vrf1 | Configure VRF address family | 
| PE1(config-router-af)# redistribute connected | Redistribute connected router | 
| PE1(config-router-af)# exit-address-family | Exit VRF address family | 
| PE1(config-router)# commit | Commit BGP configurations | 
| PE1(config-router)# exit | Exit form Router BGP mode and return to config mode | 
 
Egress PE2 
Configure VRF 
| P2#configure terminal | Enter configure mode | 
| PE2(config)#ip vrf vrf1 | Create new vrf name vrf1 | 
| PE2(config-vrf)#rd 100:100 | Assign the route distinguisher (RD) value as 100:100 | 
| PE2(config-vrf)#route-target both 101:101 | Import routes between route target (RT) ext-communities 101 and 101 | 
| PE2(config-vrf)#commit | Commit vrf configuration | 
| PE2(config)#exit | Exit form vrf mode | 
Access Interface Configuration 
| PE2(config)# interface eth1 | Enter the interface mode for eth1 | 
| PE2(config-if)# ip vrf forwarding vrf1 | Bind the VRF instance to the interface | 
| PE2(config-if)# ip address 101.1.1.1/24 | Configure IPv4 address | 
| PE2(config-if)# label-switching | Commit interface configurations | 
| PE2(config-if)# exit | Exit interface mode | 
Configuring Set Extcommunity Color Under Route-Map  
| PE2#configure terminal | Enter configure mode | 
| PE2(config)#route-map pfp1 permit 10 | Create route-map | 
| PE2(config-route-map)# set extcommunity color 1001 | Configure set extcommunity color to route-map | 
| PE2(config-route-map)# commit | Commit the route-map configurations | 
| PE2(config-route-map)# exit | Exit from route-map and return to configuration mode | 
Configuring BGP and Redistribute Connected VRF   
| PE2(config)#router bgp 100 | Enter Router BGP mode | 
| PE2(config-router)#bgp router-id 4.4.4.4 | Configure BGP router-id | 
| PE2(config-router)#neighbor 1.1.1.1 remote-as 100  | Configuring PE2 as iBGP neighbor using it's loopback ip | 
| PE2(config-router)# neighbor 1.1..1.1 update-source lo | Source of routing updates as loopback | 
| PE2(config-router)#address-family vpnv4 unicast | Enter VPNv4 Address family mod | 
| PE2(config-router-af)# neighbor 1.1.1.1 activate | Enabling VPNv4 Address family for neighbor | 
| PE2(config-router-af)# exit-address-family | Exit Address-family mode | 
| PE2(config-router)#address-family ipv4 vrf vrf1 | Configure VRF address family | 
| PE2(config-router-af)# redistribute connected route-map pfp1 | Redistribute connected router | 
| PE2(config-router-af)# exit-address-family | Exit VRF address family | 
| PE2(config-router)# commit | Commit BGP configurations | 
| PE2(config-router)# exit | Exit form Router BGP mode and return to config mode | 
 
Validation 1
PE1#show segment-routing policy
Policy-Name                                                  Color       End-point        State       Forwarding-Info
policy_odn_1_1001_1.1.1.1                                    1001        1.1.1.1          UP          18001/po36
PE1#show segment-routing policy detail
Policy-Name: policy_odn_1_1001_1.1.1.1    Color 1001   End-point 1.1.1.1          Tunnel-ID: 1
  Admin-Status: UP    Oper-Status: UP for 00:01:53
  State Transition Count: 1
  CSPF Retry Limit: 100    CSPF Retry Interval: 10
  ODN-Policy: True
  Binding SID :
   BSID: 0
   Alloc mode: Dynamic
   Oper State: Programmed
 
  CP ID: 1, Active
    Preference: 100    Path Type: Dynamic(ospf)    CP Origin: Local
    CP state: Valid
    Segment List:
    Total no. of segments: 1
     Segment0[LABEL]: Label :18001
    Out-if: po36         Out-label-stack: 18001
    Attributes:
      Configured:
        Affinity:
        Metric-type: TE
        IP Constraints:
PE1#show mpls vrf-forwarding-table
Codes: > - installed FTN, * - selected FTN, p - stale FTN, ! - using backup, B - BGP FTN
(m) - Service mapped over multipath transport
(e) - Service mapped over LDP ECMP
Code    FEC                 FTN-ID    Nhlfe-ID    Pri   LSP-Type     Out-Label    Out-Intf     Nexthop
   B>   101.1.1.0/24        1         111         Yes   LSP_DEFAULT  29504        -            1.1.1.1
PE1#show mpls vrf-table
Output for IPv4 VRF table with id: 2
 Primary FTN entry with FEC: 101.1.1.0/24, id: 1, row status: Active, Tunnel-Policy: N/A
  Owner: BGP, distance: 0, Action-type: Redirect to Tunnel, Exp-bits: 0x0, Incoming DSCP: none
  Transport Tunnel id: 1, Protected LSP id: 0, QoS Resource id: 0, Description: N/A, BGP Color: 1001, Color: 1001
     Cross connect ix: 42, in intf: - in label: 0 out-segment ix: 111
      Owner: BGP, Persistent: No, Admin Status: Up, Oper Status: Up
       Out-segment with ix: 111, owner: BGP, Stale: NO, BGP out intf: po36, transport out intf: po36, out label: 29504
    Nexthop addr: 1.1.1.1        cross connect ix: 42, op code: Push and Lookup
PE1#show ip bgp vpnv4 all summary
BGP router identifier 65.1.1.1, local AS number 100
BGP table version is 2
1 BGP AS-PATH entries
0 BGP community entries
 
Neighbor                 V   AS   MsgRcv    MsgSen TblVer   InQ   OutQ    Up/Down   State/PfxRcd
1.1.1.1                  4   100  321        318       2      0      0  00:02:20               1
Total number of neighbors 1
Total number of Established sessions 1
PE1#show ip bgp vpnv4 all
Status codes: s suppressed, d damped, h history, a add-path, * valid, > best, i - internal, l - labeled
              S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
     Network          Next Hop           Metric    LocPrf     Weight Path
Route Distinguisher: 101:101 (Default for VRF vrf1)
*>i  101.1.1.0/24     1.1.1.1              0        100       0    ?
*> l 201.1.1.0        0.0.0.0              0        100       32768  ?
 Announced routes count = 1
 Accepted routes count = 1
Route Distinguisher: 101:101
*>i  101.1.1.0/24     1.1.1.1              0        100       0    ?
 Announced routes count = 0
 Accepted routes count = 1
PE1#
Validation 2
PE2#show mpls vrf-forwarding-table
Codes: > - installed FTN, * - selected FTN, p - stale FTN, ! - using backup, B - BGP FTN
(m) - Service mapped over multipath transport
(e) - Service mapped over LDP ECMP
Code    FEC                 FTN-ID    Nhlfe-ID    Pri   LSP-Type     Out-Label    Out-Intf     Nexthop
   B>   201.1.1.0/24        1         217         Yes   LSP_DEFAULT  29440        -            6.6.6.6
PE2#show mpls vrf-table
Output for IPv4 VRF table with id: 2
 Primary FTN entry with FEC: 201.1.1.0/24, id: 1, row status: Active, Tunnel-Policy: N/A
  Owner: BGP, distance: 0, Action-type: Redirect to Tunnel, Exp-bits: 0x0, Incoming DSCP: none
  Transport Tunnel id: 0, Protected LSP id: 0, QoS Resource id: 0, Description: N/A, BGP Color: 0, Color: 0
     Cross connect ix: 51, in intf: - in label: 0 out-segment ix: 217
      Owner: BGP, Persistent: No, Admin Status: Up, Oper Status: Up
       Out-segment with ix: 217, owner: BGP, Stale: NO, BGP out intf: po12, transport out intf: po12, out label: 29440
    Nexthop addr: 6.6.6.6        cross connect ix: 51, op code: Push and Lookup
PE2#show ip bgp vpnv4 all
Status codes: s suppressed, d damped, h history, a add-path, * valid, > best, i - internal, l - labeled
              S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
     Network          Next Hop           Metric    LocPrf     Weight Path
Route Distinguisher: 101:101 (Default for VRF vrf1)
*> l 101.1.1.0/24     0.0.0.0              0        100       32768  ?
*>i  201.1.1.0        6.6.6.6              0        100       0    ?
 Announced routes count = 1
 Accepted routes count = 1
Route Distinguisher: 101:101
*>i  201.1.1.0        6.6.6.6              0        100       0    ?
 Announced routes count = 0
 Accepted routes count = 1
PE2#show ip bgp vpnv4 all summary
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 4
1 BGP AS-PATH entries
0 BGP community entries
Neighbor                 V   AS   MsgRcv    MsgSen TblVer   InQ   OutQ    Up/Down   State/PfxRcd
6.6.6.6                  4   100  313        312       4      0      0  00:05:04               1
Total number of neighbors 1
Total number of Established sessions 1
PE2#