Packet sample action in tc - Online Linux Manual PageSection : 8
Updated : 31 Jan 2017
Source : iproute2
Note : Linux
NAMEsample - packet sampling tc action
SYNOPSIStc ... action sample rate RATE group GROUP [ trunc SIZE ] [ index INDEX ] tc ... action sample index INDEX
DESCRIPTIONThe 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.
SAMPLED PACKETS METADATA FIELDSThe metadata are delivered to userspace applications using the psample generic netlink channel, where each sample includes the following netlink attributes: PSAMPLE_ATTR_IIFINDEX The input interface index of the packet, if there is one. PSAMPLE_ATTR_OIFINDEX The output interface index of the packet. This field is not relevant on ingress sampling PSAMPLE_ATTR_ORIGSIZE The size of the original packet (before truncation) PSAMPLE_ATTR_SAMPLE_GROUP The psample group the packet was sent to PSAMPLE_ATTR_GROUP_SEQ A sequence number of the sampled packet. This number is incremented with each sampled packet of the current psample group PSAMPLE_ATTR_SAMPLE_RATE The rate the packet was sampled with
OPTIONSrate RATE The packet sample rate. RATE" is the expected ratio between observed packets and sampled packets. For example, RATE" of 100 will lead to an average of one sampled packet out of every 100 observed. trunc SIZE Upon set, defines the maximum size of the sampled packets, and causes truncation if needed group GROUP The psample group the packet will be sent to. The psample module defines the concept of groups, which allows the user to match specific sampled packets in the case of multiple sampling rules, thus identify only the packets that came from a specific rule. index INDEX Is a unique ID for an action. When creating new action instance, this parameter allows one to set the new action index. When using existing action, this parameter allows one to specify the existing action index. The index must 32bit unsigned integer greater than zero.
EXAMPLESSample 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 19Use 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
SEE ALSOtc(8), tc-matchall(8) psample(1) 0
Johanes Gumabo
Data Size : 9,216 byte
man-tc-sample.8Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 237,769
Visitor ID : :
Visitor IP : 13.59.35.116 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.