Blame man/man8/tc-mpls.8

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 Bot 867fae
.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 Bot 867fae
Encapsulation mode. Adds the MPLS header between the MAC and the network
Packit Bot 867fae
headers. Requires at least the
Packit Bot 867fae
.B label
Packit Bot 867fae
option.
Packit Bot 867fae
.TP
Packit Bot 867fae
.B mac_push
Packit Bot 867fae
Encapsulation mode. Adds the MPLS header before the MAC header. Requires at
Packit Bot 867fae
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 Bot 867fae
In this example, incoming MPLS unicast packets on eth0 are decapsulated
Packit Bot 867fae
and redirected 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 Bot 867fae
	action mirred egress redirect dev eth1
Packit Bot 867fae
.EE
Packit Bot 867fae
.RE
Packit Bot 867fae
Packit Bot 867fae
Here is another example, where incoming Ethernet frames are encapsulated into
Packit Bot 867fae
MPLS with label 123 and TTL 64. Then, an outer Ethernet header is added and the
Packit Bot 867fae
resulting frame is finally sent on eth1:
Packit Bot 867fae
Packit Bot 867fae
.RS
Packit Bot 867fae
.EX
Packit Bot 867fae
#tc qdisc add dev eth0 ingress
Packit Bot 867fae
#tc filter add dev eth0 ingress matchall \\
Packit Bot 867fae
	action mpls mac_push label 123 ttl 64 \\
Packit Bot 867fae
	action vlan push_eth \\
Packit Bot 867fae
		dst_mac 02:00:00:00:00:02 \\
Packit Bot 867fae
		src_mac 02:00:00:00:00:01 \\
Packit Bot 867fae
	action mirred egress redirect dev eth1
Packit Bot 867fae
.EE
Packit Bot 867fae
.RE
Packit Bot 867fae
Packit Bot 867fae
The following example assumes that incoming MPLS packets with label 123
Packit Bot 867fae
transport Ethernet frames. The outer Ethernet and the MPLS headers are
Packit Bot 867fae
stripped, then the inner Ethernet frame is sent on eth1:
Packit Bot 867fae
Packit Bot 867fae
.RS
Packit Bot 867fae
.EX
Packit Bot 867fae
#tc qdisc add dev eth0 ingress
Packit Bot 867fae
#tc filter add dev eth0 ingress protocol mpls_uc \\
Packit Bot 867fae
	flower mpls_label 123 mpls_bos 1 \\
Packit Bot 867fae
	action vlan pop_eth \\
Packit Bot 867fae
	action mpls pop protocol teb \\
Packit Bot 867fae
	action mirred egress redirect dev eth1
Packit Service fe0ddc
.EE
Packit Service fe0ddc
.RE
Packit Service fe0ddc
Packit Service 3880ab
.SH SEE ALSO
Packit Bot 867fae
.BR tc "(8), " tc-mirred "(8), " tc-vlan (8)