Help - Search - Members - Calendar
Full Version: HOWTO: Enable and use mod_bandwidth on Ensim 3.1.x and Ensim 3.5.x
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
oxiegen
I wanted to install and use mod_bandwidth on my Ensim machine because a few of my customers wanted to limit their outbound bandwidth site wide to save costs.

I looked it up and found that the installation was very simple. However, with Ensim it's even simpler. icon_smile.gif

This is my first HOWTO. If anything is wrong please correct me. icon_smile.gif


1. Login to your box using SSH2 and su to root.

2. Make a backup of your existing httpd_app.conf file. Just in case.

3. Edit the httpd_app.conf file using your favourite editor. I personally like pico.

pico –w /etc/httpd/conf/httpd_app.conf

4. Look for the following line:

#LoadModule bandwidth_module modules/mod_bandwidth.so

uncomment it so it looks like:

LoadModule bandwidth_module modules/mod_bandwidth.so

5. Look for the following line:

#AddModule mod_bandwidth.c

uncomment it so it looks like:

AddModule mod_bandwidth.c

6. Save the changes and exit the editor.

7. Restart the apache webserver. Make sure everything is okay. If not, restore your httpd_app.conf file to how it was before.

/sbin/service httpd restart

8. You now have mod_bandwidth enabled and ready to use. To use mod_bandwidth on one site open it’s configuration file. Each site has it’s own, simply edit the corresponding sites config file using your favourite editor. I’m using site1 as an example. Remember to back up first! icon_smile.gif

pico –w /etc/httpd/conf/virtual/site1

9. Look for the following:


Allow from all
AllowOverride All
Order allow,deny



Change it so it looks like:


Allow from all
AllowOverride All
Order allow,deny
BandWidthModule On
BandWidth all 20480



Change the number 20480 to whatever you want to limit the sites overall bandwidth to. That number is in bytes/s.

http://oxiegen.net/mods/bandwidth/convert.php << Here you can convert kbits/s into bytes/s if you are a little confused. It has saved me loads of time.

10. Restart apache again and make sure everything is okay.

/sbin/service httpd restart

11. Remember that this modification will be lost when Ensim upgrades apache, if you upgrade to Ensim 3.5 or if you change settings of this site in the control panel and save. Keep a backup. icon_smile.gif

Anyway, hope this helps. It certainly helped me. icon_smile.gif

For more configuration information on mod_bandwidth go to: http://www.cohprog.com/v3/bandwidth/intro-en.html

Dave.
oxiegen
You can download a copy of this HOWTO in PDF format below:

http://oxiegen.net/mods/bandwidth/mod_bandwidth.pdf

Dave
byronm
Thanks for the nice & easy howto! I have several customers who will be happy they can throttle service.

works like a charm!

I'll have to see how it handles under load though.
whiplashdomain
QUOTE
11. Remember that this modification will be lost when Ensim upgrades apache, if you upgrade to Ensim 3.5 or if you change settings of this site in the control panel and save. Keep a backup.


What would need to be done to make this a permanent change?
wsjb78
To make it permanent you could add this to /etc/httpd/conf/httpd_app.conf


Allow from all
AllowOverride All
Order allow,deny
BandWidthModule On
BandWidth all 20480


that should work!
mouse
QUOTE
Originally posted by wsjb78
To make it permanent you could add this to /etc/httpd/conf/httpd_app.conf


Allow from all
AllowOverride All
Order allow,deny
BandWidthModule On
BandWidth all 20480


that should work!


another option is to make a file
/etc/httpd/conf/site1/bandwidth
and post the above content in it
then restart httpd
this will be a permanant file..
the advtantage here is it will get deleted if you delete the site and not cause issues by being left behind in the httpd_app.conf..
Mouse
wsjb78
Thx for the add-on mouse. I wouldn't have thought of the consequences!
i2umi
QUOTE
Originally posted by oxiegen
You can download a copy of this HOWTO in PDF format below:

http://oxiegen.net/mods/bandwidth/mod_bandwidth.pdf  

Dave


I can't access your site for this file anymore, is it possible to put it up again? the convert.php too.

I'm not really sure if i've applied the right bandwidth limit for the site..

Additionally, how much kbps is
BandWidth all 20480?

Thanks.
Rocket_Cowboy
I used this how-to earlier this week to enable mod_bandwidth on a site that I host. Once thing I noticed ... the documentation on mod_bandwidth describes a "MaxConnections" parameter for limiting the number of simultaneous connections to files in a particular directory, however, when I tried to use this, apache gives an error that "MaxConnections" is either spelled incorrectly, or is not defined in an active module. Since the bandwidth limiting is working, I'm assuming that for whatever reason the maxconnections feature was removed.

Any ideas?
oxiegen
Sorry about the missing links. The convert.php script has been reuploaded and so has an updated version of the PDF document. The updated PDF document includes Mouse's suggestion which I highly recommend!

You can check out the source code of convert.php here: http://oxiegen.net/mods/bandwidth/convert.phps. It's simple but maybe it will help you guys figure out how I got the results. icon_smile.gif
ShdwMastr
Is it possible to apply this globally? or just update each site with a "bandwidth" file.. and have this file created with the creation of each new site?
oxiegen
I suppose so, maybe placing:


BandWidthModule On
BandWidth all 20480


In the /etc/httpd/conf/httpd_app.conf file would do it? But this would place a limit of 20480 bytes/s on ALL the sites, but not individually.

If you want it individually you would have to create seperate bandwidth files like you said.
i2umi
Hmm... The bandwidth module once loaded, it seems to 'break' squirrelmail?

Its like, once its loaded, squirrelmail with the correct passwords etc are unable to login, it just keeping on looping at the login screen?
i2umi
Hmm.. the mod_bandwidth module don't seems to work?

I lowered the BandWidth all to 8 and still don't see any effect?

Anyone can enlighten me? The modules was loaded on httpd_app.conf
i2umi
QUOTE
Originally posted by i2umi
Hmm.. the mod_bandwidth module don't seems to work?

I lowered the BandWidth all to 8 and still don't see any effect?

Anyone can enlighten me? The modules was loaded on httpd_app.conf


Anyone there to answer my above question?
oxiegen
QUOTE
Originally posted by i2umi
Anyone there to answer my above question?


Can you describe exactly what you have done? The little bit of info you gave is not enough. Thanks!
i2umi
QUOTE
Originally posted by oxiegen
Can you describe exactly what you have done?  The little bit of info you gave is not enough.  Thanks!


Followed every detail of the instructions, but yet it don't seems bandwidth limiting anything.

I cannot even see the mod_bandwidth listed in the Apache Status eventhough its loaded.
ShaneS
I have a question...what exactly happens when they reach the limit? Can you specify a default page to be shown or does it just give you like a 403 error?
jameztcc
I am not sure how this is different compared to the bandwidth limiting feature in ENSIM, 3.1.x.

Any advice?
Thanks.
amp3dmoshpit
QUOTE
Originally posted by i2umi
Hmm.. the mod_bandwidth module don't seems to work?

I lowered the BandWidth all to 8 and still don't see any effect?

Anyone can enlighten me? The modules was loaded on httpd_app.conf


I'm having the same problem. Module loaded but not limiting bandwidth. Any suggestions?
sander815
[QUOTE]Originally posted by oxiegen


[B]
Allow from all
AllowOverride All
Order allow,deny
BandWidthModule On
BandWidth all 20480



Change the number 20480 to whatever you want to limit the sites overall bandwidth to. That number is in bytes/s.


whatever i change, i can only go lower then 100 kb/s. If i set f.i. 262144 bytes/s (BandWidth all 262144), 2048 kbit/sec, my dlspeed caps at 100 kb/s, same for higher numbers

only BandWidth all 0, gets me full speed again
whats wrong?
instantnet
Not to clear onthe MaxConnection command.

Will that limit the number of onnectins per ip (which I want to do)
or the number of the connections for the site?

Anyonw know how to get the first?

Thanks
instantnet
EDIT: I dont see the module that the instructions refer to in the folder of existing modules.

This most likey does not work for apache 2.0

It too does not seem to be working for me. I supposeit is something I did or did not do. Bandwidth usage is still about 8MBps
absolut
instantnet, you can obtain module from http://www.cohprog.com/v3/bandwidth/download-en.html and than compile it. The help file is available.
mizator
The solution is to crete the directories

/tmp/apachebw
/tmp/apachebw/master
/tmp/apachebw/link

and set them all to chmod 777

That made the limits start to work!


This was on a Ensim 3.1 server, Yes, I a, still running that one icon_sad.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.