|
Packit Service |
3880ab |
.TH "MPLS manipulation action in tc" 8 "22 May 2019" "iproute2" "Linux"
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH NAME
|
|
Packit Service |
3880ab |
mpls - mpls manipulation module
|
|
Packit Service |
3880ab |
.SH SYNOPSIS
|
|
Packit Service |
3880ab |
.in +8
|
|
Packit Service |
3880ab |
.ti -8
|
|
Packit Service |
3880ab |
.BR tc " ... " "action mpls" " { "
|
|
Packit Service |
3880ab |
.IR POP " | " PUSH " | " MODIFY " | "
|
|
Packit Service |
3880ab |
.BR dec_ttl " } [ "
|
|
Packit Service |
3880ab |
.IR CONTROL " ]"
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.ti -8
|
|
Packit Service |
3880ab |
.IR POP " := "
|
|
Packit Service |
3880ab |
.BR pop " " protocol
|
|
Packit Service |
3880ab |
.IR MPLS_PROTO
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.ti -8
|
|
Packit Service |
3880ab |
.IR PUSH " := "
|
|
Packit Service |
fe0ddc |
.RB "{ " push " | " mac_push " } [ " protocol
|
|
Packit Service |
3880ab |
.IR MPLS_PROTO " ]"
|
|
Packit Service |
3880ab |
.RB " [ " tc
|
|
Packit Service |
3880ab |
.IR MPLS_TC " ] "
|
|
Packit Service |
3880ab |
.RB " [ " ttl
|
|
Packit Service |
3880ab |
.IR MPLS_TTL " ] "
|
|
Packit Service |
3880ab |
.RB " [ " bos
|
|
Packit Service |
3880ab |
.IR MPLS_BOS " ] "
|
|
Packit Service |
3880ab |
.BI label " MPLS_LABEL"
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.ti -8
|
|
Packit Service |
3880ab |
.IR MODIFY " := "
|
|
Packit Service |
3880ab |
.BR modify " [ " label
|
|
Packit Service |
3880ab |
.IR MPLS_LABEL " ]"
|
|
Packit Service |
3880ab |
.RB " [ " tc
|
|
Packit Service |
3880ab |
.IR MPLS_TC " ] "
|
|
Packit Service |
3880ab |
.RB " [ " ttl
|
|
Packit Service |
3880ab |
.IR MPLS_TTL " ] "
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.ti -8
|
|
Packit Service |
3880ab |
.IR CONTROL " := { "
|
|
Packit Service |
3880ab |
.BR reclassify " | " pipe " | " drop " | " continue " | " pass " | " goto " " chain " " CHAIN_INDEX " }"
|
|
Packit Service |
3880ab |
.SH DESCRIPTION
|
|
Packit Service |
3880ab |
The
|
|
Packit Service |
3880ab |
.B mpls
|
|
Packit Service |
3880ab |
action performs mpls encapsulation or decapsulation on a packet, reflected by the
|
|
Packit Service |
3880ab |
operation modes
|
|
Packit Service |
3880ab |
.IR POP ", " PUSH ", " MODIFY " and " DEC_TTL .
|
|
Packit Service |
3880ab |
The
|
|
Packit Service |
3880ab |
.I POP
|
|
Packit Service |
3880ab |
mode requires the ethertype of the header that follows the MPLS header (e.g.
|
|
Packit Service |
3880ab |
IPv4 or another MPLS). It will remove the outer MPLS header and replace the
|
|
Packit Service |
3880ab |
ethertype in the MAC header with that passed. The
|
|
Packit Service |
3880ab |
.IR PUSH " and " MODIFY
|
|
Packit Service |
3880ab |
modes update the current MPLS header information or add a new header.
|
|
Packit Service |
3880ab |
.IR PUSH
|
|
Packit Service |
3880ab |
requires at least an
|
|
Packit Service |
3880ab |
.IR MPLS_LABEL ". "
|
|
Packit Service |
3880ab |
.I DEC_TTL
|
|
Packit Service |
3880ab |
requires no arguments and simply subtracts 1 from the MPLS header TTL field.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH OPTIONS
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B pop
|
|
Packit Service |
3880ab |
Decapsulation mode. Requires the protocol of the next header.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B push
|
|
Packit Service |
fe0ddc |
Encapsulation mode. Adds the MPLS header between the MAC and the network
|
|
Packit Service |
fe0ddc |
headers. Requires at least the
|
|
Packit Service |
fe0ddc |
.B label
|
|
Packit Service |
fe0ddc |
option.
|
|
Packit Service |
fe0ddc |
.TP
|
|
Packit Service |
fe0ddc |
.B mac_push
|
|
Packit Service |
fe0ddc |
Encapsulation mode. Adds the MPLS header before the MAC header. Requires at
|
|
Packit Service |
fe0ddc |
least the
|
|
Packit Service |
3880ab |
.B label
|
|
Packit Service |
3880ab |
option.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B modify
|
|
Packit Service |
3880ab |
Replace mode. Existing MPLS tag is replaced.
|
|
Packit Service |
3880ab |
.BR label ", "
|
|
Packit Service |
3880ab |
.BR tc ", "
|
|
Packit Service |
3880ab |
and
|
|
Packit Service |
3880ab |
.B ttl
|
|
Packit Service |
3880ab |
are all optional.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B dec_ttl
|
|
Packit Service |
3880ab |
Decrement the TTL field on the outer most MPLS header.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.BI label " MPLS_LABEL"
|
|
Packit Service |
3880ab |
Specify the MPLS LABEL for the outer MPLS header.
|
|
Packit Service |
3880ab |
.I MPLS_LABEL
|
|
Packit Service |
3880ab |
is an unsigned 20bit integer, the format is detected automatically (e.g. prefix
|
|
Packit Service |
3880ab |
with
|
|
Packit Service |
3880ab |
.RB ' 0x '
|
|
Packit Service |
3880ab |
for hexadecimal interpretation, etc.).
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.BI protocol " MPLS_PROTO"
|
|
Packit Service |
3880ab |
Choose the protocol to use. For push actions this must be
|
|
Packit Service |
3880ab |
.BR mpls_uc " or " mpls_mc " (" mpls_uc
|
|
Packit Service |
3880ab |
is the default). For pop actions it should be the protocol of the next header.
|
|
Packit Service |
3880ab |
This option cannot be used with modify.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.BI tc " MPLS_TC"
|
|
Packit Service |
3880ab |
Choose the TC value for the outer MPLS header. Decimal number in range of 0-7.
|
|
Packit Service |
3880ab |
Defaults to 0.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.BI ttl " MPLS_TTL"
|
|
Packit Service |
3880ab |
Choose the TTL value for the outer MPLS header. Number in range of 0-255. A
|
|
Packit Service |
3880ab |
non-zero default value will be selected if this is not explicitly set.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.BI bos " MPLS_BOS"
|
|
Packit Service |
3880ab |
Manually configure the bottom of stack bit for an MPLS header push. The default
|
|
Packit Service |
3880ab |
is for TC to automatically set (or unset) the bit based on the next header of
|
|
Packit Service |
3880ab |
the packet.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.I CONTROL
|
|
Packit Service |
3880ab |
How to continue after executing this action.
|
|
Packit Service |
3880ab |
.RS
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B reclassify
|
|
Packit Service |
3880ab |
Restarts classification by jumping back to the first filter attached to this
|
|
Packit Service |
3880ab |
action's parent.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B pipe
|
|
Packit Service |
3880ab |
Continue with the next action, this is the default.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B drop
|
|
Packit Service |
3880ab |
Packet will be dropped without running further actions.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B continue
|
|
Packit Service |
3880ab |
Continue classification with next filter in line.
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
.B pass
|
|
Packit Service |
3880ab |
Return to calling qdisc for packet processing. This ends the classification
|
|
Packit Service |
3880ab |
process.
|
|
Packit Service |
3880ab |
.RE
|
|
Packit Service |
3880ab |
.SH EXAMPLES
|
|
Packit Service |
3880ab |
The following example encapsulates incoming IP packets on eth0 into MPLS with
|
|
Packit Service |
3880ab |
a label 123 and sends them out eth1:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.RS
|
|
Packit Service |
3880ab |
.EX
|
|
Packit Service |
3880ab |
#tc qdisc add dev eth0 handle ffff: ingress
|
|
Packit Service |
3880ab |
#tc filter add dev eth0 protocol ip parent ffff: flower \\
|
|
Packit Service |
3880ab |
action mpls push protocol mpls_uc label 123 \\
|
|
Packit Service |
3880ab |
action mirred egress redirect dev eth1
|
|
Packit Service |
3880ab |
.EE
|
|
Packit Service |
3880ab |
.RE
|
|
Packit Service |
3880ab |
|
|
Packit Service |
0d9893 |
In this example, incoming MPLS unicast packets on eth0 are decapsulated and to
|
|
Packit Service |
0d9893 |
ip packets and output to eth1:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.RS
|
|
Packit Service |
3880ab |
.EX
|
|
Packit Service |
3880ab |
#tc qdisc add dev eth0 handle ffff: ingress
|
|
Packit Service |
3880ab |
#tc filter add dev eth0 protocol mpls_uc parent ffff: flower \\
|
|
Packit Service |
3880ab |
action mpls pop protocol ipv4 \\
|
|
Packit Service |
0d9893 |
action mirred egress redirect dev eth0
|
|
Packit Service |
415e21 |
.EE
|
|
Packit Service |
415e21 |
.RE
|
|
Packit Service |
415e21 |
|
|
Packit Service |
fe0ddc |
Here is another example, where incoming Ethernet frames are encapsulated into
|
|
Packit Service |
fe0ddc |
MPLS with label 123 and TTL 64. Then, an outer Ethernet header is added and the
|
|
Packit Service |
fe0ddc |
resulting frame is finally sent on eth1:
|
|
Packit Service |
fe0ddc |
|
|
Packit Service |
fe0ddc |
.RS
|
|
Packit Service |
fe0ddc |
.EX
|
|
Packit Service |
fe0ddc |
#tc qdisc add dev eth0 ingress
|
|
Packit Service |
fe0ddc |
#tc filter add dev eth0 ingress matchall \\
|
|
Packit Service |
fe0ddc |
action mpls mac_push label 123 ttl 64 \\
|
|
Packit Service |
fe0ddc |
action vlan push_eth \\
|
|
Packit Service |
fe0ddc |
dst_mac 02:00:00:00:00:02 \\
|
|
Packit Service |
fe0ddc |
src_mac 02:00:00:00:00:01 \\
|
|
Packit Service |
fe0ddc |
action mirred egress redirect dev eth1
|
|
Packit Service |
fe0ddc |
.EE
|
|
Packit Service |
fe0ddc |
.RE
|
|
Packit Service |
fe0ddc |
|
|
Packit Service |
fe0ddc |
The following example assumes that incoming MPLS packets with label 123
|
|
Packit Service |
fe0ddc |
transport Ethernet frames. The outer Ethernet and the MPLS headers are
|
|
Packit Service |
fe0ddc |
stripped, then the inner Ethernet frame is sent on eth1:
|
|
Packit Service |
fe0ddc |
|
|
Packit Service |
fe0ddc |
.RS
|
|
Packit Service |
fe0ddc |
.EX
|
|
Packit Service |
fe0ddc |
#tc qdisc add dev eth0 ingress
|
|
Packit Service |
fe0ddc |
#tc filter add dev eth0 ingress protocol mpls_uc \\
|
|
Packit Service |
fe0ddc |
flower mpls_label 123 mpls_bos 1 \\
|
|
Packit Service |
fe0ddc |
action vlan pop_eth \\
|
|
Packit Service |
fe0ddc |
action mpls pop protocol teb \\
|
|
Packit Service |
fe0ddc |
action mirred egress redirect dev eth1
|
|
Packit Service |
fe0ddc |
.EE
|
|
Packit Service |
fe0ddc |
.RE
|
|
Packit Service |
fe0ddc |
|
|
Packit Service |
3880ab |
.SH SEE ALSO
|
|
Packit Service |
fe0ddc |
.BR tc "(8), " tc-mirred "(8), " tc-vlan (8)
|