# tc-mpls(8) - man - phpman

MPLS manipulation action in [tc(8)](https://www.chedong.com/phpMan.php/man/tc/8/markdown)               Linux              MPLS manipulation action in [tc(8)](https://www.chedong.com/phpMan.php/man/tc/8/markdown)



## NAME
       mpls - mpls manipulation module

## SYNOPSIS
       **tc** ... **action** **mpls** { _POP_ | _PUSH_ | _MODIFY_ | **dec**___**ttl** } [ _CONTROL_ ]

       _POP_ := **pop** **protocol** _MPLS_PROTO_

       _PUSH_  := { **push** | **mac**___**push** } [ **protocol** _MPLS_PROTO_ ]  [ **tc** _MPLS_TC_ ]  [ **ttl** _MPLS_TTL_ ]  [ **bos**
               _MPLS_BOS_ ] **label** _MPLS_LABEL_

       _MODIFY_ := **modify** [ **label** _MPLS_LABEL_ ]  [ **tc** _MPLS_TC_ ]  [ **ttl** _MPLS_TTL_ ]

       _CONTROL_ := { **reclassify** | **pipe** | **drop** | **continue** | **pass** | **goto** **chain** **CHAIN**___**INDEX** }

## DESCRIPTION
       The **mpls** action performs mpls encapsulation or decapsulation on a packet,  reflected  by  the
       operation  modes  _POP_,  _PUSH_, _MODIFY_ and _DEC_TTL_.  The _POP_ mode requires the ethertype of the
       header that follows the MPLS header (e.g.  IPv4 or another MPLS). It will  remove  the  outer
       MPLS header and replace the ethertype in the MAC header with that passed. The _PUSH_ and _MODIFY_
       modes update the current MPLS header information or add a new header.  _PUSH_ requires at least
       an _MPLS_LABEL_.  _DEC_TTL_ requires no arguments and simply subtracts 1 from the MPLS header TTL
       field.


## OPTIONS
       **pop**    Decapsulation mode. Requires the protocol of the next header.

       **push**   Encapsulation mode. Adds the MPLS header between the MAC and the network headers.  Re‐
              quires at least the **label** option.

       **mac**___**push**
              Encapsulation  mode. Adds the MPLS header before the MAC header. Requires at least the
              **label** option.

       **modify** Replace mode. Existing MPLS tag is replaced.  **label**, **tc**, and **ttl** are all optional.

       **dec**___**ttl**
              Decrement the TTL field on the outer most MPLS header.

       **label** _MPLS_LABEL_
              Specify the MPLS LABEL for the outer MPLS header.  _MPLS_LABEL_ is an unsigned 20bit in‐
              teger, the format is detected automatically (e.g. prefix with '**0x**' for hexadecimal in‐
              terpretation, etc.).

       **protocol** _MPLS_PROTO_
              Choose the protocol to use. For push actions this must be **mpls**___**uc** or **mpls**___**mc**  (**mpls**___**uc**
              is  the  default). For pop actions it should be the protocol of the next header.  This
              option cannot be used with modify.

       **tc** _MPLS_TC_
              Choose the TC value for the outer MPLS header. Decimal number in range  of  0-7.   De‐
              faults to 0.

       **ttl** _MPLS_TTL_
              Choose  the  TTL value for the outer MPLS header. Number in range of 0-255. A non-zero
              default value will be selected if this is not explicitly set.

       **bos** _MPLS_BOS_
              Manually configure the bottom of stack bit for an MPLS header push. The default is for
              TC to automatically set (or unset) the bit based on the next header of the packet.

       _CONTROL_
              How to continue after executing this action.

              **reclassify**
                     Restarts  classification  by  jumping back to the first filter attached to this
                     action's parent.

              **pipe**   Continue with the next action, this is the default.

              **drop**   Packet will be dropped without running further actions.

              **continue**
                     Continue classification with next filter in line.

              **pass**   Return to calling qdisc for packet processing.  This  ends  the  classification
                     process.

## EXAMPLES
       The following example encapsulates incoming IP packets on eth0 into MPLS with a label 123 and
       sends them out eth1:

              #tc qdisc add dev eth0 handle ffff: ingress
              #tc filter add dev eth0 protocol ip parent ffff: flower \
                   action mpls push protocol mpls_uc label 123  \
                   action mirred egress redirect dev eth1

       In this example, incoming MPLS unicast packets on eth0 are  decapsulated  and  redirected  to
       eth1:

              #tc qdisc add dev eth0 handle ffff: ingress
              #tc filter add dev eth0 protocol mpls_uc parent ffff: flower \
                   action mpls pop protocol ipv4  \
                   action mirred egress redirect dev eth1

       Here is another example, where incoming Ethernet frames are encapsulated into MPLS with label
       123 and TTL 64. Then, an outer Ethernet header is added and the resulting  frame  is  finally
       sent on eth1:

              #tc qdisc add dev eth0 ingress
              #tc filter add dev eth0 ingress matchall \
                   action mpls mac_push label 123 ttl 64 \
                   action vlan push_eth \
                        dst_mac 02:00:00:00:00:02 \
                        src_mac 02:00:00:00:00:01 \
                   action mirred egress redirect dev eth1

       The  following  example  assumes that incoming MPLS packets with label 123 transport Ethernet
       frames. The outer Ethernet and the MPLS headers are stripped, then the inner  Ethernet  frame
       is sent on eth1:

              #tc qdisc add dev eth0 ingress
              #tc filter add dev eth0 ingress protocol mpls_uc \
                   flower mpls_label 123 mpls_bos 1 \
                   action vlan pop_eth \
                   action mpls pop protocol teb \
                   action mirred egress redirect dev eth1


## SEE ALSO
       [**tc**(8)](https://www.chedong.com/phpMan.php/man/tc/8/markdown), [**tc-mirred**(8)](https://www.chedong.com/phpMan.php/man/tc-mirred/8/markdown), [**tc-vlan**(8)](https://www.chedong.com/phpMan.php/man/tc-vlan/8/markdown)



iproute2                                     22 May 2019           MPLS manipulation action in [tc(8)](https://www.chedong.com/phpMan.php/man/tc/8/markdown)
