aabc / ipt-ratelimit

An implementation of committed access rate, or simply rate limiting, or policing for Linux iptables, implemented with high performance in mind.
https://github.com/aabc/ipt-ratelimit
77 stars 32 forks source link
car iptables linux policing traffic

ipt-ratelimit linux kernel module by abc@openwall.com -- (c) 2015-2020.

An high-performance implementation of committed access rate, or simply rate limiting, or policing for Linux iptables. Suitable for a lot of users (similar to ipset) and does not have qdisc limitations. Supports IPv6.

Official project homepage @ https://github.com/aabc/ipt-ratelimit

============ = ABSTRACT =

ipt-ratelimit module implements traffic policing (i.e. limiting traffic bit rate) using, standard for this purpose, token bucket filter (TBF) algorithm. Particular implementation is based on FreeBSD's implementation of Cisco's TBF with extended burst value (which is used to implement RED-like drop behavior).

Module is compatible with recent linux distributions such as Debian 7, 8, Centos 7, and Linux kernel 3.x or above.

Does support IPv6, thus useful for dual-stack policing.

================ = INSTALLATION =

Three easy steps:

** 1. Prepare Kernel source for module compilation

What to do for Debian and Ubuntu:

  sudo# apt-get install module-assistant
  sudo# m-a prepare

** 2. Prepare Iptables

What to do for Debian or Ubuntu:

  sudo# apt-get install iptables-dev pkg-config

** 3. Now, to actually build the module run:

  ~/ipt-ratelimit# make all install
  ~/ipt-ratelimit# depmod

=========== = USAGE =

===========