blob: fc8c141cca2941fe45d92227ac104c3a4272e08e [file] [log] [blame]
Jonas Berlinf33c4612005-04-01 06:54:23 +00001Match by how many bytes or packets a connection (or one of the two
Jan Engelhardt6cf172e2008-03-10 17:48:59 +01002flows constituting the connection) has transferred so far, or by
Jonas Berlinf33c4612005-04-01 06:54:23 +00003average bytes per packet.
4
5The counters are 64bit and are thus not expected to overflow ;)
6
7The primary use is to detect long-lived downloads and mark them to be
8scheduled using a lower priority band in traffic control.
9
Jan Engelhardt6cf172e2008-03-10 17:48:59 +010010The transferred bytes per connection can also be viewed through
Jonas Berlinf33c4612005-04-01 06:54:23 +000011/proc/net/ip_conntrack and accessed via ctnetlink
12.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010013[\fB!\fP] \fB\-\-connbytes\fP \fIfrom\fP[\fB:\fP\fIto\fP]
Jonas Berlinf33c4612005-04-01 06:54:23 +000014match packets from a connection whose packets/bytes/average packet
15size is more than FROM and less than TO bytes/packets. if TO is
16omitted only FROM check is done. "!" is used to match packets not
17falling in the range.
18.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010019\fB\-\-connbytes\-dir\fP {\fBoriginal\fP|\fBreply\fP|\fBboth\fP}
Jonas Berlinf33c4612005-04-01 06:54:23 +000020which packets to consider
21.TP
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010022\fB\-\-connbytes\-mode\fP {\fBpackets\fP|\fBbytes\fP|\fBavgpkt\fP}
Jonas Berlinf33c4612005-04-01 06:54:23 +000023whether to check the amount of packets, number of bytes transferred or
24the average size (in bytes) of all packets received so far. Note that
25when "both" is used together with "avgpkt", and data is going (mainly)
26only in one direction (for example HTTP), the average packet size will
27be about half of the actual data packets.
28.TP
29Example:
Jan Engelhardtfea74bf2009-01-12 04:53:18 +010030iptables .. \-m connbytes \-\-connbytes 10000:100000 \-\-connbytes\-dir both \-\-connbytes\-mode bytes ...