Blame man/man8/tc-tunnel_key.8

Packit d3f73b
.TH "Tunnel metadata manipulation action in tc" 8 "10 Nov 2016" "iproute2" "Linux"
Packit d3f73b
Packit d3f73b
.SH NAME
Packit d3f73b
tunnel_key - Tunnel metadata manipulation
Packit d3f73b
.SH SYNOPSIS
Packit d3f73b
.in +8
Packit d3f73b
.ti -8
Packit d3f73b
.BR tc " ... " "action tunnel_key" " { " unset " | "
Packit d3f73b
.IR SET " }"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR SET " := "
Packit d3f73b
.BR set " " src_ip
Packit d3f73b
.IR ADDRESS
Packit d3f73b
.BR dst_ip
Packit d3f73b
.IR ADDRESS
Packit d3f73b
.BI id " KEY_ID"
Packit d3f73b
.BI dst_port " UDP_PORT"
Packit d3f73b
.BI tos " TOS"
Packit d3f73b
.BI ttl " TTL"
Packit d3f73b
.RB "[ " csum " | " nocsum " ]"
Packit d3f73b
Packit d3f73b
.SH DESCRIPTION
Packit d3f73b
The
Packit d3f73b
.B tunnel_key
Packit d3f73b
action combined with a shared IP tunnel device, allows to perform IP tunnel en-
Packit d3f73b
or decapsulation on a packet, reflected by
Packit d3f73b
the operation modes
Packit d3f73b
.IR UNSET " and " SET .
Packit d3f73b
The
Packit d3f73b
.I UNSET
Packit d3f73b
mode is optional - even without using it, the metadata information will be
Packit d3f73b
released automatically when packet processing will be finished.
Packit d3f73b
.IR UNSET
Packit d3f73b
function could be used in cases when traffic is forwarded between two tunnels,
Packit d3f73b
where the metadata from the first tunnel will be used for encapsulation done by
Packit d3f73b
the second tunnel.
Packit d3f73b
.IR SET
Packit d3f73b
mode requires the source and destination ip
Packit d3f73b
.I ADDRESS
Packit d3f73b
and the tunnel key id
Packit d3f73b
.I KEY_ID
Packit d3f73b
which will be used by the ip tunnel shared device to create the tunnel header. The
Packit d3f73b
.B tunnel_key
Packit d3f73b
action is useful only in combination with a
Packit d3f73b
.B mirred redirect
Packit d3f73b
action to a shared IP tunnel device which will use the metadata (for
Packit d3f73b
.I SET
Packit d3f73b
) and unset the metadata created by it (for
Packit d3f73b
.I UNSET
Packit d3f73b
).
Packit d3f73b
Packit d3f73b
.SH OPTIONS
Packit d3f73b
.TP
Packit d3f73b
.B unset
Packit d3f73b
Unset the tunnel metadata created by the IP tunnel device.  This function is
Packit d3f73b
not mandatory and might be used only in some specific use cases (as explained
Packit d3f73b
above).
Packit d3f73b
.TP
Packit d3f73b
.B set
Packit d3f73b
Set tunnel metadata to be used by the IP tunnel device. Requires
Packit d3f73b
.B src_ip
Packit d3f73b
and
Packit d3f73b
.B dst_ip
Packit d3f73b
options.
Packit d3f73b
.B id
Packit d3f73b
,
Packit d3f73b
.B dst_port
Packit Service 8275aa
,
Packit d3f73b
.B geneve_opts
Packit Service 3075a9
,
Packit Service 8275aa
.B vxlan_opts
Packit Service 3075a9
and
Packit Service 3075a9
.B erspan_opts
Packit d3f73b
are optional.
Packit d3f73b
.RS
Packit d3f73b
.TP
Packit d3f73b
.B id
Packit d3f73b
Tunnel ID (for example VNI in VXLAN tunnel)
Packit d3f73b
.TP
Packit d3f73b
.B src_ip
Packit d3f73b
Outer header source IP address (IPv4 or IPv6)
Packit d3f73b
.TP
Packit d3f73b
.B dst_ip
Packit d3f73b
Outer header destination IP address (IPv4 or IPv6)
Packit d3f73b
.TP
Packit d3f73b
.B dst_port
Packit d3f73b
Outer header destination UDP port
Packit d3f73b
.TP
Packit d3f73b
.B geneve_opts
Packit d3f73b
Geneve variable length options.
Packit d3f73b
.B geneve_opts
Packit d3f73b
is specified in the form CLASS:TYPE:DATA, where CLASS is represented as a
Packit d3f73b
16bit hexadecimal value, TYPE as an 8bit hexadecimal value and DATA as a
Packit d3f73b
variable length hexadecimal value. Additionally multiple options may be
Packit d3f73b
listed using a comma delimiter.
Packit d3f73b
.TP
Packit Service 8275aa
.B vxlan_opts
Packit Service 8275aa
Vxlan metatdata options.
Packit Service 8275aa
.B vxlan_opts
Packit Service 8275aa
is specified in the form GBP, as a 32bit number. Multiple options is not
Packit Service 8275aa
supported.
Packit Service 8275aa
.TP
Packit Service 3075a9
.B erspan_opts
Packit Service 3075a9
Erspan metatdata options.
Packit Service 3075a9
.B erspan_opts
Packit Service 3075a9
is specified in the form VERSION:INDEX:DIR:HWID, where VERSION is represented
Packit Service 3075a9
as a 8bit number, INDEX as an 32bit number, DIR and HWID as a 8bit number.
Packit Service 3075a9
Multiple options is not supported. Note INDEX is used when VERSION is 1,
Packit Service 3075a9
and DIR and HWID are used when VERSION is 2.
Packit Service 3075a9
.TP
Packit d3f73b
.B tos
Packit d3f73b
Outer header TOS
Packit d3f73b
.TP
Packit d3f73b
.B ttl
Packit d3f73b
Outer header TTL
Packit d3f73b
.TP
Packit d3f73b
.RB [ no ] csum
Packit d3f73b
Controls outer UDP checksum. When set to
Packit d3f73b
.B csum
Packit d3f73b
(which is default), the outer UDP checksum is calculated and included in the
Packit d3f73b
packets. When set to
Packit d3f73b
.BR nocsum ,
Packit d3f73b
outer UDP checksum is zero. Note that when using zero UDP checksums with
Packit d3f73b
IPv6, the other tunnel endpoint must be configured to accept such packets.
Packit d3f73b
In Linux, this would be the
Packit d3f73b
.B udp6zerocsumrx
Packit d3f73b
option for the VXLAN tunnel interface.
Packit d3f73b
.IP
Packit d3f73b
If using
Packit d3f73b
.B nocsum
Packit d3f73b
with IPv6, be sure you know what you are doing. Zero UDP checksums provide
Packit d3f73b
weaker protection against corrupted packets. See RFC6935 for details.
Packit d3f73b
.RE
Packit d3f73b
.SH EXAMPLES
Packit d3f73b
The following example encapsulates incoming ICMP packets on eth0 into a vxlan
Packit d3f73b
tunnel, by setting metadata to VNI 11, source IP 11.11.0.1 and destination IP
Packit d3f73b
11.11.0.2, and by redirecting the packet with the metadata to device vxlan0,
Packit d3f73b
which will do the actual encapsulation using the metadata:
Packit d3f73b
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
#tc qdisc add dev eth0 handle ffff: ingress
Packit d3f73b
#tc filter add dev eth0 protocol ip parent ffff: \\
Packit d3f73b
  flower \\
Packit d3f73b
    ip_proto icmp \\
Packit d3f73b
  action tunnel_key set \\
Packit d3f73b
    src_ip 11.11.0.1 \\
Packit d3f73b
    dst_ip 11.11.0.2 \\
Packit d3f73b
    id 11 \\
Packit d3f73b
  action mirred egress redirect dev vxlan0
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
Here is an example of the
Packit d3f73b
.B unset
Packit d3f73b
function: Incoming VXLAN traffic with outer IP's and VNI 11 is decapsulated by
Packit d3f73b
vxlan0 and metadata is unset before redirecting to tunl1 device:
Packit d3f73b
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
#tc qdisc add dev eth0 handle ffff: ingress
Packit d3f73b
#tc filter add dev vxlan0 protocol ip parent ffff: \
Packit d3f73b
  flower \\
Packit d3f73b
	  enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 \
Packit d3f73b
	action tunnel_key unset \
Packit d3f73b
	action mirred egress redirect dev tunl1
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
.SH SEE ALSO
Packit d3f73b
.BR tc (8)