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

217 lines
4.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of VLAN manipulation action in tc</TITLE>
</HEAD><BODY>
<H1>VLAN manipulation action in tc</H1>
Section: Linux (8)<BR>Updated: 12 Jan 2015<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>
vlan - vlan manipulation module
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<BR>
<B>tc</B> ... <B>action vlan</B> { <B>pop</B> |
<I>PUSH</I> | <I>MODIFY</I> } [ <I>CONTROL</I> ]
<P>
<BR>
<I>PUSH</I> :=
<B>push</B> [ <B>protocol</B>
<I>VLANPROTO</I> ]
<B> [ </B>priority
<I>VLANPRIO</I> ]
<B>id</B><I> VLANID</I>
<P>
<BR>
<I>MODIFY</I> :=
<B>modify</B> [ <B>protocol</B>
<I>VLANPROTO</I> ]
<B> [ </B>priority
<I>VLANPRIO</I> ]
<B>id</B><I> VLANID</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>vlan</B>
action allows to perform 802.1Q en- or decapsulation on a packet, reflected by
the operation modes
<I>POP</I>, <I>PUSH</I> and <I>MODIFY</I>.
The
<I>POP</I>
mode is simple, as no further information is required to just drop the
outer-most VLAN encapsulation. The
<I>PUSH</I> and <I>MODIFY</I>
modes require at least a
<I>VLANID</I>
and allow to optionally choose the
<I>VLANPROTO</I>
to use.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="1"><B>pop</B>
<DD>
Decapsulation mode, no further arguments allowed.
<DT id="2"><B>push</B>
<DD>
Encapsulation mode. Requires at least
<B>id</B>
option.
<DT id="3"><B>modify</B>
<DD>
Replace mode. Existing 802.1Q tag is replaced. Requires at least
<B>id</B>
option.
<DT id="4"><B>id</B><I> VLANID</I>
<DD>
Specify the VLAN ID to encapsulate into.
<I>VLANID</I>
is an unsigned 16bit integer, the format is detected automatically (e.g. prefix
with
'<B>0x</B>'
for hexadecimal interpretation, etc.).
<DT id="5"><B>protocol</B><I> VLANPROTO</I>
<DD>
Choose the VLAN protocol to use. At the time of writing, the kernel accepts only
<B>802.1Q</B> or <B>802.1ad</B>.
<DT id="6"><B>priority</B><I> VLANPRIO</I>
<DD>
Choose the VLAN priority to use. Decimal number in range of 0-7.
<DT id="7"><I>CONTROL</I>
<DD>
How to continue after executing this action.
<DL COMPACT><DT id="8"><DD>
<DL COMPACT>
<DT id="9"><B>reclassify</B>
<DD>
Restarts classification by jumping back to the first filter attached to this
action's parent.
<DT id="10"><B>pipe</B>
<DD>
Continue with the next action, this is the default.
<DT id="11"><B>drop</B>
<DD>
Packet will be dropped without running further actions.
<DT id="12"><B>continue</B>
<DD>
Continue classification with next filter in line.
<DT id="13"><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 ICMP packets on eth0 from 10.0.0.2
into VLAN ID 123:
<P>
<DL COMPACT><DT id="14"><DD>
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev eth0 parent ffff: pref 11 protocol ip \
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>u32 match ip protocol 1 0xff flowid 1:1 \<BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT> match ip src 10.0.0.2 flowid 1:1 \<BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>action vlan push id 123<BR>
</DL>
<P>
Here is an example of the
<B>pop</B>
function: Incoming VLAN packets on eth0 are decapsulated and the classification
process then restarted for the plain packet:
<P>
<DL COMPACT><DT id="15"><DD>
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev $ETH parent ffff: pref 1 protocol 802.1Q \
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>u32 match u32 0 0 flowid 1:1 \<BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>action vlan pop reclassify<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="16"><A HREF="#lbAB">NAME</A><DD>
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="19"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="20"><A HREF="#lbAF">EXAMPLES</A><DD>
<DT id="21"><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:18 GMT, March 31, 2021
</BODY>
</HTML>