LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] throttle control

[ILUG] throttle control

Dermot Buckley derbuck at eircom.net
Tue Nov 27 19:32:45 GMT 2001


>   Anyone know how to get "tc" to do something like;
>     Stop port 80 traffic using more than 70% of bandwidth
>

Never really understood tc properly, but something along the lines of the
following should serve the purpose.

Firstly, mark every packet that you want throttled (i.e. everything not from
the lan which came from port 80).  With ipchains this would go something
like

	mylan=192.168.1.0/24
	ipchains -A output -i eth0 -s ! $mylan 80 -d $mylan -m 1

where eth0 is your internal interface (you can only control the output of an
interface - so this is where you catch the web traffic)

Now, say that eth0 is a 100Mbit card, your internet connection is 128kbit
and you want to limit the marked traffic to 96kbit (75%).

	tc qdisc add dev eth0 root handle 10: cbq bandwidth 100Mbit avpkt 1000
	tc class add dev eth0 parent 10:0 classid 10:1 cbq bandwidth 100Mbit rate
128kbit \
		allot 1514 weight 13kbit prio 8 maxburst 20 avpkt 1000

Note the 'bounded' in the next line (traffic in this class cannot exceed
this rate)

	tc class add dev eth0 parent 10:1 classid 10:100 cbq bandwidth 100Mbit rate
96kbit \
		allot 1514 weight 10kbit prio 5 maxburst 20 avpkt 1000 bounded
	tc qdisc add dev eth0 parent 10:100 sfq quantum 1514b perturb 15

Now send all the marked packets through the queue

	tc filter add dev eth0 parent 10:0 protocol ip prio 25 handle 1 fw classid
10:100


I'm not 100% on what all the values do :), but this does work (we use
something similar to throttle downloads).

And when you change your mind and decide you need the extra bandwidth to
download debian 2.2r4 :)

	tc qdisc del dev eth0 root


Would be interested myself in hearing from anyone who knows a bit more about
this stuff,

Dermot.






More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell