Content-type: text/html; charset=UTF-8
tc qdisc add dev eth1 handle ffff: clsact
tc filter add dev eth1 ingress \
matchall skip_sw \
action mirred egress mirror \
dev eth2
The first command creates a clsact qdisc with handle ffff: on device eth1 where the second command attaches a matchall filters on it that mirrors the packets to device eth2 for ingress.
To create egress mirroring from port eth1 to port eth2:
tc qdisc add dev eth1 handle ffff: clsact
tc filter add dev eth1 egress \
matchall skip_sw \
action mirred egress mirror \
dev eth2
The first command creates a clsact qdisc with handle ffff: on device eth1 where the second command attaches a matchall filters on it that mirrors the packets to device eth2 for egress.
To sample one of every 100 packets flowing into interface eth0 to psample group 12:
tc qdisc add dev eth0 handle ffff: ingress
tc filter add dev eth0 parent ffff: matchall \
action sample rate 100 group 12