All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] CBQ by IP address
@ 2002-03-16 11:45 Gavin
  2002-03-16 16:24 ` Stef Coene
  0 siblings, 1 reply; 2+ messages in thread
From: Gavin @ 2002-03-16 11:45 UTC (permalink / raw)
  To: lartc

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

Hello,

I have a Q running (script attached, from the how-to) which does the
following:

1. Assign 6MBit to link
2. Assign 5MBit to 192.168.230.0/24
3. Assign 3MBit to 192.168.220.0/24

I have two questions:

1. Is it possible to set a limit for a particular IP address, rather than a
range?  I've tried  the following:

match ip src 192.168.230.1    -    the filter has no effect on traffic
match ip src 192.168.230.4/32 - the filter has no effect on traffic
match ip src 192.168.230.1/24 - the filter affects the whole 192.168.230.0
network

2. With the attached script, bandwidth is set to 5MBit or 3Mbit for a single
machine on the filtered networks.  When I add another machine on the same
network, both machines get half of the rate.  Is there a way to say that all
machines on a particular /24 are limited to a particular rate, rather than
sharing it between them?

Many thanks,

Gavin

[-- Attachment #2: 5.3.bounded.txt --]
[-- Type: text/plain, Size: 1575 bytes --]

#!/bin/bash
#Test script
# One class, bounded at 6Mbit.  Two classes, bounded, 3Mbit and 5Mbit, not sharing extra.

#Delete the existing eth0 root qdisc
tc qdisc del dev eth0 root

#Add root qdisc
tc qdisc add dev eth0 root handle 1:0 cbq bandwidth 100Mbit avpkt 1000 cell 8

#Add 1:0 class, with 6Mbit limit
tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 100Mbit rate 6Mbit weight 0.6Mbit prio 8 allot 1514 
cell 8 maxburst 20 avpkt 1000 bounded

#Add first class, limited to 5Mbit
tc class add dev eth0 parent 1:1 classid 1:3 cbq bandwidth 100Mbit rate 5Mbit weight 0.5Mbit prio 5 allot 1514 
cell 8 maxburst 20 avpkt 1000 bounded

#Add second class, limited to 3Mbit

tc class add dev eth0 parent 1:1 classid 1:4 cbq bandwidth 100Mbit  rate 3Mbit weight 0.3Mbit prio 5 allot 1514
 cell 8 maxburst 20 avpkt 1000 bounded

#Add qdisc for class 1:3
tc qdisc add dev eth0 parent 1:3 handle 30: sfq

#Add qdisc for class 1:4
tc qdisc add dev eth0 parent 1:4 handle 40: sfq

#Add filter for 192.168.230.0
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.230.0/24 flowid 1:3
#tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.230.1 flowid 1:3
#tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.230.1/24 flowid 1:3
#tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.230.1/32 flowid 1:3

#Add filter for 192.168.220.0
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip src 192.168.220.0/24 flowid 1:4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [LARTC] CBQ by IP address
  2002-03-16 11:45 [LARTC] CBQ by IP address Gavin
@ 2002-03-16 16:24 ` Stef Coene
  0 siblings, 0 replies; 2+ messages in thread
From: Stef Coene @ 2002-03-16 16:24 UTC (permalink / raw)
  To: lartc

On Saturday 16 March 2002 12:45, you wrote:
> Hello,
>
> I have a Q running (script attached, from the how-to) which does the
> following:
>
> 1. Assign 6MBit to link
> 2. Assign 5MBit to 192.168.230.0/24
> 3. Assign 3MBit to 192.168.220.0/24
>
> I have two questions:
>
> 1. Is it possible to set a limit for a particular IP address, rather than a
> range?  I've tried  the following:
>
> match ip src 192.168.230.1    -    the filter has no effect on traffic
> match ip src 192.168.230.4/32 - the filter has no effect on traffic
> match ip src 192.168.230.1/24 - the filter affects the whole 192.168.230.0
> network
This works for me :

tc filter add dev eth0 parent 10: protocol ip u32 match ip dst 192.168.1.253 
flowid 10:10

>
> 2. With the attached script, bandwidth is set to 5MBit or 3Mbit for a
> single machine on the filtered networks.  When I add another machine on the
> same network, both machines get half of the rate.  Is there a way to say
> that all machines on a particular /24 are limited to a particular rate,
> rather than sharing it between them?
The only thing you can do is create a class and filter for each of the extra 
machines.  The WRR qdisc can do this automatically, but I never tried it.  It 
creates a class for each ip-address or mac-address it sees and gives each 
class an equal umount of bandwidth.

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-03-16 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-16 11:45 [LARTC] CBQ by IP address Gavin
2002-03-16 16:24 ` Stef Coene

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.