Packet sample action in tc(8) | Linux | Packet sample action in tc(8) |
sample - packet sampling tc action
tc ... action sample rate RATE group GROUP [ trunc SIZE ] [ index INDEX ]
tc ... action sample index INDEX
The sample action allows sampling packets matching classifier.
The packets are chosen randomly according to the rate parameter, and are sampled using the psample generic netlink channel. The user can also specify packet truncation to save user-kernel traffic. Each sample includes some informative metadata about the original packet, which is sent using netlink attributes, alongside the original packet data.
The user can either specify the sample action parameters as presented in the first form above, or use an existing sample action using its index, as presented in the second form.
The metadata are delivered to userspace applications using the psample generic netlink channel, where each sample includes the following netlink attributes:
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 index 19
Use the same action instance to sample eth1 too:
tc qdisc add dev eth1 handle ffff: ingress tc filter add dev eth1 parent ffff: matchall \
action sample index 19
31 Jan 2017 | iproute2 |