summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-tumbleweed/man8/tc-mpls.8
blob: 7f8be2212fb23e16f72d11b5c06773d115178fe8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
.TH "MPLS manipulation action in tc" 8 "22 May 2019" "iproute2" "Linux"

.SH NAME
mpls - mpls manipulation module
.SH SYNOPSIS
.in +8
.ti -8
.BR tc " ... " "action mpls" " { "
.IR POP " | " PUSH " | " MODIFY " | "
.BR dec_ttl " } [ "
.IR CONTROL " ]"

.ti -8
.IR POP " := "
.BR pop " " protocol
.IR MPLS_PROTO

.ti -8
.IR PUSH " := "
.RB "{ " push " | " mac_push " } [ " protocol
.IR MPLS_PROTO " ]"
.RB " [ " tc
.IR MPLS_TC " ] "
.RB " [ " ttl
.IR MPLS_TTL " ] "
.RB " [ " bos
.IR MPLS_BOS " ] "
.BI label " MPLS_LABEL"

.ti -8
.IR MODIFY " := "
.BR modify " [ " label
.IR MPLS_LABEL " ]"
.RB " [ " tc
.IR MPLS_TC " ] "
.RB " [ " ttl
.IR MPLS_TTL " ] "

.ti -8
.IR CONTROL " := { "
.BR reclassify " | " pipe " | " drop " | " continue " | " pass " | " goto " " chain " " CHAIN_INDEX " }"
.SH DESCRIPTION
The
.B mpls
action performs mpls encapsulation or decapsulation on a packet, reflected by the
operation modes
.IR POP ", " PUSH ", " MODIFY " and " DEC_TTL .
The
.I POP
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
.IR PUSH " and " MODIFY
modes update the current MPLS header information or add a new header.
.IR PUSH
requires at least an
.IR MPLS_LABEL ". "
.I DEC_TTL
requires no arguments and simply subtracts 1 from the MPLS header TTL field.

.SH OPTIONS
.TP
.B pop
Decapsulation mode. Requires the protocol of the next header.
.TP
.B push
Encapsulation mode. Adds the MPLS header between the MAC and the network
headers. Requires at least the
.B label
option.
.TP
.B mac_push
Encapsulation mode. Adds the MPLS header before the MAC header. Requires at
least the
.B label
option.
.TP
.B modify
Replace mode. Existing MPLS tag is replaced.
.BR label ", "
.BR tc ", "
and
.B ttl
are all optional.
.TP
.B dec_ttl
Decrement the TTL field on the outer most MPLS header.
.TP
.BI label " MPLS_LABEL"
Specify the MPLS LABEL for the outer MPLS header.
.I MPLS_LABEL
is an unsigned 20bit integer, the format is detected automatically (e.g. prefix
with
.RB ' 0x '
for hexadecimal interpretation, etc.).
.TP
.BI protocol " MPLS_PROTO"
Choose the protocol to use. For push actions this must be
.BR mpls_uc " or " mpls_mc " (" mpls_uc
is the default). For pop actions it should be the protocol of the next header.
This option cannot be used with modify.
.TP
.BI tc " MPLS_TC"
Choose the TC value for the outer MPLS header. Decimal number in range of 0-7.
Defaults to 0.
.TP
.BI ttl " MPLS_TTL"
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.
.TP
.BI bos " MPLS_BOS"
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.
.TP
.I CONTROL
How to continue after executing this action.
.RS
.TP
.B reclassify
Restarts classification by jumping back to the first filter attached to this
action's parent.
.TP
.B pipe
Continue with the next action, this is the default.
.TP
.B drop
Packet will be dropped without running further actions.
.TP
.B continue
Continue classification with next filter in line.
.TP
.B pass
Return to calling qdisc for packet processing. This ends the classification
process.
.RE
.SH EXAMPLES
The following example encapsulates incoming IP packets on eth0 into MPLS with
a label 123 and sends them out eth1:

.RS
.EX
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev eth0 protocol ip parent ffff: flower \\
	action mpls push protocol mpls_uc label 123  \\
	action mirred egress redirect dev eth1
.EE
.RE

In this example, incoming MPLS unicast packets on eth0 are decapsulated
and redirected to eth1:

.RS
.EX
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev eth0 protocol mpls_uc parent ffff: flower \\
	action mpls pop protocol ipv4  \\
	action mirred egress redirect dev eth1
.EE
.RE

Here is another example, where incoming Ethernet frames are encapsulated into
MPLS with label 123 and TTL 64. Then, an outer Ethernet header is added and the
resulting frame is finally sent on eth1:

.RS
.EX
#tc qdisc add dev eth0 ingress
#tc filter add dev eth0 ingress matchall \\
	action mpls mac_push label 123 ttl 64 \\
	action vlan push_eth \\
		dst_mac 02:00:00:00:00:02 \\
		src_mac 02:00:00:00:00:01 \\
	action mirred egress redirect dev eth1
.EE
.RE

The following example assumes that incoming MPLS packets with label 123
transport Ethernet frames. The outer Ethernet and the MPLS headers are
stripped, then the inner Ethernet frame is sent on eth1:

.RS
.EX
#tc qdisc add dev eth0 ingress
#tc filter add dev eth0 ingress protocol mpls_uc \\
	flower mpls_label 123 mpls_bos 1 \\
	action vlan pop_eth \\
	action mpls pop protocol teb \\
	action mirred egress redirect dev eth1
.EE
.RE

.SH SEE ALSO
.BR tc "(8), " tc-mirred "(8), " tc-vlan (8)