1Mirror/redirect action in tc(8)      Linux     Mirror/redirect action in tc(8)
2
3
4

NAME

6       mirred - mirror/redirect action
7

SYNOPSIS

9       tc ... action mirred DIRECTION ACTION [ index INDEX ] dev DEVICENAME
10
11       DIRECTION := { ingress | egress }
12
13       ACTION := { mirror | redirect }
14

DESCRIPTION

16       The  mirred  action  allows  packet  mirroring (copying) or redirecting
17       (stealing) the packet it  receives.  Mirroring  is  what  is  sometimes
18       referred to as Switch Port Analyzer (SPAN) and is commonly used to ana‐
19       lyze and/or debug flows.
20

OPTIONS

22       ingress
23       egress Specify the direction in which the packet shall  appear  on  the
24              destination interface.
25
26       mirror
27       redirect
28              Define  whether  the  packet  should be copied (mirror) or moved
29              (redirect) to the destination interface.
30
31       index INDEX
32              Assign a unique ID to this action instead of letting the  kernel
33              choose  one  automatically.   INDEX  is a 32bit unsigned integer
34              greater than zero.
35
36       dev DEVICENAME
37              Specify the network interface to redirect or mirror to.
38

EXAMPLES

40       Limit ingress bandwidth on eth0 to 1mbit/s, redirect exceeding  traffic
41       to lo for debugging purposes:
42
43              # tc qdisc add dev eth0 handle ffff: ingress
44              # tc filter add dev eth0 parent ffff: u32 \
45                   match u32 0 0 \
46                   action police rate 1mbit burst 100k conform-exceed pipe \
47                   action mirred egress redirect dev lo
48
49       Mirror all incoming ICMP packets on eth0 to a dummy interface for exam‐
50       ination with e.g. tcpdump:
51
52              # ip link add dummy0 type dummy
53              # ip link set dummy0 up
54              # tc qdisc add dev eth0 handle ffff: ingress
55              # tc filter add dev eth0 parent ffff: protocol ip \
56                   u32 match ip protocol 1 0xff \
57                   action mirred egress mirror dev dummy0
58
59       Using an ifb interface, it is possible to send ingress traffic  through
60       an instance of sfq:
61
62              # modprobe ifb
63              # ip link set ifb0 up
64              # tc qdisc add dev ifb0 root sfq
65              # tc qdisc add dev eth0 handle ffff: ingress
66              # tc filter add dev eth0 parent ffff: u32 \
67                   match u32 0 0 \
68                   action mirred egress redirect dev ifb0
69
70

SEE ALSO

72       tc(8), tc-u32(8)
73
74
75
76iproute2                          11 Jan 2015  Mirror/redirect action in tc(8)
Impressum