jdenisco | 0923a23 | 2018-08-29 13:19:43 -0400 | [diff] [blame] | 1 | .. _mplsfib: |
| 2 | |
| 3 | MPLS FIB |
| 4 | ---------- |
| 5 | |
| 6 | There is a tight coupling between IP and MPLS forwarding. MPLS forwarding |
| 7 | equivalence classes (FECs) are often an IP prefix Рthat is to say that traffic |
| 8 | matching a given IP prefix is routed into a MPLS label switch path (LSP). It is |
| 9 | thus necessary to be able to associated a given prefix/route with an [out-going] |
| 10 | MPLS label that will be imposed when the packet is forwarded. This is configured |
| 11 | as: |
| 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 | |
| 17 | packets matching 1.1.1.1/32 will be forwarded out GigabitEthernet0/8/0 and have MPLS label |
| 18 | 33 imposed. More than one out-going label can be specified. Out-going MPLS labels |
| 19 | can 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 | |
| 25 | packets matching 2.2.2.0/24 will thus have two MPLS labels imposed; 34 and 33. |
| 26 | This is the realisation of, e,g, an MPLS BGP VPNv4. |
| 27 | |
| 28 | To associate/allocate a local-label for a prefix, and thus have packets to that |
| 29 | local-label forwarded equivalently to the prefix do; |
| 30 | |
| 31 | .. code-block:: console |
| 32 | |
| 33 | $ mpls local-label 99 2.2.2.0/24 |
| 34 | |
| 35 | In the API this action is called a *bind*. |
| 36 | |
| 37 | The router receiving the MPLS encapsulated packets needs to be programmed with |
| 38 | actions associated which each label value Рthis is the role of the MPLS FIB. |
| 39 | The MPLS FIB Is a table, whose key is the MPLS label value and end-of-stack (EOS) |
| 40 | bit, which stores the action to perform on packets with matching encapsulation. |
| 41 | |
| 42 | Currently 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 | |
| 48 | These 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 | |
| 54 | the latter is an example of an MPLS cross connect. Any description of a next-hop, |
| 55 | recursive, non-recursive, labelled, non-labelled, etc, that is valid for an IP |
| 56 | prefix, is also valid for an MPLS local-label. |
| 57 | |
| 58 | Implementation |
| 59 | ^^^^^^^^^^^^^^^ |
| 60 | |
| 61 | The MPLS FIB is implemented using exactly the same data structures as the IP FIB. |
| 62 | The only difference is the implementation of the table. Whereas for IPv4 this is |
| 63 | an mtrie and for IPv6 a hash table, for MPLS it is a flat array indexed by a 21 |
| 64 | bit key (label & EOS bit). This implementation is chosen to favour packet |
| 65 | forwarding speed. |
| 66 | |
| 67 | MPLS Tunnels |
| 68 | ^^^^^^^^^^^^^ |
| 69 | |
| 70 | VPP no longer supports MPLS tunnels that are coupled to a particular transport, |
| 71 | |
| 72 | i.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 | |
| 77 | An MPLS tunnel is effectively an LSP with an associated interface. The LSP can be |
| 78 | described by any next-hop type (recursive, non-recursive etc), e.g.: |
| 79 | |
| 80 | mpls tunnel add via 10.10.10.10 GigabitEthernet0/8/0 out-label 66 |
| 81 | IP 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 | |
| 87 | packets matching the route for 2.2.2.0/24 would thus have label 66 imposed since |
| 88 | it is transmitted via the tunnel. |
| 89 | |
| 90 | These MPLS tunnels can be used to realise MPLS RSVP-TE tunnels. |