From: "Gavin" <gavin@raha.com>
To: lartc@vger.kernel.org
Subject: [LARTC] Managing downloads
Date: Thu, 21 Mar 2002 09:35:59 +0000 [thread overview]
Message-ID: <marc-lartc-101670733005257@msgid-missing> (raw)
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
Hello,
thanks for the help I've received here, I think I've cracked my problem. I
have a tiny (5MBit) satellite downlink to share between several thousand
clients, and I wanted to give higher paying clients more speed.
I tried WRR, but after three days meddling with kernels etc, gave up. The
attached script uses CBQ to do the following:
Create classes for various speeds (512Kbit -> 8Kbit), and assign IP
addresses to each class
Create a default class, limited to 2Mbit, which everyone else will share
equally (SFQ)
I've tested it quite a bit, and it seems to work. However, I really don't
know the details of tc etc, so it's possible that this is total rubbish. If
it is, could someone point this out?
Also, does anyone know a good way of filtering by MAC address, rather than
by IP address?
Gavin
[-- Attachment #2: dl-manage.sh --]
[-- Type: application/octet-stream, Size: 3748 bytes --]
#/bin/bash
#Q rules for internal interface - managing download (incoming) speed
#Delete root qdisc
tc qdisc del dev eth1 root
#Add root qdisc
tc qdisc add dev eth1 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 cell 8
#Classes: (One for each rate)
#Add root class, 5Mbit
tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate 5Mbit weight 0.5Mbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
#Add 512Kbit class - for mail. Isolated, so always guaranteed bandwidth ie. other classess cannot borrow B/W
tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth 100Mbit rate 512Kbit weight 51.2Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000 isolated
#Add 254Kbit class
tc class add dev eth1 parent 1:1 classid 1:4 cbq bandwidth 100Mbit rate 256Kbit weight 25.6Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
#Add 128Kbit class
tc class add dev eth1 parent 1:1 classid 1:5 cbq bandwidth 100Mbit rate 128Kbit weight 12.8Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
#Add 64Kbit class
tc class add dev eth1 parent 1:1 classid 1:6 cbq bandwidth 100Mbit rate 64Kbit weight 6.4Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
#Add 32Kbit class
tc class add dev eth1 parent 1:1 classid 1:7 cbq bandwidth 100Mbit rate 32Kbit weight 3.2Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
#Add 16Kbit class
tc class add dev eth1 parent 1:1 classid 1:8 cbq bandwidth 100Mbit rate 16Kbit weight 1.6Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
#Add 8Kbit class
tc class add dev eth1 parent 1:1 classid 1:9 cbq bandwidth 100Mbit rate 8Kbit weight 0.8Kbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000
#Add 2Mbit class - default for everyone, bounded. Any address in this range not specified above shares what's here.
tc class add dev eth1 parent 1:1 classid 1:10 cbq bandwidth 100Mbit rate 2Mbit weight 0.2Mbit prio 5 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded
#Qdiscs: (One for each class)
#Add qdisc for 512Kbit class
tc qdisc add dev eth1 parent 1:3 handle 30: sfq
#Add qdisc for 256Kbit class
tc qdisc add dev eth1 parent 1:4 handle 40: sfq
#Add qdisc for 128Kbit class
tc qdisc add dev eth1 parent 1:5 handle 50: sfq
#Add qdisc for 64Kbit class
tc qdisc add dev eth1 parent 1:6 handle 60: sfq
#Add qdisc for 32Kbit class
tc qdisc add dev eth1 parent 1:7 handle 70: sfq
#Add qdisc for 16Kbit class
tc qdisc add dev eth1 parent 1:8 handle 80: sfq
#Add qdisc for 8Kbit class
tc qdisc add dev eth1 parent 1:9 handle 90: sfq
#Add qdisc for 2Mbit class
tc qdisc add dev eth1 parent 1:10 handle 100: sfq
#Filters: (Match an IP to a rate)
#Add filter: 192.168.230.1 at 512Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.1 flowid 1:3
#Add filter: 192.168.230.2 at 256Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.2 flowid 1:4
#Add filter: 192.168.230.3 at 128Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.3 flowid 1:5
#Add filter: 192.168.230.4 at 64Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.4 flowid 1:6
#Add filter: 192.168.230.5 at 32Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.5 flowid 1:7
#Add filter: 192.168.230.6 at 16Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.6 flowid 1:8
#Add filter: 192.168.230.7 at 8Kbit
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.7 flowid 1:9
#Add filter: catch all
tc filter add dev eth1 parent 1:0 protocol ip prio 1 u32 match ip dst 192.168.230.0/24 flowid 1:10
exit 0
next reply other threads:[~2002-03-21 9:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-21 9:35 Gavin [this message]
2002-03-22 10:59 ` [LARTC] Managing downloads Sebastian 'spax' Pape
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-lartc-101670733005257@msgid-missing \
--to=gavin@raha.com \
--cc=lartc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.