man-pages/man8/tc-mpls.8.html
2021-03-31 01:06:50 +01:00

263 lines
5.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of MPLS manipulation action in tc</TITLE>
</HEAD><BODY>
<H1>MPLS manipulation action in tc</H1>
Section: Linux (8)<BR>Updated: 22 May 2019<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<P>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
mpls - mpls manipulation module
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<BR>
<B>tc</B> ... <B>action mpls</B> {
<I>POP</I> | <I>PUSH</I> | <I>MODIFY</I> |
<B>dec_ttl</B> } [
<I>CONTROL</I> ]
<P>
<BR>
<I>POP</I> :=
<B>pop</B> <B>protocol</B>
<I>MPLS_PROTO</I>
<P>
<BR>
<I>PUSH</I> :=
<B>push</B> [ <B>protocol</B>
<I>MPLS_PROTO</I> ]
[ <B>tc</B>
<I>MPLS_TC</I> ]
[ <B>ttl</B>
<I>MPLS_TTL</I> ]
[ <B>bos</B>
<I>MPLS_BOS</I> ]
<B>label</B><I> MPLS_LABEL</I>
<P>
<BR>
<I>MODIFY</I> :=
<B>modify</B> [ <B>label</B>
<I>MPLS_LABEL</I> ]
[ <B>tc</B>
<I>MPLS_TC</I> ]
[ <B>ttl</B>
<I>MPLS_TTL</I> ]
<P>
<BR>
<I>CONTROL</I> := {
<B>reclassify</B> | <B>pipe</B> | <B>drop</B> | <B>continue</B> | <B>pass</B> | <B>goto</B> <B>chain</B> <B>CHAIN_INDEX</B> }
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<B>mpls</B>
action performs mpls encapsulation or decapsulation on a packet, reflected by the
operation modes
<I>POP</I>, <I>PUSH</I>, <I>MODIFY</I> and <I>DEC_TTL</I>.
The
<I>POP</I>
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
<I>PUSH</I> and <I>MODIFY</I>
modes update the current MPLS header information or add a new header.
<I>PUSH</I>
requires at least an
<I>MPLS_LABEL</I>.
<I>DEC_TTL</I>
requires no arguments and simply subtracts 1 from the MPLS header TTL field.
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>pop</B>
<DD>
Decapsulation mode. Requires the protocol of the next header.
<DT id="2"><B>push</B>
<DD>
Encapsulation mode. Requires at least the
<B>label</B>
option.
<DT id="3"><B>modify</B>
<DD>
Replace mode. Existing MPLS tag is replaced.
<B>label</B>,
<B>tc</B>,
and
<B>ttl</B>
are all optional.
<DT id="4"><B>dec_ttl</B>
<DD>
Decrement the TTL field on the outer most MPLS header.
<DT id="5"><B>label</B><I> MPLS_LABEL</I>
<DD>
Specify the MPLS LABEL for the outer MPLS header.
<I>MPLS_LABEL</I>
is an unsigned 20bit integer, the format is detected automatically (e.g. prefix
with
'<B>0x</B>'
for hexadecimal interpretation, etc.).
<DT id="6"><B>protocol</B><I> MPLS_PROTO</I>
<DD>
Choose the protocol to use. For push actions this must be
<B>mpls_uc</B> or <B>mpls_mc</B> (<B>mpls_uc</B>
is the default). For pop actions it should be the protocol of the next header.
This option cannot be used with modify.
<DT id="7"><B>tc</B><I> MPLS_TC</I>
<DD>
Choose the TC value for the outer MPLS header. Decimal number in range of 0-7.
Defaults to 0.
<DT id="8"><B>ttl</B><I> MPLS_TTL</I>
<DD>
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.
<DT id="9"><B>bos</B><I> MPLS_BOS</I>
<DD>
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.
<DT id="10"><I>CONTROL</I>
<DD>
How to continue after executing this action.
<DL COMPACT><DT id="11"><DD>
<DL COMPACT>
<DT id="12"><B>reclassify</B>
<DD>
Restarts classification by jumping back to the first filter attached to this
action's parent.
<DT id="13"><B>pipe</B>
<DD>
Continue with the next action, this is the default.
<DT id="14"><B>drop</B>
<DD>
Packet will be dropped without running further actions.
<DT id="15"><B>continue</B>
<DD>
Continue classification with next filter in line.
<DT id="16"><B>pass</B>
<DD>
Return to calling qdisc for packet processing. This ends the classification
process.
</DL>
</DL>
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLES</H2>
The following example encapsulates incoming IP packets on eth0 into MPLS with
a label 123 and sends them out eth1:
<P>
<DL COMPACT><DT id="17"><DD>
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev eth0 protocol ip parent ffff: flower \
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>action mpls push protocol mpls_uc label 123 \<BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>action mirred egress redirect dev eth1<BR>
</DL>
<P>
In this example, incoming MPLS unicast packets on eth0 are decapsulated and to
ip packets and output to eth1:
<P>
<DL COMPACT><DT id="18"><DD>
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev eth0 protocol mpls_uc parent ffff: flower \
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>action mpls pop protocol ipv4 \<BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>action mirred egress redirect dev eth0<BR>
</DL>
<P>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?8+tc">tc</A></B>(8)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="19"><A HREF="#lbAB">NAME</A><DD>
<DT id="20"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="21"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="22"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="23"><A HREF="#lbAF">EXAMPLES</A><DD>
<DT id="24"><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:17 GMT, March 31, 2021
</BODY>
</HTML>