Addon Module: mod_bandwidth

C

cPanelBilly

Guest
What is Mod_Bandwidth?
"Mod_bandwidth" is a module for the Apache webserver that enable the setting of server-wide or per connection bandwidth limits, based on the directory, size of files and remote IP/domain.
How do I enable it for a domain
In root shell type: /scripts/setbwlimit then follow the instructions (remember you are setting the limit based on bytes per second so 1024 = 1kb sec and that is to all users)

Where can I read more about it?
http://www.cohprog.com/mod_bandwidth.html
 

anup123

Well-Known Member
Mar 29, 2004
889
1
168
This Planet
Hi.

Can this be done from WHM ... perhaps a Feature Request. Long back i had been on WireX Immunix and their control panel had this feature of defining/editing the Bandwidth Limits during Account Setup/Editing Later on.

If this could be done as a Part of Account Functions, in WHM, it would be good.

Anup
 

hfweb

Registered
Apr 30, 2004
3
0
151
how do i limit maximum sconnections of an ip with this, these download managers are killing me!
 

kalnet4u

Member
Jul 8, 2003
24
0
156
Plymouth, UK
I have installed the bandwidth module, which went smoothly. I also went in to SSH and followed the instructions.

I also, just to make sure everything is ok, restarted apache for good luck and touched wood (yes I am a novice, lol)

I can see the entries added into httpd.conf, it looks ok? I have tried it on a shared IP domain and also a dedicated IP domain. I have restarted apache several times.

IT DOES NOT WORK!

Please can someone tell me what is going wrong.

Many Thanks
Kev
 
C

cPanelBilly

Guest
kalnet4u said:
I have installed the bandwidth module, which went smoothly. I also went in to SSH and followed the instructions.

I also, just to make sure everything is ok, restarted apache for good luck and touched wood (yes I am a novice, lol)

I can see the entries added into httpd.conf, it looks ok? I have tried it on a shared IP domain and also a dedicated IP domain. I have restarted apache several times.

IT DOES NOT WORK!

Please can someone tell me what is going wrong.

Many Thanks
Kev
Please expalin what you mean, We have done test showing it does work internally, but if there is an issue I need a way to replicate it.
 

kalnet4u

Member
Jul 8, 2003
24
0
156
Plymouth, UK
Hi,

I installed it through “Addon Modules” in WHM.

I received the successful installed messages, telling me to go in to SSH to enable it on domains.

Went in to SSH, typed in the command. Was requested for the domain name, entered it, then the speed, I typed in 1024, to ensure I would notice a BIG difference.
Confirmation message saying it had been added.

Tried the domain, still as fast as before, well over 1k. I tried restarting Apache, still the same result. I also tried it on another domain, however with the same result, absolutely no reduction in speed.

I looked in HTTPD.CONF, new entries had been entered in for the domains and for the module. I have no idea what I am doing wrong, I have followed the instructions carefully.

Many thanks for your help.

Warm Regards
Kevin
 

kalnet4u

Member
Jul 8, 2003
24
0
156
Plymouth, UK
Hi,

Before I start messing with the system again, could it be that because I have GZip compression installed (through apache Upgrade in WHM), it is somehow disabling its affects?

Thanks
 

kalnet4u

Member
Jul 8, 2003
24
0
156
Plymouth, UK
Hi Everyone,

Many of you now probably think I am mad, seemingly having a conversation with myself, since CPanel now seem to have gone quiet. However this may not have been in vain, since I have solved the problem.

chown nobody:nobody -R /var/cpanel/apachebw

All I needed to do is type the command in above, simple! A permission error!

I also needed to make a couple of amendments in httpd.conf also, to make it work. The first being the addition of “BandWidthModule On”.

Also the auto set-up script of bandwidth seems to add the wrong code. It does indeed add some code just before the </virtualhost>, however it doesn’t do anything. Anyway I am manually adding in the restrictions for the time being, only being a couple of accounts, not a huge problem.

Some of you may find this guide an interesting read too, this is what helped me solve my problem.

http://www.crucialparadigm.com/reso...mod_bandwidth-apache-untilization-control.php

CPanel, if you want an in depth guide to what went wrong, please do not hesitate to e-mail me.
 
C

cPanelBilly

Guest
kalnet4u said:
Hi Everyone,

Many of you now probably think I am mad, seemingly having a conversation with myself, since CPanel now seem to have gone quiet. However this may not have been in vain, since I have solved the problem.

chown nobody:nobody -R /var/cpanel/apachebw

All I needed to do is type the command in above, simple! A permission error!

I also needed to make a couple of amendments in httpd.conf also, to make it work. The first being the addition of “BandWidthModule On”.

Also the auto set-up script of bandwidth seems to add the wrong code. It does indeed add some code just before the </virtualhost>, however it doesn’t do anything. Anyway I am manually adding in the restrictions for the time being, only being a couple of accounts, not a huge problem.

Some of you may find this guide an interesting read too, this is what helped me solve my problem.

http://www.crucialparadigm.com/reso...mod_bandwidth-apache-untilization-control.php

CPanel, if you want an in depth guide to what went wrong, please do not hesitate to e-mail me.
Thanks for the fix, it is still beta and issues can arrise :)
This is actually already in the install script, do you know what the permissions were before?
btw we were not ignoring you, all development staff had to work on an exploit that was released to the public before released to us.
 

stratagem

Member
Jul 10, 2003
19
0
151
cPanelBilly said:
This is actually already in the install script, do you know what the permissions were before?
Tried installing it an hour ago.
- The shell script does not add 'BandWidthModule On'
- The proper directories are added, and referenced in httpd.conf, but have root ownership

Inserting the mentioned directive per virtual host and setting the ownership of the temp dir to nobody gets things running. You can also just turn it on outside a virtual host and it stays on.
- Needs a(n easy) method of setting a redirect page when max connections are reached.
- Easy to work around, from an account holder view, without further apache restrictions

whm v9.9.3, cp v9.9.6r10, mod_bandwidth addon v2.0.4-0.7
 

Norman

Well-Known Member
Sep 20, 2004
88
0
156
Billy,

Here are what my perms were before chowning them as stated above:
Code:
drwxr-xr-x    4 root     root         4.0K Sep 27 10:39 apachebw/
 

EDevil

Member
Feb 17, 2004
21
0
151
Last time I checked, no. The dir was still created with the wrong permissions.

This was about 2 weeks ago.
 

bmuthig

Member
PartnerNOC
Feb 15, 2004
22
0
151
Ann Arbor, MI
cPanel Access Level
DataCenter Provider
Script is still broken... EXAMPLE USAGE INCLUDED!

FYI to anybody looking for this. The script still seems broken. Would suggest adding manually ... for example within the virthost you want to put in:

<IfModule mod_bandwidth.c>
BandWidthModule On
<Directory "/home/xxxxxx/public_html">
# BandWidth all 30720
LargeFileLimit 1024 61440
</Directory>
</IfModule>

http://www.cohprog.com/v3/bandwidth/doc-en.html

For all the options...

LargeFileLimit is a good one to keep people from sucking all the bandwidth when people are downloading huge files.... I DID notice though the LargeFileLimit bandwidth rate seems to be only about half of what you put there. I had to compensate to get it to work right. Not sure why... pipe in if you know!
 

kalnet4u

Member
Jul 8, 2003
24
0
156
Plymouth, UK
Hi bmuthig,

We have had exactly the same problems with the bandwidth acting strangely. Although we compensated to begin with, you will find if you start two downloads going at the same time, it will complete throw that theory right out of the window.

We added the “BandWidthPulse” command, set to 1 second, this seems to have solved the problem.

<IfModule mod_bandwidth.c>
<Directory /home/xxxxxxxx/public_html>
BandWidthModule On
BandWidth all 30720
BandWidthPulse 1000000
</Directory>
</IfModule>

Bye!