Debian Codegraph @

upstream/debian-unstable/man8/tc-mpls.8

raw
1 .TH "MPLS manipulation action in tc" 8 "22 May 2019" "iproute2" "Linux"
2
3 .SH NAME
4 mpls - mpls manipulation module
5 .SH SYNOPSIS
6 .in +8
7 .ti -8
8 .BR tc " ... " "action mpls" " { "
9 .IR POP " | " PUSH " | " MODIFY " | "
10 .BR dec_ttl " } [ "
11 .IR CONTROL " ]"
12
13 .ti -8
14 .IR POP " := "
15 .BR pop " " protocol
16 .IR MPLS_PROTO
17
18 .ti -8
19 .IR PUSH " := "
20 .RB "{ " push " | " mac_push " } [ " protocol
21 .IR MPLS_PROTO " ]"
22 .RB " [ " tc
23 .IR MPLS_TC " ] "
24 .RB " [ " ttl
25 .IR MPLS_TTL " ] "
26 .RB " [ " bos
27 .IR MPLS_BOS " ] "
28 .BI label " MPLS_LABEL"
29
30 .ti -8
31 .IR MODIFY " := "
32 .BR modify " [ " label
33 .IR MPLS_LABEL " ]"
34 .RB " [ " tc
35 .IR MPLS_TC " ] "
36 .RB " [ " ttl
37 .IR MPLS_TTL " ] "
38
39 .ti -8
40 .IR CONTROL " := { "
41 .BR reclassify " | " pipe " | " drop " | " continue " | " pass " | " goto " " chain " " CHAIN_INDEX " }"
42 .SH DESCRIPTION
43 The
44 .B mpls
45 action performs mpls encapsulation or decapsulation on a packet, reflected by the
46 operation modes
47 .IR POP ", " PUSH ", " MODIFY " and " DEC_TTL .
48 The
49 .I POP
50 mode requires the ethertype of the header that follows the MPLS header (e.g.
51 IPv4 or another MPLS). It will remove the outer MPLS header and replace the
52 ethertype in the MAC header with that passed. The
53 .IR PUSH " and " MODIFY
54 modes update the current MPLS header information or add a new header.
55 .IR PUSH
56 requires at least an
57 .IR MPLS_LABEL ". "
58 .I DEC_TTL
59 requires no arguments and simply subtracts 1 from the MPLS header TTL field.
60
61 .SH OPTIONS
62 .TP
63 .B pop
64 Decapsulation mode. Requires the protocol of the next header.
65 .TP
66 .B push
67 Encapsulation mode. Adds the MPLS header between the MAC and the network
68 headers. Requires at least the
69 .B label
70 option.
71 .TP
72 .B mac_push
73 Encapsulation mode. Adds the MPLS header before the MAC header. Requires at
74 least the
75 .B label
76 option.
77 .TP
78 .B modify
79 Replace mode. Existing MPLS tag is replaced.
80 .BR label ", "
81 .BR tc ", "
82 and
83 .B ttl
84 are all optional.
85 .TP
86 .B dec_ttl
87 Decrement the TTL field on the outer most MPLS header.
88 .TP
89 .BI label " MPLS_LABEL"
90 Specify the MPLS LABEL for the outer MPLS header.
91 .I MPLS_LABEL
92 is an unsigned 20bit integer, the format is detected automatically (e.g. prefix
93 with
94 .RB ' 0x '
95 for hexadecimal interpretation, etc.).
96 .TP
97 .BI protocol " MPLS_PROTO"
98 Choose the protocol to use. For push actions this must be
99 .BR mpls_uc " or " mpls_mc " (" mpls_uc
100 is the default). For pop actions it should be the protocol of the next header.
101 This option cannot be used with modify.
102 .TP
103 .BI tc " MPLS_TC"
104 Choose the TC value for the outer MPLS header. Decimal number in range of 0-7.
105 Defaults to 0.
106 .TP
107 .BI ttl " MPLS_TTL"
108 Choose the TTL value for the outer MPLS header. Number in range of 0-255. A
109 non-zero default value will be selected if this is not explicitly set.
110 .TP
111 .BI bos " MPLS_BOS"
112 Manually configure the bottom of stack bit for an MPLS header push. The default
113 is for TC to automatically set (or unset) the bit based on the next header of
114 the packet.
115 .TP
116 .I CONTROL
117 How to continue after executing this action.
118 .RS
119 .TP
120 .B reclassify
121 Restarts classification by jumping back to the first filter attached to this
122 action's parent.
123 .TP
124 .B pipe
125 Continue with the next action, this is the default.
126 .TP
127 .B drop
128 Packet will be dropped without running further actions.
129 .TP
130 .B continue
131 Continue classification with next filter in line.
132 .TP
133 .B pass
134 Return to calling qdisc for packet processing. This ends the classification
135 process.
136 .RE
137 .SH EXAMPLES
138 The following example encapsulates incoming IP packets on eth0 into MPLS with
139 a label 123 and sends them out eth1:
140
141 .RS
142 .EX
143 #tc qdisc add dev eth0 handle ffff: ingress
144 #tc filter add dev eth0 protocol ip parent ffff: flower \\
145 action mpls push protocol mpls_uc label 123 \\
146 action mirred egress redirect dev eth1
147 .EE
148 .RE
149
150 In this example, incoming MPLS unicast packets on eth0 are decapsulated
151 and redirected to eth1:
152
153 .RS
154 .EX
155 #tc qdisc add dev eth0 handle ffff: ingress
156 #tc filter add dev eth0 protocol mpls_uc parent ffff: flower \\
157 action mpls pop protocol ipv4 \\
158 action mirred egress redirect dev eth1
159 .EE
160 .RE
161
162 Here is another example, where incoming Ethernet frames are encapsulated into
163 MPLS with label 123 and TTL 64. Then, an outer Ethernet header is added and the
164 resulting frame is finally sent on eth1:
165
166 .RS
167 .EX
168 #tc qdisc add dev eth0 ingress
169 #tc filter add dev eth0 ingress matchall \\
170 action mpls mac_push label 123 ttl 64 \\
171 action vlan push_eth \\
172 dst_mac 02:00:00:00:00:02 \\
173 src_mac 02:00:00:00:00:01 \\
174 action mirred egress redirect dev eth1
175 .EE
176 .RE
177
178 The following example assumes that incoming MPLS packets with label 123
179 transport Ethernet frames. The outer Ethernet and the MPLS headers are
180 stripped, then the inner Ethernet frame is sent on eth1:
181
182 .RS
183 .EX
184 #tc qdisc add dev eth0 ingress
185 #tc filter add dev eth0 ingress protocol mpls_uc \\
186 flower mpls_label 123 mpls_bos 1 \\
187 action vlan pop_eth \\
188 action mpls pop protocol teb \\
189 action mirred egress redirect dev eth1
190 .EE
191 .RE
192
193 .SH SEE ALSO
194 .BR tc "(8), " tc-mirred "(8), " tc-vlan (8)