How can I limit downloads for each user?

I have a client who runs a boarding house (mostly for international students). There are 5 rooms and people stay there for 2-weeks to 2 years. She gives them 50GB of broadband download per month on a wireless connection but they often use all the quota by mid-month and then everyone staying there is throttled back to dial-up speed (this is a common for ISP plans in Australia). Ideally she wants a way to limit each user to a certain download per month (say 10GB each) and then throttle just that user to dial-up speed allowing the others in the house to still have broadband. Does anyone have any ideas how I could set this up?
LVL 1
onewheelhkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ultra_MasterCommented:
Hi,

Try the following code that allows you to download a file with a speed limit you specify :
// local file that should be send to the client
$local_file = 'file_to_download.zip';
// filename that the user gets as default
$download_file = 'your-download-name.zip';
 
// set the download rate limit (=> 20,5 kb/s)
$download_rate = 20.5; 
if(file_exists($local_file) && is_file($local_file)) {
    // send headers
    header('Cache-control: private');
    header('Content-Type: application/octet-stream'); 
    header('Content-Length: '.filesize($local_file));
    header('Content-Disposition: filename='.$download_file);
 
    // flush content
    flush();    
    // open file stream
    $file = fopen($local_file, "r");    
    while(!feof($file)) {
 
        // send the current file part to the browser
        print fread($file, round($download_rate * 1024));    
 
        // flush the content to the browser
        flush();
 
        // sleep one second
        sleep(1);    
    }    
 
    // close file stream
    fclose($file);}
else {
    die('Error: The file '.$local_file.' does not exist!');
}

Open in new window

0
onewheelhkAuthor Commented:
The users are using their own PCs so I think I'm looking for a router/firewall solution or software (maybe hotspot or internet cafe type software) that will be the best for this scenario.  From my reseach so far, it seems that routers don' t have the capability to set up user names and passwords for each user on a wireless network and then measure and throttle when appropriate. So I'm thinking that I'll have to put a PC with 2 network cards between the wireless LAN and the modem - but I'm wondering which software can do this.
0
Ultra_MasterCommented:
I thought of the client server issue.
As I can see this is more like actual Internet traffic usage oriented.
In this case, you can take a look at this:
http://sourceforge.net/apps/trac/ipcop/wiki
http://www.ipcop.org/1.4.0/en/admin/html/services.html#services_shaping

Good luck
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

onewheelhkAuthor Commented:
Thanks for those suggestions. But I want to give download quotas to each user and only shape the individual user if he/she exceeds that limit.  These tools only seem to be able to shape by protocol.
0
Ultra_MasterCommented:
Ok,
Then, I guess, this is the tool for you.
http://www.softperfect.com/products/bandwidth/

These are the specs:

Centralized configuration from a single network location.
Flexible, prioritized, bidirectional rules to specify maximum data rates.
Rules for IP addresses, protocols, ports (for TCP/IP) and network interfaces.
Transparency for end users.
No software installation is required on client workstations in most cases.
Detailed and comprehensive statistics are available for each rule.
Quotas and penalties to discourage misuse.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Scott ThomsonCommented:
Have you tried your isp. i have previously used optus and they have the ability to set i believe upto 5 user accounts which can specifically devide the download limits :)

im sure telstra would also have this functionality..

if you wanted to go a little on the crazy side you could use a proxy..?
0
Pierre FrançoisSenior consultantCommented:
With the "advanced proxy" addon (see: http://www.advproxy.net) of the IPCop firewall (see http://sourceforge.net/apps/trac/ipcop/wiki as Ultra Master told you), you can limit the download speed per host. There is no volume limit per host. So you will have to set the download speed manually once a specific user has exhausted his quota.
0
onewheelhkAuthor Commented:
Since there is no volume limit per host, how will we know when the specific user has exhausted his quota?
0
Pierre FrançoisSenior consultantCommented:
I expected that question... :D  You are right. I was looking for some addon doing that, but I only found an addon measuring the traffic on each interface, not for each host (Net-Traffic).

Well, there is a binary program called fetchipac that you can run from the crontab table and that collects information from the kernel about traffic on the several interfaces and stores it in a database. It can log the size, source and destination of each packet, and some other information. It is a part of the standard IPCop. Anyway, I see it is present in all my different configurations, in the directory /usr/sbin.

Sumarized data as recorded by fetchipac can be viewed by running ipacsum.

See http://martybugs.net/linux/ipac.cgi

Not trivial, but if you succeed, you can write an addon for IPCop in perl (just kidding, however...), inspired by net-traffic.

The beautiful thing with IPCop and ssh is that you can execute some commands remotely by issuing: ssh -P 222 hostname.remote.ipcop.box -l root "ipacsum options" from the command line of your local desktop.
0
onewheelhkAuthor Commented:
SoftPerfect looks really good  - apart from one thing. The users are defined by IP addresses or MAC addresses. My client wants to look after this herself - I think configuring MAC addresses for users would be time-consuming & error prone (remembers some guests only stay a few weeks, and students may want to use several devices) and IP addresses can be guessed (or even if I chose several random numbers, it does not take a lot of IT ability to ask to use your neighbor's laptop for a minute and find out the IP address they are using and use it yourself when that person is out of the house). Ideally, I want a solution with usernames and passwords....
0
Pierre FrançoisSenior consultantCommented:
I don't know SoftPerfect: it looks like software running on Windows clients.

If you use IPCop as firewall, you can disable the transparent proxy and enable authentication of users by username and password for controlling the http traffic through a proxy.

0
onewheelhkAuthor Commented:
Thanks for all your help but the IPCop solution looks a bit complex to set up and administer.  It would be OK if she had a full-time IT admin - but the client wants to administer this herself and does not know Linux and would prefer windows if possible.  This is the email that I sent her on this issue.


".... I initially thought it would be easy to find software to authenticate each user on the network and monitor their download volume –but unfortunately simple software to do this doesn’t seem to exist. I think the reason is that many countries (in particular the USA where much software is written) have unlimited download volumes from their ISPs and so do not have this problem.

Anyway this is a list of potential solutions – from cheap and simple to more expensive that you could try:

-      Your current connection speed has a theoretical speed of up to 10,000 Kbps but in reality is probably less than 2,000 Kbps (You can test your current speed at http://www.speedtest.net/ )  which after shaping  slows to 64Kbps.  Your ISP, Netspeed, has a plan which is unlimited but only 256Kbps for $79.95 per month. This is 4 times faster than you have been getting when shaped but admittedly a lot slower than before. However, this solution is the simplest as it only requires a phone call to your ISP.

The following solutions require a PC to be installed (around $500 for a new simple PC)

-      Softperfect Bandwidth Manager Software – US$99 per licence needs to be installed on a computer next to the modem. Almost does what you want, but it defines users by IP address (it would be fairly easy to guess or find out another person’s IP address) or MAC address (which is a little time-consuming and error-prone to configure). The lite version of this software US$35 could just measure the users’ downloads and you could (probably) see which person (s) are the ones using up all the usage and then ask them to stop doing so (or maybe pay more rent). More details at http://www.softperfect.com/products/bandwidth/ 

-      Anamedia hotspot software - US$200 per licence. Does most of what you need, except that it cannot shape the users down to a slower speed, it can only cut them off.  Also, sometime towards the end of the month you would need to access software to allow another month’s access.  This is geared for internet cafes/hotels which sell their services, so alternatively you could charge your guests usage by time or download amount. Eg Give them 8GB free, then charge them $10 for a further 3GB (this would still be within your plan but would make them think twice about downloading so much.) More details at http://www.antamedia.com/hotspot/ 

You can advise your guests that they can measure their own downloads with software like Netmeter (http://www.softpedia.com/get/Network-Tools/Bandwidth-Tools/NetMeter.shtml).

My recommendation would be to try the slower plan first and see if that speed is acceptable to your guests (256kbps is not too bad – a few years ago it would have been considered fast). But I’m happy to help you implement the other solutions too if you want, just let me know,

Roz

0
onewheelhkAuthor Commented:
I appreciate all your help so I've divided the points between you even though no solution was perfect for me this time. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking Hardware-Other

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.