Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
testing:mirroring [2020/11/04 15:19] – biot | testing:mirroring [2020/11/09 13:18] (current) – biot | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | === Port mirroring === | + | ====== Port mirroring |
Port mirroring in Linux is currently only supported via the DSA framework, controlled by '' | Port mirroring in Linux is currently only supported via the DSA framework, controlled by '' | ||
Line 6: | Line 6: | ||
* The '' | * The '' | ||
* The following kernel schedulers/ | * The following kernel schedulers/ | ||
- | * cls_u32 | ||
* sch_ingress | * sch_ingress | ||
- | * sch_prio | + | * cls_matchall |
* act_mirred | * act_mirred | ||
Line 17: | Line 16: | ||
==== Commands ==== | ==== Commands ==== | ||
Turn on the mirror port: | Turn on the mirror port: | ||
- | < | + | |
- | # ip link set up dev p5 | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | [ | + | |
- | </ | + | |
- | + | ||
- | Create an ingress queue discipline: | + | |
- | tc qdisc add dev p2 handle ffff: ingress | + | |
- | Mirror all packets matching | + | Add the '' |
- | tc filter | + | tc qdisc add dev p2 clsact |
- | Create an egress queue discipline | + | Mirror all packets inbound on p2 ('' |
- | tc qdisc add dev p2 handle 1: root prio | + | tc filter |
- | Mirror all packets | + | Mirror all packets |
- | tc filter add dev p2 parent 1: protocol all u32 match u32 0 0 action mirred egress mirror dev p5 | + | tc filter add dev p2 egress matchall skip_sw |
- | ===== Pastable version | + | === Pastable version === |
< | < | ||
ip link set up dev p5 | ip link set up dev p5 | ||
- | tc qdisc add dev p2 handle ffff: ingress | + | tc qdisc add dev p2 clsact |
- | tc filter add dev p2 parent ffff: protocol all u32 match u32 0 0 action mirred egress mirror dev p5 | + | tc filter add dev p2 ingress matchall skip_sw |
- | tc qdisc add dev p2 handle 1: root prio | + | tc filter add dev p2 egress matchall skip_sw |
- | tc filter add dev p2 parent 1: protocol all u32 match u32 0 0 action mirred egress mirror dev p5 | + | |
</ | </ | ||