Blame man/man8/tc-vlan.8

Packit d3f73b
.TH "VLAN manipulation action in tc" 8 "12 Jan 2015" "iproute2" "Linux"
Packit d3f73b
Packit d3f73b
.SH NAME
Packit d3f73b
vlan - vlan manipulation module
Packit d3f73b
.SH SYNOPSIS
Packit d3f73b
.in +8
Packit d3f73b
.ti -8
Packit d3f73b
.BR tc " ... " "action vlan" " { " pop " |"
Packit d3f73b
.IR PUSH " | " MODIFY " } [ " CONTROL " ]"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR PUSH " := "
Packit d3f73b
.BR push " [ " protocol
Packit d3f73b
.IR VLANPROTO " ]"
Packit d3f73b
.BR " [ " priority
Packit d3f73b
.IR VLANPRIO " ] "
Packit d3f73b
.BI id " VLANID"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR MODIFY " := "
Packit d3f73b
.BR modify " [ " protocol
Packit d3f73b
.IR VLANPROTO " ]"
Packit d3f73b
.BR " [ " priority
Packit d3f73b
.IR VLANPRIO " ] "
Packit d3f73b
.BI id " VLANID"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR CONTROL " := { "
Packit d3f73b
.BR reclassify " | " pipe " | " drop " | " continue " | " pass " | " goto " " chain " " CHAIN_INDEX " }"
Packit d3f73b
.SH DESCRIPTION
Packit d3f73b
The
Packit d3f73b
.B vlan
Packit d3f73b
action allows to perform 802.1Q en- or decapsulation on a packet, reflected by
Packit d3f73b
the operation modes
Packit d3f73b
.IR POP ", " PUSH " and " MODIFY .
Packit d3f73b
The
Packit d3f73b
.I POP
Packit d3f73b
mode is simple, as no further information is required to just drop the
Packit d3f73b
outer-most VLAN encapsulation. The
Packit d3f73b
.IR PUSH " and " MODIFY
Packit d3f73b
modes require at least a
Packit d3f73b
.I VLANID
Packit d3f73b
and allow to optionally choose the
Packit d3f73b
.I VLANPROTO
Packit d3f73b
to use.
Packit d3f73b
.SH OPTIONS
Packit d3f73b
.TP
Packit d3f73b
.B pop
Packit d3f73b
Decapsulation mode, no further arguments allowed.
Packit d3f73b
.TP
Packit d3f73b
.B push
Packit d3f73b
Encapsulation mode. Requires at least
Packit d3f73b
.B id
Packit d3f73b
option.
Packit d3f73b
.TP
Packit d3f73b
.B modify
Packit d3f73b
Replace mode. Existing 802.1Q tag is replaced. Requires at least
Packit d3f73b
.B id
Packit d3f73b
option.
Packit d3f73b
.TP
Packit d3f73b
.BI id " VLANID"
Packit d3f73b
Specify the VLAN ID to encapsulate into.
Packit d3f73b
.I VLANID
Packit d3f73b
is an unsigned 16bit integer, the format is detected automatically (e.g. prefix
Packit d3f73b
with
Packit d3f73b
.RB ' 0x '
Packit d3f73b
for hexadecimal interpretation, etc.).
Packit d3f73b
.TP
Packit d3f73b
.BI protocol " VLANPROTO"
Packit d3f73b
Choose the VLAN protocol to use. At the time of writing, the kernel accepts only
Packit d3f73b
.BR 802.1Q " or " 802.1ad .
Packit d3f73b
.TP
Packit d3f73b
.BI priority " VLANPRIO"
Packit d3f73b
Choose the VLAN priority to use. Decimal number in range of 0-7.
Packit d3f73b
.TP
Packit d3f73b
.I CONTROL
Packit d3f73b
How to continue after executing this action.
Packit d3f73b
.RS
Packit d3f73b
.TP
Packit d3f73b
.B reclassify
Packit d3f73b
Restarts classification by jumping back to the first filter attached to this
Packit d3f73b
action's parent.
Packit d3f73b
.TP
Packit d3f73b
.B pipe
Packit d3f73b
Continue with the next action, this is the default.
Packit d3f73b
.TP
Packit d3f73b
.B drop
Packit d3f73b
Packet will be dropped without running further actions.
Packit d3f73b
.TP
Packit d3f73b
.B continue
Packit d3f73b
Continue classification with next filter in line.
Packit d3f73b
.TP
Packit d3f73b
.B pass
Packit d3f73b
Return to calling qdisc for packet processing. This ends the classification
Packit d3f73b
process.
Packit d3f73b
.RE
Packit d3f73b
.SH EXAMPLES
Packit d3f73b
The following example encapsulates incoming ICMP packets on eth0 from 10.0.0.2
Packit d3f73b
into VLAN ID 123:
Packit d3f73b
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
#tc qdisc add dev eth0 handle ffff: ingress
Packit d3f73b
#tc filter add dev eth0 parent ffff: pref 11 protocol ip \\
Packit d3f73b
	u32 match ip protocol 1 0xff flowid 1:1 \\
Packit d3f73b
	    match ip src 10.0.0.2 flowid 1:1 \\
Packit d3f73b
	action vlan push id 123
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
Here is an example of the
Packit d3f73b
.B pop
Packit d3f73b
function: Incoming VLAN packets on eth0 are decapsulated and the classification
Packit d3f73b
process then restarted for the plain packet:
Packit d3f73b
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
#tc qdisc add dev eth0 handle ffff: ingress
Packit d3f73b
#tc filter add dev $ETH parent ffff: pref 1 protocol 802.1Q \\
Packit d3f73b
	u32 match u32 0 0 flowid 1:1 \\
Packit d3f73b
	action vlan pop reclassify
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
.SH SEE ALSO
Packit d3f73b
.BR tc (8)