Manage Apache Download Speed And Traffic Limits With mod_cband

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Wed, 2006-05-31 21:03. :: Apache

Manage Apache Download Speed And Traffic Limits With mod_cband

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 05/29/2006

In this tutorial I will describe how to install and configure mod_cband on an Apache2 web server. mod_cband is an Apache 2 module which provides bandwidth quota and throttling. It solves the problem of limiting users' and virtualhosts' bandwidth usage. The current version can set virtualhosts' and users' bandwidth quotas, maximal download speed, requests-per-second speed and the maximal number of simultanous IP connections.

mod_cband can be used by hosting companies, which would like to limit data transfer for their users, such as "10 GB of traffic per month".

In the first two chapters I will show how to install mod_cband on Debian Sarge and on Fedora Core 5 (the 64-bit version), and in the third chapter I will describe how to configure Apache for mod_cband which is independent from the distribution you're using.

Please note: mod_cband is an Apache2 module, it does not work with Apache 1.3.x!

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

1 Installation On Debian Sarge

In order to compile mod_cband, we must have apxs2 installed. We can achieve that by doing this:

apt-get install apache2-prefork-dev

Next we download and install mod_cband like this:

cd /tmp
wget http://cband.linux.pl/download/mod-cband-0.9.7.4.tgz
tar xzvf mod-cband-0.9.7.4.tgz
cd mod-cband-0.9.7.4
./configure
make
make install

The make install command should have added the mod_cband module to /etc/apache2/httpd.conf. Run

vi /etc/apache2/httpd.conf

and check if you find a line like this:

LoadModule cband_module       /usr/lib/apache2/modules/mod_cband.so

(If you don't find this line, add it yourself.)

Finallly restart Apache:

/etc/init.d/apache2 restart

The mod_cband installation is now finished.

2 Installation On Fedora Core 5

In order to compile mod_cband, we must have apxs installed. We can achieve that by doing this:

yum install httpd-devel

Next we download and install mod_cband like this:

cd /tmp
wget http://cband.linux.pl/download/mod-cband-0.9.7.4.tgz
tar xzvf mod-cband-0.9.7.4.tgz
cd mod-cband-0.9.7.4
./configure
make
make install

The make install command should have added the mod_cband module to /etc/httpd/conf/httpd.conf. Run

vi /etc/httpd/conf/httpd.conf

and check if you find a line like this:

LoadModule cband_module       /usr/lib64/httpd/modules/mod_cband.so

(If you don't find this line, add it yourself.)

Finallly restart Apache:

/etc/init.d/httpd restart

The mod_cband installation is now finished.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Mon, 2011-08-08 06:06.
how to install mod_cband on windows 7?
Submitted by bahram (not registered) on Fri, 2011-01-07 11:53.
hello, is there anyway to do global limitation for all accounts at once? I have about 500 account and I can not add limitation entry one by one.
Submitted by Anonymous (not registered) on Fri, 2006-06-02 14:34.
Considering the majority of Apache installations are still using Apache 1.X, it's a shame that mod_cband isn't also available for Apache 1.X. I guess that the output filtering functionality of Apache 2.X (far superior to 1.X's) has caused this - one "workaround" might be to put an Apache 2.X reverse proxy in front of your (now backend) Apache 1.X server...
Submitted by Anonymous (not registered) on Sat, 2006-06-03 21:10.
mod_throttle
Submitted by Anonymous (not registered) on Thu, 2006-06-01 23:29.

There is also a package for mod_cband in Fedora. Just install it with:

yum install mod_cband

Submitted by Paki (not registered) on Fri, 2011-02-18 22:32.
ThEnX! 
Submitted by Anonymous (not registered) on Thu, 2006-06-01 16:42.
The cband Apache2 module is available from Debian's package sources if you are running testing (etch) or unstable (sid). apt-get install libapache2-mod-cband
Submitted by Anonymous (not registered) on Wed, 2006-06-07 21:54.

libapache2-mod-cband is on backports.org for sarge.

You do not need to recompile.

Submitted by Anonymous (not registered) on Thu, 2008-10-02 00:29.

I have a test Apache 2.2 server on Windows 2003, is it poddible to get mod_cband to work on it?