[Gllug] Bandwidth quotas

Simon Stewart sms at lateral.net
Thu Mar 7 18:52:35 UTC 2002


On Thu, Mar 07, 2002 at 05:33:46PM +0000, Dylan Brewis wrote:
> Hi guys,
> 
> Is it possible to limit the maximum percentage of bandwidth available to a 
> client or group of clients? I'm thinking 30-50% shared by 3 machines in day 
> to day use for surfing, leaving 50-70% to one machine for 'serious' use.

Did this just the other day. Take a look for the "linux advanced
routing and traffic control howto" at http://www.ds9a.nl/lartc (from
my print out)

If you have the luxury, multi-home the routing PCs internal interface,
and split the machines into two categories (the "browser" and the
"workers", if you'd like) You'll need to set the default route on each
group to point to a different address on the multihomed host.

eg.

On the router

# ip address add 192.168.1.2 dev eth0  # This is for browsing
# ip address add 192.168.1.3 dev eth0  # This is for working

# tc qdisc add dev eth0 root handle 1: cbq bandwidth 2MBit cell 8 \ 
  avpkt 1000 mpu 64

Set the "bandwidth" attribute to match the amount of OUTGOING
bandwidth you have. The rates assuming a total outgoing bandwidth of
2048 kbps

# tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 2MBit \
  rate 700kbit avpkt 1000 prio 5 bounded isolated allot 1514 weight 1 maxburst 20
# tc class add dev eth0 parent 1:0 classid 1:2 cbq bandwidth 2MBit \
  rate 1348kbit avpkt 1000 prio 1 bounded isolated allot 1514 weight 1 maxburst 20

# tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 1: u32 divisor 1
# tc filter add dev eth0 parent 1:0 prio 5 u32 match ip src 192.168.1.2 flowid 1:1
# tc filter add dev eth0 parent 1:0 prio 5 u32 match ip src 192.168.1.3 flowid 1:2

It's a really flexible system (though a bit a head ache to get to
know) One neat trick is to use iptables to MARK high priority traffic,
and then stick that into a higher priority queue. 

You'll need to have compiled in support for QoS before any of this
works, btw.

Cheers,

Simon

-- 
"People said to me, 'just be youself,' and now they hate me."
    --- Robert Newman, the Mary Whitehouse Experience

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list