1VLAN manipulation action in tc(8) Linux VLAN manipulation action in tc(8)
2
3
4
6 vlan - vlan manipulation module
7
9 tc ... action vlan { pop | PUSH | MODIFY } [ CONTROL ]
10
11 PUSH := push [ protocol VLANPROTO ] [ priority VLANPRIO ] id VLANID
12
13 MODIFY := modify [ protocol VLANPROTO ] [ priority VLANPRIO ] id
14 VLANID
15
16 CONTROL := { reclassify | pipe | drop | continue | pass | goto chain
17 CHAIN_INDEX }
18
20 The vlan action allows to perform 802.1Q en- or decapsulation on a
21 packet, reflected by the operation modes POP, PUSH and MODIFY. The POP
22 mode is simple, as no further information is required to just drop the
23 outer-most VLAN encapsulation. The PUSH and MODIFY modes require at
24 least a VLANID and allow to optionally choose the VLANPROTO to use.
25
27 pop Decapsulation mode, no further arguments allowed.
28
29 push Encapsulation mode. Requires at least id option.
30
31 modify Replace mode. Existing 802.1Q tag is replaced. Requires at least
32 id option.
33
34 id VLANID
35 Specify the VLAN ID to encapsulate into. VLANID is an unsigned
36 16bit integer, the format is detected automatically (e.g. prefix
37 with '0x' for hexadecimal interpretation, etc.).
38
39 protocol VLANPROTO
40 Choose the VLAN protocol to use. At the time of writing, the
41 kernel accepts only 802.1Q or 802.1ad.
42
43 priority VLANPRIO
44 Choose the VLAN priority to use. Decimal number in range of 0-7.
45
46 CONTROL
47 How to continue after executing this action.
48
49 reclassify
50 Restarts classification by jumping back to the first fil‐
51 ter attached to this action's parent.
52
53 pipe Continue with the next action, this is the default.
54
55 drop Packet will be dropped without running further actions.
56
57 continue
58 Continue classification with next filter in line.
59
60 pass Return to calling qdisc for packet processing. This ends
61 the classification process.
62
64 The following example encapsulates incoming ICMP packets on eth0 from
65 10.0.0.2 into VLAN ID 123:
66
67 #tc qdisc add dev eth0 handle ffff: ingress
68 #tc filter add dev eth0 parent ffff: pref 11 protocol ip \
69 u32 match ip protocol 1 0xff flowid 1:1 \
70 match ip src 10.0.0.2 flowid 1:1 \
71 action vlan push id 123
72
73 Here is an example of the pop function: Incoming VLAN packets on eth0
74 are decapsulated and the classification process then restarted for the
75 plain packet:
76
77 #tc qdisc add dev eth0 handle ffff: ingress
78 #tc filter add dev $ETH parent ffff: pref 1 protocol 802.1Q \
79 u32 match u32 0 0 flowid 1:1 \
80 action vlan pop reclassify
81
82
84 tc(8)
85
86
87
88iproute2 12 Jan 2015VLAN manipulation action in tc(8)