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
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
|
---
myst:
html_meta:
description: |
Multiprotocol Label Switching (MPLS) is a packet-forwarding method
that forwards traffic using exact-match lookups on MPLS labels
rather than IP address lookups.
keywords: mpls, ldp, label distribution protocol, lsp, label switching
---
(mpls)=
# MPLS
{abbr}`MPLS (Multiprotocol Label Switching)` is a packet-forwarding method
that differs from traditional IP forwarding. Instead of performing IP address
lookups, MPLS routers forward traffic using exact-match lookups on MPLS labels
inserted between the Layer 2 (Ethernet) and Layer 3 (IP) headers.
MPLS labels can be assigned statically or dynamically. This section focuses on
dynamic label allocation using label distribution protocols such as the
{abbr}`LDP (Label Distribution Protocol)` and
{abbr}`RSVP-TE (Resource Reservation Protocol for Traffic Engineering)`, or
via {abbr}`SR (Segment Routing)` extensions to OSPF or IS-IS.
These protocols establish a unidirectional path called a
{abbr}`LSP (Label-Switched Path)` across the network. When a packet enters
the MPLS network, the ingress router pushes an MPLS label onto it based on
the destination and forwards the packet along the LSP. Each intermediate
router uses the incoming label to look up the outgoing interface and next
label value, swaps the label, and forwards the packet on that interface. The
egress router pops the label and forwards the original packet using normal
IP routing.
## MPLS support in VyOS
MPLS support in VyOS is under development, so its feature set is currently
limited. Basic MPLS forwarding is functional, as the underlying FRR routing
stack supports [RFC 3031](https://datatracker.ietf.org/doc/html/rfc3031).
Supported features:
- **LDP**: Implemented according to
[RFC 5036](https://datatracker.ietf.org/doc/html/rfc5036).
```{note}
Other related LDP standards include RFCs
[6720](https://datatracker.ietf.org/doc/html/rfc6720),
[6667](https://datatracker.ietf.org/doc/html/rfc6667),
[5919](https://datatracker.ietf.org/doc/html/rfc5919),
[5561](https://datatracker.ietf.org/doc/html/rfc5561), and
[7552](https://datatracker.ietf.org/doc/html/rfc7552).
```
Current limitations:
- **MPLS VPNs**: No support yet for MPLS-enabled VPN services, such as
L2VPNs and mVPNs.
- **RSVP-TE**: Not supported, as the underlying FRR stack does not currently
implement it.
## Label Distribution Protocol (LDP)
MPLS supports various protocols for path creation. VyOS implements LDP via
the underlying FRR routing stack, per
[RFC 5036](https://datatracker.ietf.org/doc/html/rfc5036).
LDP is a TCP-based MPLS signaling protocol that dynamically distributes
labels to create label-switched paths. It is not a routing protocol and
depends on existing routing protocols for forwarding decisions and
communication with other LDP-enabled routers.
To exchange label advertisements, LDP establishes TCP sessions with
automatically discovered or statically configured neighbors. Each session is
formed using the peer's transport address, which must be present in the routing
table and continuously reachable.
```{note}
It is recommended to use the same address for both the LDP router
ID and the discovery transport address. For MPLS LDP to function in VyOS,
both parameters must be explicitly configured.
```
```{note}
LDP has no mechanism to refresh an existing session. To apply a
configuration change or a change to negotiated session capabilities, the
LDP neighbor must be reset on the local router.
```
## Configuration
```{cfgcmd} set protocols mpls interface \<interface\>
**Enable MPLS on the specified interface.**
```
Example:
```none
set protocols mpls interface eth1
```
```{cfgcmd} set protocols mpls parameters no-propagate-ttl
**Disable propagation of the IP TTL into the MPLS header at label
imposition.**
```
Example:
```none
set protocols mpls parameters no-propagate-ttl
```
```{cfgcmd} set protocols mpls parameters maximum-ttl \<1-255\>
**Configure the maximum TTL value for MPLS packets.**
This value is used when the TTL is not propagated from the IP header.
The default is 255.
```
Example:
```none
set protocols mpls parameters maximum-ttl 15
```
```{cfgcmd} set protocols mpls ldp interface \<interface\>
**Enable LDP on the specified interface.**
```
Example:
```none
set protocols mpls ldp interface eth1
```
```{cfgcmd} set protocols mpls ldp interface \<interface\> disable-establish-hello
**Disable the triggered Hello that the router sends on the specified
interface in response to receiving an LDP Hello from a peer.**
```
Example:
```none
set protocols mpls ldp interface eth0 disable-establish-hello
```
```{cfgcmd} set protocols mpls ldp router-id \<address\>
**Configure the IP address used as the LDP router ID for the local device.**
```
Example:
```none
set protocols mpls ldp router-id 192.0.2.1
```
```{cfgcmd} set protocols mpls ldp discovery transport-ipv4-address \<address\>
**Configure the IPv4 transport address for IPv4 LDP connections.**
```
Example:
```none
set protocols mpls ldp discovery transport-ipv4-address 192.0.2.1
```
```{cfgcmd} set protocols mpls ldp discovery transport-ipv6-address \<address\>
**Configure the IPv6 transport address for IPv6 LDP connections.**
```
Example:
```none
set protocols mpls ldp discovery transport-ipv6-address 2001:db8::1
```
```{cfgcmd} set protocols mpls ldp neighbor \<ipv4-address\> password \<password\>
**Configure authentication for the LDP session with the specified
neighbor.**
```
```{note}
For the session to establish successfully, both peers must be configured
with the same password.
```
Example:
```none
set protocols mpls ldp neighbor 192.0.2.2 password mysharedsecret
```
```{cfgcmd} set protocols mpls ldp neighbor \<ipv4-address\> session-holdtime \<15-65535\>
**Configure the LDP session hold time, in seconds, advertised to the
specified neighbor.**
The neighbor must be reset for this change to take effect.
```
Example:
```none
set protocols mpls ldp neighbor 192.0.2.2 session-holdtime 180
```
```{cfgcmd} set protocols mpls ldp neighbor \<ipv4-address\> ttl-security \<disable | 1-254\>
**Configure TTL security ({abbr}`GTSM (Generalized TTL Security Mechanism)`)
for the LDP session with the specified neighbor.**
Use `disable` to turn off TTL security, or set a hop-count value (1-254) to
restrict which incoming packets are accepted based on their TTL.
```
Example:
```none
set protocols mpls ldp neighbor 192.0.2.2 ttl-security 5
```
```{cfgcmd} set protocols mpls ldp discovery hello-ipv4-interval \<1-65535\>
**Configure the interval, in seconds, at which the router sends IPv4 LDP
Hello messages.**
```
Example:
```none
set protocols mpls ldp discovery hello-ipv4-interval 5
```
```{cfgcmd} set protocols mpls ldp discovery hello-ipv4-holdtime \<1-65535\>
**Configure the hold time, in seconds, advertised in IPv4 LDP Hello
messages.**
```
Example:
```none
set protocols mpls ldp discovery hello-ipv4-holdtime 15
```
```{cfgcmd} set protocols mpls ldp discovery hello-ipv6-interval \<1-65535\>
**Configure the interval, in seconds, at which the router sends IPv6 LDP
Hello messages.**
```
Example:
```none
set protocols mpls ldp discovery hello-ipv6-interval 5
```
```{cfgcmd} set protocols mpls ldp discovery hello-ipv6-holdtime \<1-65535\>
**Configure the hold time, in seconds, advertised in IPv6 LDP Hello
messages.**
```
Example:
```none
set protocols mpls ldp discovery hello-ipv6-holdtime 15
```
```{cfgcmd} set protocols mpls ldp discovery session-ipv4-holdtime \<15-65535\>
**Configure the LDP session hold time, in seconds, advertised in IPv4 LDP
Initialization messages.**
```
Example:
```none
set protocols mpls ldp discovery session-ipv4-holdtime 180
```
```{cfgcmd} set protocols mpls ldp discovery session-ipv6-holdtime \<15-65535\>
**Configure the LDP session hold time, in seconds, advertised in IPv6 LDP
Initialization messages.**
```
Example:
```none
set protocols mpls ldp discovery session-ipv6-holdtime 180
```
```{cfgcmd} set protocols mpls ldp import ipv4 import-filter filter-access-list \<1-2699\>
**Filter the IPv4 label bindings (associations between an IPv4 prefix and
an MPLS label) from LDP peers using the specified access list.**
Only label bindings whose prefix is permitted by the access list are
accepted.
```
Example:
```none
set protocols mpls ldp import ipv4 import-filter filter-access-list 10
```
```{cfgcmd} set protocols mpls ldp import ipv4 import-filter neighbor-access-list \<1-2699\>
**Filter the IPv4 label bindings (associations between an IPv4 prefix
and an MPLS label) from LDP peers using the specified access list.**
Only label bindings received from a peer whose IPv4 address is permitted
by the access list are accepted.
```
Example:
```none
set protocols mpls ldp import ipv4 import-filter neighbor-access-list 20
```
```{cfgcmd} set protocols mpls ldp import ipv6 import-filter filter-access-list6 \<1-2699\>
**Filter the IPv6 label bindings (associations between an IPv6 prefix and
an MPLS label) from LDP peers using the specified access list.**
Only label bindings whose prefix is permitted by the access list are
accepted.
```
Example:
```none
set protocols mpls ldp import ipv6 import-filter filter-access-list6 10
```
```{cfgcmd} set protocols mpls ldp import ipv6 import-filter neighbor-access-list6 \<1-2699\>
**Filter the IPv6 label bindings (associations between an IPv6 prefix
and an MPLS label) from LDP peers using the specified access list.**
Only label bindings received from a peer whose IPv6 address is permitted
by the access list are accepted.
```
Example:
```none
set protocols mpls ldp import ipv6 import-filter neighbor-access-list6 20
```
```{cfgcmd} set protocols mpls ldp export ipv4 export-filter filter-access-list \<1-2699\>
**Filter the IPv4 label bindings (associations between an IPv4 prefix and
an MPLS label) advertised to LDP peers using the specified access list.**
Only label bindings whose prefix is permitted by the access list are
advertised.
```
Example:
```none
set protocols mpls ldp export ipv4 export-filter filter-access-list 10
```
```{cfgcmd} set protocols mpls ldp export ipv4 export-filter neighbor-access-list \<1-2699\>
**Filter the IPv4 label bindings (associations between an IPv4 prefix
and an MPLS label) advertised to LDP peers using the specified access
list.**
Label bindings are advertised only to peers whose IPv4 address is
permitted by the access list.
```
Example:
```none
set protocols mpls ldp export ipv4 export-filter neighbor-access-list 20
```
```{cfgcmd} set protocols mpls ldp export ipv6 export-filter filter-access-list6 \<1-2699\>
**Filter the IPv6 label bindings (associations between an IPv6 prefix and
an MPLS label) advertised to LDP peers using the specified access list.**
Only label bindings whose prefix is permitted by the access list are
advertised.
```
Example:
```none
set protocols mpls ldp export ipv6 export-filter filter-access-list6 10
```
```{cfgcmd} set protocols mpls ldp export ipv6 export-filter neighbor-access-list6 \<1-2699\>
**Filter the IPv6 label bindings (associations between an IPv6 prefix
and an MPLS label) advertised to LDP peers using the specified access
list.**
Label bindings are advertised only to peers whose IPv6 address is
permitted by the access list.
```
Example:
```none
set protocols mpls ldp export ipv6 export-filter neighbor-access-list6 20
```
```{cfgcmd} set protocols mpls ldp export ipv4 explicit-null
**Configure the router to advertise the Explicit Null label for its
directly connected IPv4 prefixes to LDP neighbors.**
This instructs the penultimate-hop router to forward labeled packets
unchanged without removing the MPLS label.
```
Example:
```none
set protocols mpls ldp export ipv4 explicit-null
```
```{cfgcmd} set protocols mpls ldp export ipv6 explicit-null
**Configure the router to advertise the Explicit Null label for its
directly connected IPv6 prefixes to LDP neighbors.**
This instructs the penultimate-hop router to forward labeled packets
unchanged without removing the MPLS label.
```
Example:
```none
set protocols mpls ldp export ipv6 explicit-null
```
```{cfgcmd} set protocols mpls ldp allocation ipv4 access-list \<1-2699\>
**Restrict MPLS label allocation to IPv4 prefixes permitted by the
specified access list.**
By default, LDP allocates a label for every IPv4 prefix in the routing
table. A common best practice is to limit allocation to loopback
addresses.
```
Example:
```none
set protocols mpls ldp allocation ipv4 access-list 10
```
```{cfgcmd} set protocols mpls ldp allocation ipv6 access-list6 \<1-2699\>
**Restrict MPLS label allocation to IPv6 prefixes permitted by the
specified access list.**
By default, LDP allocates a label for every IPv6 prefix in the routing
table. A common best practice is to limit allocation to loopback
addresses.
```
Example:
```none
set protocols mpls ldp allocation ipv6 access-list6 10
```
```{cfgcmd} set protocols mpls ldp parameters cisco-interop-tlv
**Configure the router to negotiate the Dual-Stack capability
{abbr}`TLV (Type-Length-Value)`
([RFC 7552](https://datatracker.ietf.org/doc/html/rfc7552)) using a Cisco
non-compliant format for dual-stack LDP sessions.**
```
Example:
```none
set protocols mpls ldp parameters cisco-interop-tlv
```
```{cfgcmd} set protocols mpls ldp parameters ordered-control
**Enable LDP Ordered Label Distribution Control mode
([RFC 5036](https://datatracker.ietf.org/doc/html/rfc5036)) for the
router.**
By default, the router operates in Independent Label Distribution Control
mode.
```
Example:
```none
set protocols mpls ldp parameters ordered-control
```
```{cfgcmd} set protocols mpls ldp parameters transport-prefer-ipv4
**Configure the router to prefer an IPv4 TCP transport connection for LDP
peering when LDP is configured for dual-stack operation (both IPv4 and
IPv6 address families are enabled).**
```
Example:
```none
set protocols mpls ldp parameters transport-prefer-ipv4
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv4 enable
**Enable the router to accept targeted IPv4 LDP sessions.**
This allows the router to establish LDP adjacencies with non-directly
connected peers by responding to inbound targeted (unicast) LDP Hello
messages.
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv4 enable
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv6 enable
**Enable the router to accept targeted IPv6 LDP sessions.**
This allows the router to establish LDP adjacencies with non-directly
connected peers by responding to inbound targeted (unicast) LDP Hello
messages.
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv6 enable
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv4 address \<address\>
**Configure the router to initiate a targeted IPv4 LDP session with the
specified remote {abbr}`LSR (Label Switching Router)`.**
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv4 address 192.0.2.5
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv6 address \<address\>
**Configure the router to initiate a targeted IPv6 LDP session with the
specified remote LSR.**
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv6 address 2001:db8::5
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv4 hello-holdtime \<1-65535\>
**Configure the hold time, in seconds, advertised in targeted IPv4 LDP
Hello messages.**
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv4 hello-holdtime 45
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv4 hello-interval \<1-65535\>
**Configure the interval, in seconds, between targeted IPv4 LDP Hello
messages sent to remote LSRs.**
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv4 hello-interval 15
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv6 hello-holdtime \<1-65535\>
**Configure the hold time, in seconds, advertised in targeted IPv6 LDP
Hello messages.**
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv6 hello-holdtime 45
```
```{cfgcmd} set protocols mpls ldp targeted-neighbor ipv6 hello-interval \<1-65535\>
**Configure the interval, in seconds, between targeted IPv6 LDP Hello
messages sent to remote LSRs.**
```
Example:
```none
set protocols mpls ldp targeted-neighbor ipv6 hello-interval 15
```
## Operation
When LDP is established, you can view label assignments directly within the
`show ip route` or `show ipv6 route` outputs. To inspect LDP operational
states, use the following commands.
### Show
```{opcmd} show mpls ldp binding
Show the {abbr}`LIB (Label Information Base)`.
```
```{opcmd} show mpls ldp binding \<prefix\>
Show LDP label bindings for the specified prefix.
The `<prefix>` parameter accepts an IPv4 prefix (`x.x.x.x/x`) or IPv6
prefix (`h:h:h:h:h:h:h:h/h`).
```
```{opcmd} show mpls ldp binding detail
Show detailed LDP Label Information Base (LIB) entries.
```
```{opcmd} show mpls ldp binding neighbor \<address\>
Show LDP label bindings learned from the specified peer.
The `<address>` parameter accepts an IPv4 or IPv6 address.
```
```{opcmd} show mpls ldp binding local-label \<label\>
Show LDP label bindings associated with the specified locally
assigned label value.
```
```{opcmd} show mpls ldp binding remote-label \<label\>
Show LDP label bindings associated with the specified remotely
assigned label value.
```
```{opcmd} show mpls ldp discovery
Show LDP discovery Hello information.
```
```{opcmd} show mpls ldp discovery detail
Show detailed LDP discovery Hello information.
```
```{opcmd} show mpls ldp interface
Show LDP interface information.
```
```{opcmd} show mpls ldp neighbor
Show basic LDP neighbor information.
```
```{opcmd} show mpls ldp neighbor detail
Show detailed LDP neighbor information.
```
```{opcmd} show mpls ldp neighbor capabilities
Show the LDP capabilities negotiated with each peer during session
initialization.
```
```{opcmd} show mpls ldp neighbor \<address\>
Show LDP neighbor information for the specified peer.
The `<address>` parameter accepts an IPv4 or IPv6 address.
```
```{opcmd} show mpls ldp neighbor \<address\> detail
Show detailed LDP session information for the specified peer.
```
```{opcmd} show mpls ldp neighbor \<address\> capabilities
Show the LDP capabilities negotiated with the specified peer.
```
```{opcmd} show mpls table
Show the MPLS table.
```
```{opcmd} show mpls pseudowire
Show MPLS pseudowire interfaces.
```
### Reset
```{opcmd} reset mpls ldp neighbor \<address\>
Reset the established LDP session with the specified neighbor.
The `<address>` parameter accepts an IPv4 or IPv6 address.
```
## Example
The following configuration sets up a basic MPLS LDP-enabled router.
OSPF is used as the underlying IGP to provide reachability between LDP
peers' loopback addresses, which are then used as the LDP transport
addresses and router IDs. MPLS forwarding and LDP are enabled on the
interface connecting to the network.
```none
set protocols ospf area 0 network '192.0.2.1/32'
set protocols ospf area 0 network '192.0.2.4/31'
set protocols ospf parameters router-id '192.0.2.1'
set protocols mpls interface 'eth1'
set protocols mpls ldp discovery transport-ipv4-address '192.0.2.1'
set protocols mpls ldp interface 'eth1'
set protocols mpls ldp interface 'lo'
set protocols mpls ldp router-id '192.0.2.1'
set interfaces ethernet eth1 address '192.0.2.5/31'
set interfaces loopback lo address '192.0.2.1/32'
```
```{note}
This example assumes a transit (P-router) role: MPLS forwarding is
enabled on the transit interface only, not on the loopback. If the
router needs to terminate MPLS-encapsulated traffic on its loopback
(PE-router role), also configure `set protocols mpls interface 'lo'`.
```
Apply the same configuration on the LDP peer (using its own loopback and
transit interface addresses) to establish a basic LDP session.
|