The first implementation of Segment Routing in Junos allowed to advertise a single Node-SID associated with the primary address of the node.
Starting Junos 17.2R1, Juniper allows to configure multiple prefix segments, this post explains how to configure it.
Prior to Junos 17.2R1, the configuration of the Node-SID was achieved using the following configuration:
s@RTR> show configuration protocols isis source-packet-routing
node-segment {
ipv4-index 5; <- Index to be associated with the primary address
index-range 10000;
}
s@RTR> show isis database RTR.00-00 extensive
IS-IS level 1 link-state database:
IS-IS level 2 link-state database:
RTR.00-00 Sequence: 0x579, Checksum: 0x47db, Lifetime: 50903 secs
IPV4 Index: 5
Node Segment Blocks Advertised:
Start Index : 0, Size : 10240, Label-Range: [ 800000, 810239 ]
...
IP extended prefix: 192.168.217.32/32 metric 0 up
14 bytes of subtlvs
Administrative tag 1: 200
Node SID, Flags: 0x40(R:0,N:1,P:0,E:0,V:0,L:0), Algo: SPF(0), Value: 5
The "ipv4-index" describes the index value to be associated with the primary address of the node. The prefix associated with this primary address is advertised as a Node-SID (N flag set).
The 17.2R1 release allows to advertise multiple Prefix-SIDs by using a routing-policy. This routing-policy needs to be used as an export policy in the IGP protocol (IS-IS or OSPF).
s@RTR> show configuration protocols isis
export EXPORT-TO-ISIS;
lsp-lifetime 65535;
no-ipv6-routing;
spf-options {
delay 100;
holddown 2000;
rapid-runs 5;
}
s@RTR> show configuration interfaces lo0
unit 0 {
family inet {
address 10.0.0.1/32 {
primary;
}
address 10.0.1.1/32;
address 10.0.2.1/32;
}
family iso {
address 49.0001.0000.c218.0011.00;
}
}
s@RTR> show configuration policy-options policy-statement EXPORT-TO-ISIS
term ACCEPT-LO1 {
from {
protocol direct;
route-filter 10.0.0.1/32 exact;
}
then accept;
}
term ACCEPT-LO2 {
from {
protocol direct;
route-filter 10.0.1.1/32 exact;
}
then {
prefix-segment index 4000 node-segment;
accept;
}
}
term ACCEPT-LO3 {
from {
protocol direct;
route-filter 10.0.2.1/32 exact;
}
then {
prefix-segment index 6000;
accept;
}
}
term REJECT-LO0 {
from {
protocol direct;
interface lo0.0;
}
then reject;
}
term NEXT-POLICY {
then next policy;
}
The configuration described above allows to advertise a combination of Node-SID and Prefix-SIDs.
The interface lo0.0 has three addresses: 10.0.0.1, 10.0.1.1 and 10.0.2.1.
The routing-policy EXPORT-TO-ISIS has the following effects:
- It will export the prefix 10.0.0.1/32 in IS-IS without a Prefix-SID.
- It will export the prefix 10.0.1.1/32 in IS-IS with a Node-SID index 4000 (the "node-segment" statement allows to set the node-flag).
- It will export the prefix 10.0.2.1/32 in IS-IS with a Prefix-SID index 6000 (the node flag will be unset).
s@RTR> show isis database RTR.00-00 extensive
IS-IS level 1 link-state database:
IS-IS level 2 link-state database:
RTR.00-00 Sequence: 0x68c, Checksum: 0x450, Lifetime: 65529 secs
IPV4 Index: 4000
Node Segment Blocks Advertised:
Start Index : 0, Size : 10000, Label-Range: [ 16000, 25999 ]
IP extended prefix: 10.0.1.1/32 metric 0 up
8 bytes of subtlvs
Node SID, Flags: 0x40(R:0,N:1,P:0,E:0,V:0,L:0), Algo: SPF(0), Value: 4000
IP extended prefix: 10.0.0.1/32 metric 0 up
IP extended prefix: 10.0.2.1/32 metric 0 up
8 bytes of subtlvs
Prefix SID, Flags: 0x00(R:0,N:0,P:0,E:0,V:0,L:0), Algo: SPF(0), Value: 6000
Router Capability: Router ID 10.0.0.1, Flags: 0x00
SPRING Capability - Flags: 0x80(I:1,V:0), Range: 10000, SID-Label: 16000
SPRING Algorithm - Algo: 0
The configuration of the routing-policy to set Prefix-SIDs is compatible with the old configuration style "ipv4-index". If an "ipv4-index" value of X is configured and if a Prefix SID index Y is associated to the primary address in the routing-policy, the routing policy will override the "ipv4-index" value. As a consequence, the primary address will be advertised with an index value of Y.