{
    "content": [
        {
            "type": "text",
            "text": "# tc-mpls(8) (man)\n\n**Summary:** mpls - mpls manipulation module\n\n**Synopsis:** tc ... action mpls { POP | PUSH | MODIFY | decttl } [ CONTROL ]\nPOP := pop protocol MPLSPROTO\nPUSH  := { push | macpush } [ protocol MPLSPROTO ]  [ tc MPLSTC ]  [ ttl MPLSTTL ]  [ bos\nMPLSBOS ] label MPLSLABEL\nMODIFY := modify [ label MPLSLABEL ]  [ tc MPLSTC ]  [ ttl MPLSTTL ]\nCONTROL := { reclassify | pipe | drop | continue | pass | goto chain CHAININDEX }\n\n## Examples\n\n- `The following example encapsulates incoming IP packets on eth0 into MPLS with a label 123 and`\n- `sends them out eth1:`\n- `#tc qdisc add dev eth0 handle ffff: ingress`\n- `#tc filter add dev eth0 protocol ip parent ffff: flower \\`\n- `action mpls push protocol mplsuc label 123  \\`\n- `action mirred egress redirect dev eth1`\n- `In this example, incoming MPLS unicast packets on eth0 are  decapsulated  and  redirected  to`\n- `eth1:`\n- `#tc qdisc add dev eth0 handle ffff: ingress`\n- `#tc filter add dev eth0 protocol mplsuc parent ffff: flower \\`\n- `action mpls pop protocol ipv4  \\`\n- `action mirred egress redirect dev eth1`\n- `Here is another example, where incoming Ethernet frames are encapsulated into MPLS with label`\n- `123 and TTL 64. Then, an outer Ethernet header is added and the resulting  frame  is  finally`\n- `sent on eth1:`\n- `#tc qdisc add dev eth0 ingress`\n- `#tc filter add dev eth0 ingress matchall \\`\n- `action mpls macpush label 123 ttl 64 \\`\n- `action vlan pusheth \\`\n- `dstmac 02:00:00:00:00:02 \\`\n- `srcmac 02:00:00:00:00:01 \\`\n- `action mirred egress redirect dev eth1`\n- `The  following  example  assumes that incoming MPLS packets with label 123 transport Ethernet`\n- `frames. The outer Ethernet and the MPLS headers are stripped, then the inner  Ethernet  frame`\n- `is sent on eth1:`\n- `#tc qdisc add dev eth0 ingress`\n- `#tc filter add dev eth0 ingress protocol mplsuc \\`\n- `flower mplslabel 123 mplsbos 1 \\`\n- `action vlan popeth \\`\n- `action mpls pop protocol teb \\`\n- `action mirred egress redirect dev eth1`\n\n## See Also\n\n- tc(8)\n- tc-mirred(8)\n- tc-vlan(8)\n- tc(8)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (11 lines)\n- **DESCRIPTION** (9 lines)\n- **OPTIONS** (53 lines)\n- **EXAMPLES** (40 lines)\n- **SEE ALSO** (5 lines)\n\n## Full Content\n\n### NAME\n\nmpls - mpls manipulation module\n\n### SYNOPSIS\n\ntc ... action mpls { POP | PUSH | MODIFY | decttl } [ CONTROL ]\n\nPOP := pop protocol MPLSPROTO\n\nPUSH  := { push | macpush } [ protocol MPLSPROTO ]  [ tc MPLSTC ]  [ ttl MPLSTTL ]  [ bos\nMPLSBOS ] label MPLSLABEL\n\nMODIFY := modify [ label MPLSLABEL ]  [ tc MPLSTC ]  [ ttl MPLSTTL ]\n\nCONTROL := { reclassify | pipe | drop | continue | pass | goto chain CHAININDEX }\n\n### DESCRIPTION\n\nThe mpls action performs mpls encapsulation or decapsulation on a packet,  reflected  by  the\noperation  modes  POP,  PUSH, MODIFY and DECTTL.  The POP mode requires the ethertype of the\nheader that follows the MPLS header (e.g.  IPv4 or another MPLS). It will  remove  the  outer\nMPLS header and replace the ethertype in the MAC header with that passed. The PUSH and MODIFY\nmodes update the current MPLS header information or add a new header.  PUSH requires at least\nan MPLSLABEL.  DECTTL requires no arguments and simply subtracts 1 from the MPLS header TTL\nfield.\n\n### OPTIONS\n\npop    Decapsulation mode. Requires the protocol of the next header.\n\npush   Encapsulation mode. Adds the MPLS header between the MAC and the network headers.  Re‐\nquires at least the label option.\n\nmacpush\nEncapsulation  mode. Adds the MPLS header before the MAC header. Requires at least the\nlabel option.\n\nmodify Replace mode. Existing MPLS tag is replaced.  label, tc, and ttl are all optional.\n\ndecttl\nDecrement the TTL field on the outer most MPLS header.\n\nlabel MPLSLABEL\nSpecify the MPLS LABEL for the outer MPLS header.  MPLSLABEL is an unsigned 20bit in‐\nteger, the format is detected automatically (e.g. prefix with '0x' for hexadecimal in‐\nterpretation, etc.).\n\nprotocol MPLSPROTO\nChoose the protocol to use. For push actions this must be mplsuc or mplsmc  (mplsuc\nis  the  default). For pop actions it should be the protocol of the next header.  This\noption cannot be used with modify.\n\ntc MPLSTC\nChoose the TC value for the outer MPLS header. Decimal number in range  of  0-7.   De‐\nfaults to 0.\n\nttl MPLSTTL\nChoose  the  TTL value for the outer MPLS header. Number in range of 0-255. A non-zero\ndefault value will be selected if this is not explicitly set.\n\nbos MPLSBOS\nManually configure the bottom of stack bit for an MPLS header push. The default is for\nTC to automatically set (or unset) the bit based on the next header of the packet.\n\nCONTROL\nHow to continue after executing this action.\n\nreclassify\nRestarts  classification  by  jumping back to the first filter attached to this\naction's parent.\n\npipe   Continue with the next action, this is the default.\n\ndrop   Packet will be dropped without running further actions.\n\ncontinue\nContinue classification with next filter in line.\n\npass   Return to calling qdisc for packet processing.  This  ends  the  classification\nprocess.\n\n### EXAMPLES\n\nThe following example encapsulates incoming IP packets on eth0 into MPLS with a label 123 and\nsends them out eth1:\n\n#tc qdisc add dev eth0 handle ffff: ingress\n#tc filter add dev eth0 protocol ip parent ffff: flower \\\naction mpls push protocol mplsuc label 123  \\\naction mirred egress redirect dev eth1\n\nIn this example, incoming MPLS unicast packets on eth0 are  decapsulated  and  redirected  to\neth1:\n\n#tc qdisc add dev eth0 handle ffff: ingress\n#tc filter add dev eth0 protocol mplsuc parent ffff: flower \\\naction mpls pop protocol ipv4  \\\naction mirred egress redirect dev eth1\n\nHere is another example, where incoming Ethernet frames are encapsulated into MPLS with label\n123 and TTL 64. Then, an outer Ethernet header is added and the resulting  frame  is  finally\nsent on eth1:\n\n#tc qdisc add dev eth0 ingress\n#tc filter add dev eth0 ingress matchall \\\naction mpls macpush label 123 ttl 64 \\\naction vlan pusheth \\\ndstmac 02:00:00:00:00:02 \\\nsrcmac 02:00:00:00:00:01 \\\naction mirred egress redirect dev eth1\n\nThe  following  example  assumes that incoming MPLS packets with label 123 transport Ethernet\nframes. The outer Ethernet and the MPLS headers are stripped, then the inner  Ethernet  frame\nis sent on eth1:\n\n#tc qdisc add dev eth0 ingress\n#tc filter add dev eth0 ingress protocol mplsuc \\\nflower mplslabel 123 mplsbos 1 \\\naction vlan popeth \\\naction mpls pop protocol teb \\\naction mirred egress redirect dev eth1\n\n### SEE ALSO\n\ntc(8), tc-mirred(8), tc-vlan(8)\n\n\n\niproute2                                     22 May 2019           MPLS manipulation action in tc(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "tc-mpls",
        "section": "8",
        "mode": "man",
        "summary": "mpls - mpls manipulation module",
        "synopsis": "tc ... action mpls { POP | PUSH | MODIFY | decttl } [ CONTROL ]\nPOP := pop protocol MPLSPROTO\nPUSH  := { push | macpush } [ protocol MPLSPROTO ]  [ tc MPLSTC ]  [ ttl MPLSTTL ]  [ bos\nMPLSBOS ] label MPLSLABEL\nMODIFY := modify [ label MPLSLABEL ]  [ tc MPLSTC ]  [ ttl MPLSTTL ]\nCONTROL := { reclassify | pipe | drop | continue | pass | goto chain CHAININDEX }",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "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 mplsuc 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 mplsuc 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 macpush label 123 ttl 64 \\",
            "action vlan pusheth \\",
            "dstmac 02:00:00:00:00:02 \\",
            "srcmac 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 mplsuc \\",
            "flower mplslabel 123 mplsbos 1 \\",
            "action vlan popeth \\",
            "action mpls pop protocol teb \\",
            "action mirred egress redirect dev eth1"
        ],
        "see_also": [
            {
                "name": "tc",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
            },
            {
                "name": "tc-mirred",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-mirred/8/json"
            },
            {
                "name": "tc-vlan",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-vlan/8/json"
            },
            {
                "name": "tc",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 53,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 40,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}