Blame man/man8/tc-mirred.8

Packit Service 3880ab
.TH "Mirror/redirect action in tc" 8 "11 Jan 2015" "iproute2" "Linux"
Packit Service 3880ab
Packit Service 3880ab
.SH NAME
Packit Service 3880ab
mirred - mirror/redirect action
Packit Service 3880ab
.SH SYNOPSIS
Packit Service 3880ab
.in +8
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.BR tc " ... " "action mirred"
Packit Service 3880ab
.I DIRECTION ACTION
Packit Service 3880ab
.RB "[ " index
Packit Service 3880ab
.IR INDEX " ] "
Packit Service 3880ab
.BI dev " DEVICENAME"
Packit Service 3880ab
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.IR DIRECTION " := { "
Packit Service 3880ab
.BR ingress " | " egress " }"
Packit Service 3880ab
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.IR ACTION " := { "
Packit Service 3880ab
.BR mirror " | " redirect " }"
Packit Service 3880ab
.SH DESCRIPTION
Packit Service 3880ab
The
Packit Service 3880ab
.B mirred
Packit Service 3880ab
action allows packet mirroring (copying) or redirecting (stealing) the packet it
Packit Service 3880ab
receives. Mirroring is what is sometimes referred to as Switch Port Analyzer
Packit Service 3880ab
(SPAN) and is commonly used to analyze and/or debug flows.
Packit Service 3880ab
.SH OPTIONS
Packit Service 3880ab
.TP
Packit Service 3880ab
.B ingress
Packit Service 3880ab
.TQ
Packit Service 3880ab
.B egress
Packit Service 3880ab
Specify the direction in which the packet shall appear on the destination
Packit Service 3880ab
interface.
Packit Service 3880ab
.TP
Packit Service 3880ab
.B mirror
Packit Service 3880ab
.TQ
Packit Service 3880ab
.B redirect
Packit Service 3880ab
Define whether the packet should be copied
Packit Service 3880ab
.RB ( mirror )
Packit Service 3880ab
or moved
Packit Service 3880ab
.RB ( redirect )
Packit Service 3880ab
to the destination interface.
Packit Service 3880ab
.TP
Packit Service 3880ab
.BI index " INDEX"
Packit Service 3880ab
Assign a unique ID to this action instead of letting the kernel choose one
Packit Service 3880ab
automatically.
Packit Service 3880ab
.I INDEX
Packit Service 3880ab
is a 32bit unsigned integer greater than zero.
Packit Service 3880ab
.TP
Packit Service 3880ab
.BI dev " DEVICENAME"
Packit Service 3880ab
Specify the network interface to redirect or mirror to.
Packit Service 3880ab
.SH EXAMPLES
Packit Service 3880ab
Limit ingress bandwidth on eth0 to 1mbit/s, redirect exceeding traffic to lo for
Packit Service 3880ab
debugging purposes:
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 parent ffff: u32 \\
Packit Service 3880ab
	match u32 0 0 \\
Packit Service 3880ab
	action police rate 1mbit burst 100k conform-exceed pipe \\
Packit Service 3880ab
	action mirred egress redirect dev lo
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
Mirror all incoming ICMP packets on eth0 to a dummy interface for examination
Packit Service 3880ab
with e.g. tcpdump:
Packit Service 3880ab
Packit Service 3880ab
.RS
Packit Service 3880ab
.EX
Packit Service 3880ab
# ip link add dummy0 type dummy
Packit Service 3880ab
# ip link set dummy0 up
Packit Service 3880ab
# tc qdisc add dev eth0 handle ffff: ingress
Packit Service 3880ab
# tc filter add dev eth0 parent ffff: protocol ip \\
Packit Service 3880ab
	u32 match ip protocol 1 0xff \\
Packit Service 3880ab
	action mirred egress mirror dev dummy0
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
Using an
Packit Service 3880ab
.B ifb
Packit Service 3880ab
interface, it is possible to send ingress traffic through an instance of
Packit Service 3880ab
.BR sfq :
Packit Service 3880ab
Packit Service 3880ab
.RS
Packit Service 3880ab
.EX
Packit Service 3880ab
# modprobe ifb
Packit Service 3880ab
# ip link set ifb0 up
Packit Service 3880ab
# tc qdisc add dev ifb0 root sfq
Packit Service 3880ab
# tc qdisc add dev eth0 handle ffff: ingress
Packit Service 3880ab
# tc filter add dev eth0 parent ffff: u32 \\
Packit Service 3880ab
	match u32 0 0 \\
Packit Service 3880ab
	action mirred egress redirect dev ifb0
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
.SH SEE ALSO
Packit Service 3880ab
.BR tc (8),
Packit Service 3880ab
.BR tc-u32 (8)