Debian Codegraph @

upstream/debian-unstable/man8/tc-mirred.8

raw
1 .TH "Mirror/redirect action in tc" 8 "11 Jan 2015" "iproute2" "Linux"
2
3 .SH NAME
4 mirred - mirror/redirect action
5 .SH SYNOPSIS
6 .in +8
7 .ti -8
8 .BR tc " ... " "action mirred"
9 .I DIRECTION ACTION
10 .RB "[ " index
11 .IR INDEX " ] "
12 .I TARGET
13
14 .ti -8
15 .IR DIRECTION " := { "
16 .BR ingress " | " egress " }"
17
18 .ti -8
19 .IR TARGET " := { " DEV " | " BLOCK " }"
20
21 .ti -8
22 .IR DEV " := "
23 .BI dev " DEVICENAME"
24
25 .ti -8
26 .IR BLOCK " := "
27 .BI blockid " BLOCKID"
28
29 .ti -8
30 .IR ACTION " := { "
31 .BR mirror " | " redirect " }"
32 .SH DESCRIPTION
33 The
34 .B mirred
35 action allows packet mirroring (copying) or redirecting (stealing) the packet it
36 receives. Mirroring is what is sometimes referred to as Switch Port Analyzer
37 (SPAN) and is commonly used to analyze and/or debug flows.
38 When mirroring to a tc block, the packet will be mirrored to all the ports in
39 the block with exception of the port where the packet ingressed, if that port is
40 part of the tc block. Redirecting is similar to mirroring except that the
41 behaviour is to mirror to the first N - 1 ports in the block and redirect to the
42 last one (note that the port in which the packet arrived is not going to be
43 mirrored or redirected to).
44 .SH OPTIONS
45 .TP
46 .B ingress
47 .TQ
48 .B egress
49 Specify the direction in which the packet shall appear on the destination
50 interface.
51 .TP
52 .B mirror
53 .TQ
54 .B redirect
55 Define whether the packet should be copied
56 .RB ( mirror )
57 or moved
58 .RB ( redirect )
59 to the destination interface or block.
60 .TP
61 .BI index " INDEX"
62 Assign a unique ID to this action instead of letting the kernel choose one
63 automatically.
64 .I INDEX
65 is a 32bit unsigned integer greater than zero.
66 .TP
67 .BI dev " DEVICENAME"
68 Specify the network interface to redirect or mirror to.
69 .TP
70 .BI blockid " BLOCKID"
71 Specify the tc block to redirect or mirror to.
72 .SH EXAMPLES
73 Limit ingress bandwidth on eth0 to 1mbit/s, redirect exceeding traffic to lo for
74 debugging purposes:
75
76 .RS
77 .EX
78 # tc qdisc add dev eth0 handle ffff: clsact
79 # tc filter add dev eth0 ingress u32 \\
80 match u32 0 0 \\
81 action police rate 1mbit burst 100k conform-exceed pipe \\
82 action mirred egress redirect dev lo
83 .EE
84 .RE
85
86 Mirror all incoming ICMP packets on eth0 to a dummy interface for examination
87 with e.g. tcpdump:
88
89 .RS
90 .EX
91 # ip link add dummy0 type dummy
92 # ip link set dummy0 up
93 # tc qdisc add dev eth0 handle ffff: clsact
94 # tc filter add dev eth0 ingress protocol ip \\
95 u32 match ip protocol 1 0xff \\
96 action mirred egress mirror dev dummy0
97 .EE
98 .RE
99
100 Using an
101 .B ifb
102 interface, it is possible to send ingress traffic through an instance of
103 .BR sfq :
104
105 .RS
106 .EX
107 # modprobe ifb
108 # ip link set ifb0 up
109 # tc qdisc add dev ifb0 root sfq
110 # tc qdisc add dev eth0 handle ffff: clsact
111 # tc filter add dev eth0 ingress u32 \\
112 match u32 0 0 \\
113 action mirred egress redirect dev ifb0
114 .EE
115 .RE
116
117 .SH LIMITATIONS
118 The kernel restricts nesting to four levels to avoid the chance
119 of nesting loops.
120 .PP
121 Do not redirect for one IFB device to another.
122 IFB is a very specialized case of packet redirecting device.
123 Redirecting from ifbX->ifbY will cause all packets to be dropped.
124
125 .SH SEE ALSO
126 .BR tc (8),
127 .BR tc-u32 (8)