Skip to contentSkip to conversation

Limit bandwidth per client

LARTC Stuart Mackintosh 4 participants 4 messages May 12, 2003 – May 13, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,

I have an installation where each user on subnet 192.168.1.0/24 is connected via a multiplexer.
The problem is that if any client uses more than about 48Kb/s, the multiplexer crashes.

I need to limit each client to under this rate, say 32Kb/s. I have seen examples on creating a class per host but is there a simple way of saying "any host from 192.168.1.0/24" so I dont have 253 rules?

Many thanks.

stuart

Signature · 7 lines
 | http://www.opusvl.com 
 | T: 08717 50 40 02
 | F: 08717 50 40 03
 | E: [email protected] 
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#1 lore raw

~From: Stuart Mackintosh <[email protected]>
~Date: 12 May 2003 17:08:10 +0100
~Subject: [LARTC] Limit bandwidth per client

~Hi all,

~I have an installation where each user on subnet 192.168.1.0/24 is ~connected via a multiplexer.
~The problem is that if any client uses more than about 48Kb/s, the ~multiplexer crashes.

~I need to limit each client to under this rate, say 32Kb/s. I have ~seen
~examples on creating a class per host but is there a simple way of ~saying "any host from 192.168.1.0/24" so I dont have 253 rules?

Yeah, I think I can answer this :-).

Upload mark
iptables -t mangle -A FORWARD -s 192.168.0.0/24 -j MARK --set-mark 4 Download mark
iptables -t mangle -A POSTROUTING -s ! 192.168.0.0/24 -d 192.168.0.0/24 -j MARK --set-mark 5

Then if you are using htb: just make your root qdisk, classes, filters, and then the qdisk.

James

~Many thanks.

~stuart

~--

~ | http://www.opusvl.com 
~ | T: 08717 50 40 02
~ | F: 08717 50 40 03
~ | E: [email protected] 

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#2 lore raw
In reply to Stuart Mackintosh

That is the best, detailed, straight-forward howto on tc I've ever seen! (There are probablly others out there, and no offense to authors of any that I just haven't seen). Thanks!

I have been off and on trying to get my squid transparent proxy/cache server to do tc for me, but it just doesn't seem to work, and I wonder if you can offer any advice.

My network looks just like you've described below, except that your 'router1' is my 'transparent cache', running as a bridge, where eth0 and eth1 are bridge interfaces (br0).

I am beginning to draw the conclusion that I cannot do tc with a bridge, and that I must route. Do you have any suggestions?

Thanks,
dave

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stuart Mackintosh
Sent: Monday, May 12, 2003 10:08 AM
To: [email protected]
Subject: [LARTC] Limit bandwidth per client

Hi all,

I have an installation where each user on subnet 192.168.1.0/24 is connected via a multiplexer.
The problem is that if any client uses more than about 48Kb/s, the multiplexer crashes.

I need to limit each client to under this rate, say 32Kb/s. I have seen examples on creating a class per host but is there a simple way of saying "any host from 192.168.1.0/24" so I dont have 253 rules?

Many thanks.

stuart

Signature · 11 lines
 | http://www.opusvl.com 
 | T: 08717 50 40 02
 | F: 08717 50 40 03
 | E: [email protected] 
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#3 lore raw
In reply to Stuart Mackintosh
Quoted 7 lines · David Reoch

That is the best, detailed, straight-forward howto on tc I've ever seen! (There are probablly others out there, and no offense to authors of any that I just haven't seen). Thanks!

I have been off and on trying to get my squid transparent proxy/cache server to do tc for me, but it just doesn't seem to work, and I wonder if you can offer any advice.

The problem is that squid is a local running app. And tc does not know if sqiud is using it's cache to server the objects. Ideally, you should be able to mark the packets within squid like you can with iptables.

Quoted 6 lines

My network looks just like you've described below, except that your 'router1' is my 'transparent cache', running as a bridge, where eth0 and eth1 are bridge interfaces (br0).

I am beginning to draw the conclusion that I cannot do tc with a bridge, and that I must route. Do you have any suggestions?

Shaping on a bridge is possible. If you use the u32 filter, you can get in some trouble that can be solve with a kernel patch :
http://www.docum.org/stef.coene/qos/faq/cache/41.html

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/