1Tunnel metadata manipulation actionTuinnLnietnlcu(xm8e)tadata manipulation action in tc(8)
2
3
4
6 tunnel_key - Tunnel metadata manipulation
7
9 tc ... action tunnel_key { unset | SET }
10
11 SET := set src_ip ADDRESS dst_ip ADDRESS id KEY_ID dst_port UDP_PORT
12
13
15 The tunnel_key action combined with a shared IP tunnel device, allows
16 to perform IP tunnel en- or decapsulation on a packet, reflected by the
17 operation modes UNSET and SET. The UNSET mode is optional - even with‐
18 out using it, the metadata information will be released automatically
19 when packet processing will be finished. UNSET function could be used
20 in cases when traffic is forwarded between two tunnels, where the meta‐
21 data from the first tunnel will be used for encapsulation done by the
22 second tunnel. SET mode requires the source and destination ip ADDRESS
23 and the tunnel key id KEY_ID which will be used by the ip tunnel shared
24 device to create the tunnel header. The tunnel_key action is useful
25 only in combination with a mirred redirect action to a shared IP tunnel
26 device which will use the metadata (for SET ) and unset the metadata
27 created by it (for UNSET ).
28
29
31 unset Unset the tunnel metadata created by the IP tunnel device. This
32 function is not mandatory and might be used only in some spe‐
33 cific use cases (as explained above).
34
35 set Set tunnel metadata to be used by the IP tunnel device. Requires
36 id , src_ip and dst_ip options. dst_port is optional.
37
38 id Tunnel ID (for example VNI in VXLAN tunnel)
39
40 src_ip Outer header source IP address (IPv4 or IPv6)
41
42 dst_ip Outer header destination IP address (IPv4 or IPv6)
43
44 dst_port
45 Outer header destination UDP port
46
48 The following example encapsulates incoming ICMP packets on eth0 into a
49 vxlan tunnel, by setting metadata to VNI 11, source IP 11.11.0.1 and
50 destination IP 11.11.0.2, and by redirecting the packet with the meta‐
51 data to device vxlan0, which will do the actual encapsulation using the
52 metadata:
53
54 #tc qdisc add dev eth0 handle ffff: ingress
55 #tc filter add dev eth0 protocol ip parent ffff: \
56 flower \
57 ip_proto icmp \
58 action tunnel_key set \
59 src_ip 11.11.0.1 \
60 dst_ip 11.11.0.2 \
61 id 11 \
62 action mirred egress redirect dev vxlan0
63
64 Here is an example of the unset function: Incoming VXLAN traffic with
65 outer IP's and VNI 11 is decapsulated by vxlan0 and metadata is unset
66 before redirecting to tunl1 device:
67
68 #tc qdisc add dev eth0 handle ffff: ingress
69 #tc filter add dev vxlan0 protocol ip parent ffff: flower \
70 enc_src_ip 11.11.0.2 enc_dst_ip 11.11.0.1 enc_key_id 11 action tunnel_key unset action mirred egress redirect dev tunl1
71
72
74 tc(8)
75
76
77
78iproute2 1T0unNnoevl 2m0e1t6adata manipulation action in tc(8)