Juniper — Segment Routing (SR), ISIS

Antonió Faria
5 min readJul 21, 2023

This post will discuss my early introduction to segment routing (SR) and its deployment within my JNCIP-SP lab. Note segment routing is not a topic on the JNCIP-SP exam.

Above is the lab I used and it is comprised of four autonomous systems. For this article, I will focus solely on AS126.

Concepts

Segment Routing (SR) distributes labels with an MPLS network. It uses extensions in the Interior Gateway Protocol (IGP) to share label information between routers. SR has some benefits over its predecessors RSVP and LDP. I would recommend reading the first chapter of Juniper's day one book which discusses it in more detail.

The primary difference between RSVP/LDP and SR is how the label operations are conducted. In SR the source instructs how the packet should flow throughout the network by stacking segments (labels) onto the packet before forwarding. As the packet flows through routers within the network a segment is removed from the packet.

How do routers share label information?

The IGP is used to share label information between routers. Within ISIS a set of sub-TLVs was created to distribute this information (RFC8667) within link state PDUs.

root@R8:R8-7> show isis database extensive |find tlv
TLVs:
Area address: 49.0001 (3)
LSP Buffer Size: 1492
Speaks: IP
Speaks: IPV6
IP router id: 172.16.126.1
IP address: 172.16.126.1 #This is R1's TLV's
Hostname: R5-R5-1
IS neighbor: R6-R6-3.00, Internal, Metric: default 1
IS neighbor: R5-R5-2.00, Internal, Metric: default 1
Extended IS Reachability TLV, Type: 22, Length: 80
IS extended neighbor: R6-R6-3.00, Metric: default 1 SubTLV len: 29
IP address: 172.1.3.0
Neighbor's IP address: 172.1.3.1
Local interface index: 346, Remote interface index: 343
# Example Adjacency SID sub tlv for the link between R1 -> R3 P2P IPV4 Adj-SID - Flags:0x70(F:0,B:1,V:1,L:1,S:0,P:0), Weight:0, Label: 19
P2P IPv4 Adj-SID: 19, Weight: 0, Flags: -BVL--
IS extended neighbor: R5-R5-2.00, Metric: default 1 SubTLV len: 29
IP address: 172.1.2.0
Neighbor's IP address: 172.1.2.1
Local interface index: 339, Remote interface index: 340
P2P IPV4 Adj-SID - Flags:0x70(F:0,B:1,V:1,L:1,S:0,P:0), Weight:0, Label: 18
P2P IPv4 Adj-SID: 18, Weight: 0, Flags: -BVL--
IP prefix: 172.1.2.0/31, Internal, Metric: default 1, Up
IP prefix: 172.1.3.0/31, Internal, Metric: default 1, Up
IP prefix: 172.16.126.1/32, Internal, Metric: default 0, Up
IP extended prefix: 172.1.2.0/31 metric 1 up
IP extended prefix: 172.1.3.0/31 metric 1 up
IP extended prefix: 172.16.126.1/32 metric 0 up
8 bytes of subtlvs
# Example node SID sub tlv for R1's loopbackNode SID, Flags: 0x40(R:0,N:1,P:0,E:0,V:0,L:0), Algo: SPF(0), Value: 1
Router Capability: Router ID 172.16.126.1, Flags: 0x00
SPRING Capability - Flags: 0xc0(I:1,V:1), Range: 9000, SID-Label: 1000
SPRING Algorithm - Algo: 0

Segments

Segment Routing Global Block (SRGB)

The SRGB reserves a range of labels for global segments. Each vendor has its own approach to this. Junos requires it to be explicitly configured.

root@R5:R5-1> show configuration protocols isis
source-packet-routing {
srgb start-label 1000 index-range 9000;
}

Adjacency Segments

Adjacency segments are used to allocate a label or multiple labels to an ISIS adjacency and have local significance.

Node / Prefix Segments

Prefix segments are used to allocate a label to a prefix. A common example of a prefix segment is a node segment which has global significance.

What is an index and why do we use them?

A globally unique index value is assigned to each prefix segment in an SR domain. Indexes are used as the SRGB start label can be unique between routers.

Above we have a simple domain where each router has a unique SRGB start label, loopback address and index.

When R1 does a routing lookup and sees the next hop is R4. R1s shortest path to R4 is via R2. R1 will have the SRGB start label of R2 as well as the index advertised by R4 and will add the start label + index = 2004 and forward it to R2.

R2 receives the packet labelled with 2004 and it has determined its shortest path neighbour to R4 is via R3. It's already calculated the start label + index and swaps the label received from R1 with 3004. R3 receives the packet and determines its shortest path is direct and does penultimate hop hopping.

It is best practice to ensure the SRGB start label is the same. This allows for easier troubleshooting of the network and is one of the advantages of SR. Below is a traceroute between R2 and R7. Each hop has the same label applied. Compared to LDP or RSVP and you are likely to see a unique label per hop.

root@R5:R5-2> traceroute routing-instance VPN-A 192.168.0.254
traceroute to 192.168.0.254 (192.168.0.254), 30 hops max, 52 byte packets
1 172.2.4.1 (172.2.4.1) 868.328 ms 1014.183 ms 23.468 ms
MPLS Label=1007 CoS=0 TTL=1 S=0
MPLS Label=18 CoS=0 TTL=1 S=1
2 172.4.6.1 (172.4.6.1) 93.371 ms 73.261 ms 59.243 ms
MPLS Label=1007 CoS=0 TTL=1 S=0
MPLS Label=18 CoS=0 TTL=2 S=1
3 172.6.8.1 (172.6.8.1) 74.504 ms 73.648 ms 54.070 ms
MPLS Label=1007 CoS=0 TTL=1 S=0
MPLS Label=18 CoS=0 TTL=3 S=1
4 192.168.0.254 (192.168.0.254) 10.450 ms 10.557 ms 7.043 ms

root@R5:R5-2>

Configuring Segment Routing

Now I have introduced the basic concepts of segment routing, let's learn how to configure it.

Enable MPLS within the interface and protocol hierarchy.

root@R8:R8-7> show configuration interfaces
lt-0/0/0 {
unit 1 {
encapsulation ethernet;
peer-unit 2;
family inet {
address 172.7.8.0/31;
}
family iso;
family mpls;
}
}
ge-0/0/5 {
unit 0 {
family inet {
address 172.5.7.1/31;
}
family iso;
family mpls;
}
}
root@R8:R8-7> show configuration protocols mpls
icmp-tunneling;
interface ge-0/0/5.0;
interface lt-0/0/0.1;

Enable segment routing within the ISIS hierarchy. Apply a node-segment ipv4-index value. This applies to the loopback prefix.

root@R8:R8-7> show configuration protocols isis
reference-bandwidth 1g;
source-packet-routing {
srgb start-label 1000 index-range 9000;
node-segment ipv4-index 7;
}
level 1 disable;
interface lt-0/0/0.1 {
point-to-point;
}
interface ge-0/0/5.0 {
point-to-point;
}
interface lo0.1 {
passive;
}

Verification

show isis database extensive
show isis database extensive | find tlv
show route table inet.3
show route table mpls.0

--

--

Antonió Faria

Technical Consultant at AS57650. Glorified postman, pushing packets. I write code in Python and Go.