OcNOS-SP : Segment Routing Guide : Segment Routing Configuration Guide : Segment Routing Policy for Traffic Engineering : Explicit Path Policy
Explicit Path Policy
PE1
 
PE1#configure terminal
Enter configure mode.
PE1(config)#interface lo
Enter interface mode.
PE1(config-if)#ip address 1.1.1.1/32 secondary
Configure the IP address of the interface.
PE1(config-if)#prefix-sid index 1
Configure prefix sid index value.
PE1(config-if)#exit
Exit interface mode.
PE1(config)#interface eth1
Enter interface mode.
PE1(config-if)#ip address 10.1.2.1/24
Configure the IP address of the interface.
PE1(config-if)#label-switching
Enable label switching.
PE1(config-if)#exit
Exit interface mode
PE1(config)#interface eth2
Enter interface mode.
PE1(config-if)#ip address 10.1.3.1/24
Configure the IP address of the interface.
PE1(config-if)#label-switching
Enable label switching.
PE1(config-if)#exit
Exit interface mode.
PE1(config)#router ospf 1
Set the routing process ID .
PE1(config-router)#ospf router-id 1.1.1.1
Configuring OSPF router-id
PE1(config-router)#network 1.1.1.1/32 area 0.0.0.0
Configure OSPF network in area 0
PE1(config-router)#network 10.1.2.0/24 area 0.0.0.0
Configure OSPF network in area 0
PE1(config-router)#network 10.1.3.0/24 area 0.0.0.0
Configure OSPF network in area 0
PE1(config-router)#segment-routing mpls
Enable segment routing under router OSPF process.
PE1(config-router)#exit
Exit router mode.
PE1(config)#ip vrf vrf1
Configure VPN Routing/Forwarding instance
PE1(config-vrf)#rd 100:1
route distinguisher
PE1(config-vrf)#route-target both 200:1
route target
PE1(config-vrf)#exit
Exit VRF mode
PE1(config)#interface eth3
Enter interface mode
PE1(config-if)#ip vrf forwarding vrf1
Enable IP VRF forwarding on the interface
PE1(config-if)#ip address 177.1.1.1/24
Configure the IP address for the non-default VRF interface.
PE1(config-if)#exit
Exit interface mode.
PE1(config)#router bgp 100
Configure router BGP in AS 100
PE1(config-router)#neighbor 1.1.1.6 remote-as 100
Configure neighbor in remote-as 100
PE1(config-router)#neighbor 1.1.1.6 update-source lo
Configure neighbor with update-source loopback
PE1(config-router)#address-family vpnv4 unicast
Enter VPNv4 Address family mode
PE1(config-router-af)#neighbor 1.1.1.6 activate
Activate VPNv4 neighbor
PE1(config-router-af)#exit-address-family
Exit from Address Family configuration mode
PE1(config-router)#address-family ipv4 vrf vrf1
Enter address-family VRF
PE1(config-router-af)#redistribute connected
Redistribute all the connected VRF routes
PE1(config-router-af)#exit-address-family
Exit from Address Family configuration mode
PE1(config-router)#exit
Exit router mode
PE1(config)#commit
Commit candidate configuration to be running configuration
PE1(config)#exit
Exit configuration mode
Explicit Path Configuration on PE1
 
PE1(config)#segment-routing
Enter segment-routing mode
PE1(config-sr)#traffic-engineering
Enter segment-routing traffic-engineering mode
PE1(config-sr-te)#segment-list p1-p3-pe2
Configure a segment-list
PE1(config-sr-sl)#index 10 segment-type-1 16002
Configure the segment-list entry with index 10 and label as prefix-sid of P2
PE1(config-sr-sl)#index 20 segment-type-1 16004
Configure the segment-list entry with index 10 and label as prefix-sid of P4
PE1(config-sr-sl)#index 30 segment-type-1 16006
Configure the segment-list entry with index 10 and label as prefix-sid of PE2
PE1(config-sr-sl)#exit-sr-sl
Exit router mode
PE1(config-sr-te)#policy to-pe2
Configure an SR-policy
PE1(config-sr-pol)#color 111 end-point 1.1.1.6
Configure SR-policy with key ie., color and end-point
PE1(config-sr-pol)#candidate-path 1
Configure a candidate-path for the SR-policy
PE1(config-sr-pol-cp)#preference 1000
Configure the preference value for the candidate-path
PE1(config-sr-pol-cp)#explicit segment-list p1-p3-pe2
Configure the candidate-path as explicit-path with segment-list
PE1(config-sr-pol-cp)#exit
Exit segment-routing mode
PE1(config)#exit
Exit configure terminal mode
PE1(config)#commit
Commit candidate configuration to be running configuration
P1
 
P1#configure terminal
Enter configure mode.
P1(config)#interface lo
Enter interface mode.
P1(config-if)#ip address 1.1.1.2/32 secondary
Configure the IP address of the interface.
P1(config-if)#prefix-sid index 2
Configure prefix sid index value.
P1(config-if)#exit
Exit interface mode.
P1(config)#interface eth1
Enter interface mode.
P1(config-if)#ip address 10.1.2.2/24
Configure the IP address of the interface.
P1(config-if)#label-switching
Enable label switching.
P1(config-if)#exit
Exit interface mode.
P1(config)#interface eth2
Enter interface mode.
P1(config-if)#ip address 10.2.4.1/24
Configure the IP address of the interface.
P1(config-if)#label-switching
Enable label switching.
P1(config-if)#exit
Exit interface mode.
P1(config)#interface eth3
Enter interface mode.
P1(config-if)#ip address 10.2.3.1/24
Configure the IP address of the interface.
P1(config-if)#label-switching
Enable label switching.
P1(config-if)#exit
Exit interface mode.
P1(config)#router ospf 1
Set the routing process ID .
P1(config-router)#ospf router-id 1.1.1.2
Configure OSPF router-id
P1(config-router)#network 1.1.1.2/32 area 0.0.0.0
Configure OSPF network in area 0
P1(config-router)#network 10.1.2.0/24 area 0.0.0.0
Configure OSPF network in area 0
P1(config-router)#network 10.2.3.0/24 area 0.0.0.0
Configure OSPF network in area 0
P1(config-router)#network 10.2.4.0/24 area 0.0.0.0
Configure OSPF network in area 0
P1(config-router)#segment-routing mpls
Enable segment routing under router process.
P1(config-router)#exit
Exit router mode.
P1(config)#exit
Exit configure terminal mode
P2
 
P2#configure terminal
Enter configure mode.
P2(config)#interface lo
Enter interface mode.
P2(config-if)#ip address 1.1.1.3/32 secondary
Configure the IP address of the interface.
P2(config-if)#prefix-sid index 3
Configure prefix SID index value.
P2(config-if)#exit
Exit interface mode.
P2(config)#interface eth2
Enter interface mode.
P2(config-if)#ip address 10.1.3.2/24
Configure the IP address of the interface.
P2(config-if)#label-switching
Enable label switching.
P2(config-if)#exit
Exit interface mode.
P2(config)#interface eth1
Enter interface mode.
P2(config-if)#ip address 10.3.5.1/24
Configure the IP address of the interface.
P2(config-if)#label-switching
Enable label switching.
P2(config-if)#exit
Exit interface mode.
P2(config)#interface eth3
Enter interface mode.
P2(config-if)#ip address 10.2.3.2/24
Configure the IP address of the interface.
P2(config-if)#label-switching
Enable label switching.
P2(config-if)#exit
Exit interface mode.
P2(config)#router ospf 1
Set the routing process ID .
P2(config-router)#ospf router-id 1.1.1.3
Configure OSPF router-id
P2(config-router)#network 1.1.1.3/32 area 0.0.0.0
Configure OSPF network in area 0
P2(config-router)#network 10.1.3.0/24 area 0.0.0.0
Configure OSPF network in area 0
P2(config-router)#network 10.2.3.0/24 area 0.0.0.0
Configure OSPF network in area 0
P2(config-router)#network 10.3.5.0/24 area 0.0.0.0
Configure OSPF network in area 0
P2(config-router)#segment-routing mpls
Enable segment routing under router process.
P2(config-router)#exit
Exit router mode.
P2(config)#exit
Exit configure terminal mode
P1(config)#commit
Commit candidate configuration to be running configuration
P3
 
P3#configure terminal
Enter configure mode.
P3(config)#interface lo
Enter interface mode.
P3(config-if)#ip address 1.1.1.4/32 secondary
Configure the IP address of the interface.
P3(config-if)#prefix-sid index 4
Configure prefix SID index value.
P3(config-if)#exit
Exit interface mode.
P3(config)#interface eth2
Enter interface mode.
P3(config-if)#ip address 10.2.4.2/24
Configure the IP address of the interface.
P3(config-if)#label-switching
Enable label switching.
P3(config-if)#exit
Exit interface mode.
P3(config)#interface eth3
Enter interface mode.
P3(config-if)#ip address 10.4.5.1/24
Configure the IP address of the interface.
P3(config-if)#label-switching
Enable label switching.
P3(config-if)#exit
Exit interface mode.
P3(config)#interface eth1
Enter interface mode.
P3(config-if)#ip address 10.4.6.1/24
Configure the IP address of the interface.
P3(config-if)#label-switching
Enable label switching.
P3(config-if)#exit
Exit interface mode.
P3(config)#router ospf 1
Set the routing process ID .
P3(config-router)#ospf router-id 1.1.1.4
Configure OSPF router-id
P3(config-router)#network 1.1.1.4/32 area 0.0.0.0
Configure OSPF network in area 0
P3(config-router)#network 10.2.4.0/24 area 0.0.0.0
Configure OSPF network in area 0
P3(config-router)#network 10.4.5.0/24 area 0.0.0.0
Configure OSPF network in area 0
P3(config-router)#network 10.4.6.0/24 area 0.0.0.0
Configure OSPF network in area 0
P3(config-router)#segment-routing mpls
Enable segment routing under router process.
P3(config-router)#exit
Exit router mode.
P3(config)#exit
Exit configure terminal mode
P3(config)#commit
Commit candidate configuration to be running configuration
P4
 
P4#configure terminal
Enter configure mode.
P4(config)#interface lo
Enter interface mode.
P4(config-if)#ip address 1.1.1.5/32 secondary
Configure the IP address of the interface.
P4(config-if)#prefix-sid index 5
Configure prefix sid index value.
P4(config-if)#exit
Exit interface mode.
P4(config)#interface eth1
Enter interface mode.
P4(config-if)#ip address 10.3.5.2/24
Configure the IP address of the interface.
P4(config-if)#label-switching
Enable label switching.
P4(config-if)#exit
Exit interface mode.
P4(config)#interface eth3
Enter interface mode.
P4(config-if)#ip address 10.4.5.2/24
Configure the IP address of the interface.
P4(config-if)#label-switching
Enable label switching.
P4(config-if)#exit
Exit interface mode.
P4(config)#interface eth2
Enter interface mode.
P4(config-if)#ip address 10.5.6.1/24
Configure the IP address of the interface.
P4(config-if)#label-switching
Enable label switching.
P4(config-if)#exit
Exit interface mode.
P4(config)#router ospf 1
Set the routing process ID .
P4(config-router)#ospf router-id 1.1.1.5
Configure OSPF router-id
P4(config-router)#network 1.1.1.5/32 area 0.0.0.0
Configure OSPF network in area 0
P4(config-router)#network 10.3.5.0/24 area 0.0.0.0
Configure OSPF network in area 0
P4(config-router)#network 10.4.5.0/24 area 0.0.0.0
Configure OSPF network in area 0
P4(config-router)#network 10.5.6.0/24 area 0.0.0.0
Configure OSPF network in area 0
P4(config-router)#segment-routing mpls
Enable segment routing under router process.
P4(config-router)#exit
Exit router mode.
P4(config)#exit
Exit configure terminal mode
P4(config)#commit
Commit candidate configuration to be running configuration
PE2
 
PE2#configure terminal
Enter configure mode.
PE2(config)#interface lo
Enter interface mode.
PE2(config-if)#ip address 1.1.1.6/32 secondary
Configure the IP address of the interface.
PE2(config-if)#prefix-sid index 6
Configure prefix SID index value.
PE2(config-if)#exit
Exit interface mode.
PE2(config)#interface eth1
Enter interface mode.
PE2(config-if)#ip address 10.4.6.2/24
Configure the IP address of the interface.
PE2(config-if)#label-switching
Enable label switching.
PE2(config-if)#exit
Exit interface mode
PE2(config)#interface eth2
Enter interface mode.
PE2(config-if)#ip address 10.5.6.2/24
Configure the IP address of the interface.
PE2(config-if)#label-switching
Enable label switching.
PE2(config-if)#exit
Exit interface mode.
PE2(config)#router ospf 1
Set the routing process ID .
PE2(config-router)#ospf router-id 1.1.1.6
Configuring OSPF router-id
PE2(config-router)#network 1.1.1.6/32 area 0.0.0.0
Configure OSPF network in area 0
PE2(config-router)#network 10.4.6.0/24 area 0.0.0.0
Configure OSPF network in area 0
PE2(config-router)#network 10.5.6.0/24 area 0.0.0.0
Configure OSPF network in area 0
PE2(config-router)#segment-routing mpls
Enable segment routing under router OSPF process.
PE2(config-router)#exit
Exit router mode.
PE2(config)#ip vrf vrf1
Configure VPN Routing/Forwarding instance
PE2(config-vrf)#rd 100:1
route distinguisher
PE2(config-vrf)#route-target both 200:1
route target
PE2(config)#exit
Exit vrf mode
PE2(config)#interface eth3
Enter interface mode
PE2(config-if)#ip vrf forwarding vrf1
Enable IP VRF forwarding on the interface
PE2(config-if)#ip address 202.1.1.2/24
Configure the IP address of the non-default VRF interface.
PE2(config-if)#exit
Exit interface mode.
PE2(config)#router bgp 100
Configure router BGP in AS 100
PE2(config-router)#neighbor 1.1.1.1 remote-as 100
Configure neighbor in remote-as 100
PE2(config-router)#neighbor 1.1.1.1 update-source lo
Configure neighbor with update-source loopback
PE2(config-router)#address-family vpnv4 unicast
Enter VPNv4 Address family mode
PE2(config-router-af)#neighbor 1.1.1.1 activate
Activate VPNv4 neighbor
PE2(config-router-af)#exit-address-family
Exit from Address Family configuration mode
PE2(config-router)#address-family ipv4 vrf vrf1
Enter address-family VRF
PE2(config-router-af)#redistribute connected
Redistribute all the connected VRF routes
PE2(config-router-af)#exit-address-family
Exit from Address Family configuration mode
PE2(config-router)#exit
Exit router mode
PE2(config)#exit
Exit router mode
PE2(config)#commit
Commit candidate configuration to be running configuration
PE2(config)#exit
Exit configuration mode
Validation 1
PE1#show ip ospf neighbor
 
Total number of full neighbors: 2
OSPF process 1 VRF(default):
Neighbor ID Pri State Dead Time Address Interface Instance ID
1.1.1.2 1 Full/Backup 00:00:38 10.1.2.2 eth1 0
1.1.1.3 1 Full/Backup 00:00:38 10.1.3.2 eth2 0
PE1#
Validation 2
PE1#show segment-routing policy
Policy Color End-point State Forwarding-Info
to-pe2 111 1.1.1.6 UP 3/16004/16006/eth1
 
PE1#show segment-routing policy detail
Policy-Name: to-pe2 Color 111 End-point 1.1.1.6 Tunnel-ID: 1
Admin-Status: UP Oper-Status: UP for 00:08:05
State Transition Count: 1
CSPF Retry Limit: 100 CSPF Retry Interval: 10
Binding SID :
BSID: 25600
Alloc mode: Dynamic
Oper State: Programmed
 
CP ID: 1, Active
Preference: 1000 Path Type: Explicit CP Origin: Local
Segment List:
Total no. of segments: 3
Segment0[LABEL]: Label :16002
Segment1[LABEL]: Label :16004
Segment2[LABEL]: Label :16006
Out-if: eth1 Out-label-stack: 3/16004/16006
Attributes:
Configured:
Explicit segment-list Name: p1-p3-pe2
 
PE1#show segment-routing policy candidate-path origin local
 
Policy-Name Color End-point State Forwarding-Info
to-pe2 111 1.1.1.6 UP 3/16004/16006/eth1
CP ID: 1, Active
Preference: 1000 Path Type: Explicit CP Origin: Local
CP state: Valid
Segment List:
Total no. of segments: 3
Segment0[LABEL]: Label :16002
Segment1[LABEL]: Label :16004
Segment2[LABEL]: Label :16006
Out-if: eth1 Out-label-stack: 3/16004/16006
Attributes:
Configured:
Explicit segment-list Name: p1-p3-pe2
 
 
PE1#show mpls ilm-table
Codes: > - installed ILM, * - selected ILM, p - stale ILM
K - CLI ILM, T - MPLS-TP, s - Stitched ILM
S - SNMP, L - LDP, R - RSVP, C - CRLDP
B - BGP , K - CLI , V - LDP_VC, I - IGP_SHORTCUT
O - OSPF/OSPF6 SR, i - ISIS SR, k - SR CLI
P - SR Policy, U - unknown
 
Code FEC/VRF/L2CKT ILM-ID In-Label Out-Label In-Intf Out-Intf/VRF Nexthop LSP-Type
O> 10.1.2.2/32 1 24320 3 N/A eth1 10.1.2.2 LSP_DEFAULT
O> 1.1.1.3/32 5 16003 3 N/A eth2 10.1.3.2 LSP_DEFAULT
O> 1.1.1.2/32 2 16002 3 N/A eth1 10.1.2.2 LSP_DEFAULT
O> 1.1.1.5/32 7 16005 16005 N/A eth2 10.1.3.2 LSP_DEFAULT
O> 1.1.1.4/32 6 16004 16004 N/A eth1 10.1.2.2 LSP_DEFAULT
O> 1.1.1.6/32 8 16006 16006 N/A eth2 10.1.3.2 LSP_DEFAULT
B> vrf1 9 24960 Nolabel N/A vrf1 N/A LSP_DEFAULT
O> 10.1.3.2/32 4 24321 3 N/A eth2 10.1.3.2 LSP_DEFAULT
P> 1.1.1.6/32 3 25600 16004 N/A eth1 10.1.2.2 LSP_DEFAULT
PE1#
 
PE1#show mpls ftn-table 1.1.1.6/32
Primary FTN entry with FEC: 1.1.1.6/32, id: 2, row status: Active, Tunnel-Policy: N/A
Owner: SR_POLICY, distance: 0, Action-type: Redirect to Tunnel, Exp-bits: 0x0, Incoming DSCP: none
Tunnel id: 1, Protected LSP id: 0, QoS Resource id: 0, Description: N/A, Color: 0
Cross connect ix: 2, in intf: - in label: 0 out-segment ix: 3
Owner: N/A, Persistent: No, Admin Status: Up, Oper Status: Up
Out-segment with ix: 3, owner: N/A, Stale: NO, out intf: eth1, out label: 3\16004\16006
Nexthop addr: 10.1.2.2 cross connect ix: 2, op code: Push
 
 
Primary FTN entry with FEC: 1.1.1.6/32, id: 6, row status: Active, Tunnel-Policy: N/A
Owner: OSPF-SR, distance: 110, Action-type: Redirect to Tunnel, Exp-bits: 0x0, Incoming DSCP: none
Tunnel id: 0, Protected LSP id: 0, QoS Resource id: 0, Description: N/A, Color: 0
Cross connect ix: 7, in intf: - in label: 0 out-segment ix: 11
Owner: OSPF-SR, Persistent: No, Admin Status: Down, Oper Status: Down
Out-segment with ix: 11, owner: OSPF-SR, Stale: NO, out intf: eth2, out label: 16006
Nexthop addr: 10.1.3.2 cross connect ix: 7, op code: Push
 
PE1#
 
PE1#show mpls forwarding-table
Codes: > - installed FTN, * - selected FTN, p - stale FTN,
B - BGP FTN, K - CLI FTN, t - tunnel, P - SR Policy FTN,
L - LDP FTN, R - RSVP-TE FTN, S - SNMP FTN, I - IGP-Shortcut,
U - unknown FTN, O - SR-OSPF FTN, i - SR-ISIS FTN, k - SR-CLI FTN
 
Code FEC FTN-ID Nhlfe-ID Tunnel-id Pri LSP-Type Out-Label Out-Intf ELC Nexthop
O> 1.1.1.2/32 1 2 0 Yes LSP_DEFAULT 3 eth1 No 10.1.2.2
O> 1.1.1.3/32 3 6 0 Yes LSP_DEFAULT 3 eth2 No 10.1.3.2
O> 1.1.1.4/32 4 8 0 Yes LSP_DEFAULT 16004 eth1 No 10.1.2.2
O> 1.1.1.5/32 5 10 0 Yes LSP_DEFAULT 16005 eth2 No 10.1.3.2
P> 1.1.1.6/32 2 4 1 Yes LSP_DEFAULT 3 eth1 No 10.1.2.2
O 1.1.1.6/32 6 11 0 Yes LSP_DEFAULT 16006 eth2 No 10.1.3.2
PE1#
Validation 3
PE1#show ip bgp vpnv4 all summary
BGP router identifier 1.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.6 4 100 94 97 2 0 0 00:38:50 1
 
Total number of neighbors 1
 
Total number of Established sessions 1
PE1#
 
PE1#show mpls vrf-table
Output for IPv4 VRF table with id: 2
Primary FTN entry with FEC: 202.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, Color: 111
Cross connect ix: 8, in intf: - in label: 0 out-segment ix: 12
Owner: BGP, Persistent: No, Admin Status: Up, Oper Status: Up
Out-segment with ix: 12, owner: BGP, Stale: NO, BGP out intf: xe7, transport out intf: xe7, out label: 24960
Nexthop addr: 1.1.1.6 cross connect ix: 8, op code: Push and Lookup
 
Last modified date: 10/20/2023