blob: 5fee7d0cd7f2788470b31afe44445993c6c3948c [file] [log] [blame]
jdenisco0923a232018-08-29 13:19:43 -04001.. _mplsfib:
2
3MPLS FIB
4----------
5
6There is a tight coupling between IP and MPLS forwarding. MPLS forwarding
7equivalence classes (FECs) are often an IP prefix Рthat is to say that traffic
8matching a given IP prefix is routed into a MPLS label switch path (LSP). It is
9thus necessary to be able to associated a given prefix/route with an [out-going]
10MPLS label that will be imposed when the packet is forwarded. This is configured
11as:
12
13.. code-block:: console
14
15 $ ip route add 1.1.1.1/32 via 10.10.10.10 GigabitEthernet0/8/0 out-label 33
16
17packets matching 1.1.1.1/32 will be forwarded out GigabitEthernet0/8/0 and have MPLS label
1833 imposed. More than one out-going label can be specified. Out-going MPLS labels
19can be applied to recursive and non-recursive routes, e.g;
20
21.. code-block:: console
22
23 $ ip route add 2.2.2.0/24 via 1.1.1.1 out-label 34
24
25packets matching 2.2.2.0/24 will thus have two MPLS labels imposed; 34 and 33.
26This is the realisation of, e,g, an MPLS BGP VPNv4.
27
28To associate/allocate a local-label for a prefix, and thus have packets to that
29local-label forwarded equivalently to the prefix do;
30
31.. code-block:: console
32
33 $ mpls local-label 99 2.2.2.0/24
34
35In the API this action is called a *bind*.
36
37The router receiving the MPLS encapsulated packets needs to be programmed with
38actions associated which each label value Рthis is the role of the MPLS FIB.
39The MPLS FIB Is a table, whose key is the MPLS label value and end-of-stack (EOS)
40bit, which stores the action to perform on packets with matching encapsulation.
41
42Currently supported actions are:
43
44#. Pop the label and perform an IPv[46] lookup in a specified table
45#. Pop the label and forward via a specified next-hop (this is penultimate-hop-pop, PHP)
46#. Swap the label and forward via a specified next-hop.
47
48These can be programmed respectively by:
49
50#. mpls local-label 33 ip4-lookup-in-table X
51#. mpls local-label 33 via 10.10.10.10 GigabitEthernet0/8/0
52#. mpls local-label 33 via 10.10.10.10 GigabitEthernet0/8/0 out-label 66
53
54the latter is an example of an MPLS cross connect. Any description of a next-hop,
55recursive, non-recursive, labelled, non-labelled, etc, that is valid for an IP
56prefix, is also valid for an MPLS local-label.
57
58Implementation
59^^^^^^^^^^^^^^^
60
61The MPLS FIB is implemented using exactly the same data structures as the IP FIB.
62The only difference is the implementation of the table. Whereas for IPv4 this is
63an mtrie and for IPv6 a hash table, for MPLS it is a flat array indexed by a 21
64bit key (label & EOS bit). This implementation is chosen to favour packet
65forwarding speed.
66
67MPLS Tunnels
68^^^^^^^^^^^^^
69
70VPP no longer supports MPLS tunnels that are coupled to a particular transport,
71
72i.e. MPLSoGRE or MPLSoEth. Such tight coupling is not beneficial. Instead VPP supports;
73
74#. MPLS LSPs associated with IP prefixes and MPLS local-labels (as described above) which are transport independent (i.e. the IP route could be reachable over a GRE tunnel, or any other interface type).
75#. A generic uni-directional MPLS tunnel interface that is transport independent.
76
77An MPLS tunnel is effectively an LSP with an associated interface. The LSP can be
78described by any next-hop type (recursive, non-recursive etc), e.g.:
79
80mpls tunnel add via 10.10.10.10 GigabitEthernet0/8/0 out-label 66
81IP routes and/or MPLS x-connects can be routed via the interface, e.g.
82
83.. code-block:: console
84
85 $ ip route add 2.2.2.0/24 via mpls-tunnel0
86
87packets matching the route for 2.2.2.0/24 would thus have label 66 imposed since
88it is transmitted via the tunnel.
89
90These MPLS tunnels can be used to realise MPLS RSVP-TE tunnels.