1Policing action in tc(8) Linux Policing action in tc(8)
2
3
4
6 police - policing action
7
9 tc ... action police rate RATE burst BYTES[/BYTES] [ mtu BYTES[/BYTES]
10 ] [ peakrate RATE ] [ overhead BYTES ] [ linklayer TYPE ] [
11 CONTROL ]
12
13 tc ... filter ... [ estimator SAMPLE AVERAGE ] action police avrate
14 RATE [ CONTROL ]
15
16 CONTROL := conform-exceed EXCEEDACT[/NOTEXCEEDACT
17
18 EXCEEDACT/NOTEXCEEDACT := { pipe | ok | reclassify | drop | continue }
19
21 The police action allows to limit bandwidth of traffic matched by the
22 filter it is attached to. Basically there are two different algorithms
23 available to measure the packet rate: The first one uses an internal
24 dual token bucket and is configured using the rate, burst, mtu,
25 peakrate, overhead and linklayer parameters. The second one uses an in-
26 kernel sampling mechanism. It can be fine-tuned using the estimator
27 filter parameter.
28
30 rate RATE
31 The maximum traffic rate of packets passing this action. Those
32 exceeding it will be treated as defined by the conform-exceed
33 option.
34
35 burst BYTES[/BYTES]
36 Set the maximum allowed burst in bytes, optionally followed by a
37 slash ('/') sign and cell size which must be a power of 2.
38
39 mtu BYTES[/BYTES]
40 This is the maximum packet size handled by the policer (larger
41 ones will be handled like they exceeded the configured rate).
42 Setting this value correctly will improve the scheduler's preci‐
43 sion. Value formatting is identical to burst above. Defaults to
44 unlimited.
45
46 peakrate RATE
47 Set the maximum bucket depletion rate, exceeding rate.
48
49 avrate RATE
50 Make use of an in-kernel bandwidth rate estimator and match the
51 given RATE against it.
52
53 overhead BYTES
54 Account for protocol overhead of encapsulating output devices
55 when computing rate and peakrate.
56
57 linklayer TYPE
58 Specify the link layer type. TYPE may be one of ethernet (the
59 default), atm or adsl (which are synonyms). It is used to align
60 the precomputed rate tables to ATM cell sizes, for ethernet no
61 action is taken.
62
63 estimator SAMPLE AVERAGE
64 Fine-tune the in-kernel packet rate estimator. SAMPLE and AVER‐
65 AGE are time values and control the frequency in which samples
66 are taken and over what timespan an average is built.
67
68 conform-exceed EXCEEDACT[/NOTEXCEEDACT]
69 Define how to handle packets which exceed or conform the config‐
70 ured bandwidth limit. Possible values are:
71
72 continue
73 Don't do anything, just continue with the next action in
74 line.
75
76 drop Drop the packet immediately.
77
78 shot This is a synonym to drop.
79
80 ok Accept the packet. This is the default for conforming
81 packets.
82
83 pass This is a synonym to ok.
84
85 reclassify
86 Treat the packet as non-matching to the filter this
87 action is attached to and continue with the next filter
88 in line (if any). This is the default for exceeding pack‐
89 ets.
90
91 pipe Pass the packet to the next action in line.
92
94 A typical application of the police action is to enforce ingress traf‐
95 fic rate by dropping exceeding packets. Although better done on the
96 sender's side, especially in scenarios with lack of peer control (e.g.
97 with dial-up providers) this is often the best one can do in order to
98 keep latencies low under high load. The following establishes input
99 bandwidth policing to 1mbit/s using the ingress qdisc and u32 filter:
100
101 # tc qdisc add dev eth0 handle ffff: ingress
102 # tc filter add dev eth0 parent ffff: u32 \
103 match u32 0 0 \
104 police rate 1mbit burst 100k
105
106 As an action can not live on it's own, there always has to be a filter
107 involved as link between qdisc and action. The example above uses u32
108 for that, which is configured to effectively match any packet (passing
109 it to the police action thereby).
110
111
113 tc(8)
114
115
116
117iproute2 20 Jan 2015 Policing action in tc(8)