summaryrefslogtreecommitdiff
path: root/docs/configuration/protocols/segment-routing.md
blob: b0896f7307e5d266a9e95f592e9c97841494f543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
---
myst:
  html_meta:
    description: |
      Segment Routing (SR) is a source-routing network architecture in
      which the ingress router attaches a list of Segment Identifiers
      (SIDs) to each packet to define its forwarding path.
    keywords: segment routing, sr, sid, srgb, srlb, mpls, isis, ospf
---

(segment-routing)=

# Segment Routing

{abbr}`SR (Segment Routing)` is a network architecture similar to source
routing. The ingress router attaches a list of segments, known as
{abbr}`SIDs (Segment Identifiers)`, to each packet as it enters the network.

The SID list explicitly defines the path the packet will follow. At each
node, the router reads the first SID, executes its forwarding instruction,
and typically removes it so the next node can process the subsequent SID.

SR relies on {abbr}`IGPs (Interior Gateway Protocols)` such as IS-IS or OSPF
to advertise SIDs across the network.

```{note}
SR defines a control plane architecture and can be applied to existing
MPLS-based data planes. In MPLS networks, segments are encoded as MPLS
labels and applied at the ingress router. These labels are then
distributed across the routing domain by IGPs such as IS-IS (as described
in [RFC 8667](https://datatracker.ietf.org/doc/html/rfc8667)) or OSPF.

SR for the MPLS data plane supports IPv4, IPv6, and
{abbr}`ECMP (Equal-Cost Multi-Path)`, and has been tested with Cisco and
Juniper routers. However, this deployment is still experimental for FRR.
```

## IS-IS SR configuration

Use the following commands to enable SR on IS-IS.

Known limitations:

- No support for level redistribution (L1 to L2 or L2 to L1).
- No support for {abbr}`BSID (Binding SID)`.
- Only a single {abbr}`SRGB (Segment Routing Global Block)` and the default
  {abbr}`SPF (Shortest Path First)` algorithm are supported.

```{cfgcmd} set protocols isis segment-routing global-block high-label-value \<16-1048575\>

**Configure the upper bound of the Segment Routing Global Block (SRGB).**

The SRGB defines the range of MPLS labels reserved for mapping global
segments, such as Prefix-SIDs, to FIB entries.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols isis segment-routing global-block high-label-value 23999
```

```{cfgcmd} set protocols isis segment-routing global-block low-label-value \<16-1048575\>

**Configure the lower bound of the Segment Routing Global Block (SRGB).**

The SRGB defines the range of MPLS labels reserved for mapping global
segments, such as Prefix-SIDs, to FIB entries.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols isis segment-routing global-block low-label-value 16000
```

```{cfgcmd} set protocols isis segment-routing local-block high-label-value \<16-1048575\>

**Configure the upper bound of the Segment Routing Local Block (SRLB).**

The SRLB defines the range of MPLS labels that a router reserves for its
local segments, such as Adjacency-SIDs.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols isis segment-routing local-block high-label-value 15999
```

```{cfgcmd} set protocols isis segment-routing local-block low-label-value \<16-1048575\>

**Configure the lower bound of the Segment Routing Local Block (SRLB).**

The SRLB defines the range of MPLS labels that a router reserves for its
local segments, such as Adjacency-SIDs.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols isis segment-routing local-block low-label-value 15000
```

```{note}
SR label blocks have the following configuration constraints:

- Both bounds (`high-label-value` and `low-label-value`) must be set.
  Removing either bound also removes the other.
- `local-block` requires `global-block` to be configured.
- The SRGB and SRLB ranges must not overlap.

Violating any of these causes the commit to fail.
```

```{cfgcmd} set protocols isis segment-routing maximum-label-depth \<1-16\>

**Configure the {abbr}`MSD (Maximum SID Depth)` supported by the router.**

The value depends on the MPLS data plane.
```

Example:

```none
set protocols isis segment-routing maximum-label-depth 10
```

```{cfgcmd} set protocols isis segment-routing prefix \<address\> index value \<0-65535\>

**Configure a Prefix-SID with an index value for the specified IP prefix.**

A Prefix-SID is a Segment Identifier associated with an IP prefix and
distributed by the IGP (IS-IS).
```

Example:

```none
set protocols isis segment-routing prefix 192.0.2.1/32 index value 1
```

```{cfgcmd} set protocols isis segment-routing prefix \<address\> index \<no-php-flag | explicit-null\>

**Configure a label processing flag for the indexed Prefix-SID associated
with the specified IP prefix:**

- `no-php-flag`: Requests the upstream neighbor not to pop the Prefix-SID
  label before forwarding the packet.
- `explicit-null`: Requests that the upstream neighbor forwards the packet
  with the Explicit-Null label.
```

Example:

```none
set protocols isis segment-routing prefix 192.0.2.1/32 index no-php-flag
```

```{cfgcmd} set protocols isis segment-routing prefix \<address\> absolute value \<16-1048575\>

**Configure a Prefix-SID with an absolute value for the specified IP
prefix**

A Prefix-SID is a Segment Identifier associated with an IP prefix and
distributed by the IGP (IS-IS).
```

Example:

```none
set protocols isis segment-routing prefix 192.0.2.1/32 absolute value 16001
```

```{cfgcmd} set protocols isis segment-routing prefix \<address\> absolute \<no-php-flag | explicit-null\>

**Configure a label processing flag for the absolute Prefix-SID associated
with the specified IP prefix:**

* `no-php-flag`: Requests the upstream neighbor not to pop the Prefix-SID
  label before forwarding the packet.
* `explicit-null`: Requests that the upstream neighbor forwards the packet
  with the Explicit-Null label.
```

Example:

```none
set protocols isis segment-routing prefix 192.0.2.1/32 absolute no-php-flag
```

### Operational commands

```{opcmd} show isis segment-routing node

**Show all learned SR nodes.**
```

```{opcmd} show isis route prefix-sid

**Show all learned Prefix-SIDs and their MPLS labels.**
```

```{note}
For more information, see {ref}`isis`.
```

## OSPF SR configuration

Use the following commands to enable SR on OSPF.

```{cfgcmd} set protocols ospf parameters opaque-lsa

**Enable Opaque {abbr}`LSA (Link State Advertisement)`
([RFC 2370](https://datatracker.ietf.org/doc/html/rfc2370)) in OSPF.**

Opaque LSAs are required to transport MPLS labels via OSPF.
```

Example:

```none
set protocols ospf parameters opaque-lsa
```

```{cfgcmd} set protocols ospf segment-routing global-block high-label-value \<16-1048575\>

**Configure the upper bound of the Segment Routing Global Block (SRGB).**

The SRGB defines the range of MPLS labels reserved for mapping Prefix-SIDs
to FIB entries.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols ospf segment-routing global-block high-label-value 23999
```

```{cfgcmd} set protocols ospf segment-routing global-block low-label-value \<16-1048575\>

**Configure the lower bound of the Segment Routing Global Block (SRGB).**

The SRGB defines the range of MPLS labels reserved for mapping Prefix-SIDs
to FIB entries.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols ospf segment-routing global-block low-label-value 16000
```

```{cfgcmd} set protocols ospf segment-routing local-block high-label-value \<16-1048575\>

**Configure the upper bound of the Segment Routing Local Block (SRLB).**

The SRLB defines the range of MPLS labels that a router reserves for its
local segments, such as Adjacency-SIDs.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols ospf segment-routing local-block high-label-value 15999
```

```{cfgcmd} set protocols ospf segment-routing local-block low-label-value \<16-1048575\>

**Configure the lower bound of the Segment Routing Local Block (SRLB).**

The SRLB defines the range of MPLS labels that a router reserves for its
local segments, such as Adjacency-SIDs.

The range cannot exceed 65535 labels.
```

Example:

```none
set protocols ospf segment-routing local-block low-label-value 15000
```

```{note}
SR label blocks have the following configuration constraints:

- Both bounds (`high-label-value` and `low-label-value`) must be set.
  Removing either bound also removes the other.
- `local-block` requires `global-block` to be configured.
- The SRGB and SRLB ranges must not overlap.

Violating any of these causes the commit to fail.
```

```{cfgcmd} set protocols ospf segment-routing maximum-label-depth \<1-16\>

**Configure the {abbr}`MSD (Maximum SID Depth)` supported by the router.**

The value depends on the MPLS data plane.
```

Example:

```none
set protocols ospf segment-routing maximum-label-depth 10
```

```{cfgcmd} set protocols ospf segment-routing prefix \<address\> index value \<0-65535\>

**Configure a Prefix-SID for the specified IP prefix.**

A Prefix-SID is a Segment Identifier associated with an IP prefix and
distributed by the IGP (OSPF).

Prefix-SIDs are unique within an SR domain.
```

Example:

```none
set protocols ospf segment-routing prefix 192.0.2.1/32 index value 1
```

```{cfgcmd} set protocols ospf segment-routing prefix \<address\> index \<no-php-flag | explicit-null\>

**Configure a label processing flag for the Prefix-SID associated with the
specified IP prefix:**

- `no-php-flag`: Requests the upstream neighbor not to pop the Prefix-SID
  label before forwarding the packet.
- `explicit-null`: Requests that the upstream neighbor forwards the packet
  with the Explicit-Null label.
```

Example:

```none
set protocols ospf segment-routing prefix 192.0.2.1/32 index no-php-flag
```

```{note}
For more information, see {ref}`ospf`.
```

## Examples

### Enable SR on IS-IS (experimental)

The following example demonstrates a basic two-node SR topology using IS-IS.

**Node 1:**

```none
set interfaces loopback lo address '198.51.100.1/32'
set interfaces ethernet eth1 address '192.0.2.1/24'

set protocols isis interface eth1
set protocols isis interface lo
set protocols isis net '49.0001.1980.5110.0001.00'
set protocols isis segment-routing global-block high-label-value '599'
set protocols isis segment-routing global-block low-label-value '550'
set protocols isis segment-routing prefix 198.51.100.1/32 index value '1'
set protocols isis segment-routing prefix 198.51.100.1/32 index explicit-null
set protocols mpls interface 'eth1'
```

**Node 2:**

```none
set interfaces loopback lo address '198.51.100.2/32'
set interfaces ethernet eth1 address '192.0.2.2/24'

set protocols isis interface eth1
set protocols isis interface lo
set protocols isis net '49.0001.1980.5110.0002.00'
set protocols isis segment-routing global-block high-label-value '599'
set protocols isis segment-routing global-block low-label-value '550'
set protocols isis segment-routing prefix 198.51.100.2/32 index value '2'
set protocols isis segment-routing prefix 198.51.100.2/32 index explicit-null
set protocols mpls interface 'eth1'
```

The following outputs show that MPLS Segment Routing is enabled and that
each router has learned MPLS labels for the other router's loopback:

```none
Node-1@vyos:~$ show mpls table
 Inbound Label  Type        Nexthop                Outbound Label
 ----------------------------------------------------------------------
 552            SR (IS-IS)  192.0.2.2              IPv4 Explicit Null     <-- Node-2 loopback learned on Node-1
 15000          SR (IS-IS)  192.0.2.2              implicit-null
 15001          SR (IS-IS)  fe80::e87:6cff:fe09:1  implicit-null
 15002          SR (IS-IS)  192.0.2.2              implicit-null
 15003          SR (IS-IS)  fe80::e87:6cff:fe09:1  implicit-null
```

```none
Node-2@vyos:~$ show mpls table
 Inbound Label  Type        Nexthop               Outbound Label
 ---------------------------------------------------------------------
 551            SR (IS-IS)  192.0.2.1             IPv4 Explicit Null     <-- Node-1 loopback learned on Node-2
 15000          SR (IS-IS)  192.0.2.1             implicit-null
 15001          SR (IS-IS)  fe80::e33:2ff:fe80:1  implicit-null
 15002          SR (IS-IS)  192.0.2.1             implicit-null
 15003          SR (IS-IS)  fe80::e33:2ff:fe80:1  implicit-null
```

The following outputs show MPLS Segment Routing label assignments for IP
routes:

```none
Node-1@vyos:~$ show ip route isis
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

I   192.0.2.0/24 [115/20] via 192.0.2.2, eth1 inactive, weight 1, 00:07:48
I>* 198.51.100.2/32 [115/20] via 192.0.2.2, eth1, label IPv4 Explicit Null, weight 1, 00:03:39
```

```none
Node-2@vyos:~$ show ip route isis
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

I   192.0.2.0/24 [115/20] via 192.0.2.1, eth1 inactive, weight 1, 00:07:46
I>* 198.51.100.1/32 [115/20] via 192.0.2.1, eth1, label IPv4 Explicit Null, weight 1, 00:03:43
```

### Enable SR on OSPF (experimental)

The following example demonstrates a basic two-node SR topology using OSPF.

**Node 1:**

```none
set interfaces loopback lo address 198.51.100.1/32
set interfaces ethernet eth0 address 192.0.2.1/24
set protocols ospf area 0 network '192.0.2.0/24'
set protocols ospf area 0 network '198.51.100.1/32'
set protocols ospf parameters opaque-lsa
set protocols ospf parameters router-id '198.51.100.1'
set protocols ospf segment-routing global-block high-label-value '1100'
set protocols ospf segment-routing global-block low-label-value '1000'
set protocols ospf segment-routing prefix 198.51.100.1/32 index explicit-null
set protocols ospf segment-routing prefix 198.51.100.1/32 index value '1'
```

**Node 2:**

```none
set interfaces loopback lo address 198.51.100.2/32
set interfaces ethernet eth0 address 192.0.2.2/24
set protocols ospf area 0 network '192.0.2.0/24'
set protocols ospf area 0 network '198.51.100.2/32'
set protocols ospf parameters opaque-lsa
set protocols ospf parameters router-id '198.51.100.2'
set protocols ospf segment-routing global-block high-label-value '1100'
set protocols ospf segment-routing global-block low-label-value '1000'
set protocols ospf segment-routing prefix 198.51.100.2/32 index explicit-null
set protocols ospf segment-routing prefix 198.51.100.2/32 index value '2'
```

The following outputs show MPLS Segment Routing label assignments:

```none
Node-1@vyos:~$ show mpls table
 Inbound Label  Type       Nexthop      Outbound Label
 -----------------------------------------------------------
 1002           SR (OSPF)  192.0.2.2    IPv4 Explicit Null  <-- Node-2 loopback learned on Node-1
 15000          SR (OSPF)  192.0.2.2    implicit-null
 15001          SR (OSPF)  192.0.2.2    implicit-null
```

```none
Node-2@vyos:~$ show mpls table
 Inbound Label  Type       Nexthop      Outbound Label
 -----------------------------------------------------------
 1001           SR (OSPF)  192.0.2.1    IPv4 Explicit Null  <-- Node-1 loopback learned on Node-2
 15000          SR (OSPF)  192.0.2.1    implicit-null
 15001          SR (OSPF)  192.0.2.1    implicit-null
```

The following outputs show MPLS Segment Routing label assignments for IP
routes:

```none
Node-1@vyos:~$ show ip route ospf
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

O   198.51.100.1/32 [110/0] is directly connected, lo, weight 1, 00:03:43
O>* 198.51.100.2/32 [110/1] via 192.0.2.2, eth0, label IPv4 Explicit Null, weight 1, 00:03:32
O   192.0.2.0/24 [110/1] is directly connected, eth0, weight 1, 00:03:43
```

```none
Node-2@vyos:~$ show ip route ospf
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

O>* 198.51.100.1/32 [110/1] via 192.0.2.1, eth0, label IPv4 Explicit Null, weight 1, 00:03:36
O   198.51.100.2/32 [110/0] is directly connected, lo, weight 1, 00:03:51
O   192.0.2.0/24 [110/1] is directly connected, eth0, weight 1, 00:03:51
```