[LARTC] CBQ by IP address

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a multi-part message in MIME format.

------=_NextPart_000_0024_01C1CCF9.365EF3C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

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

------=_NextPart_000_0024_01C1CCF9.365EF3C0
Content-Type: text/plain;
	name="5.3.bounded.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="5.3.bounded.txt"

#!/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=20
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=20
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



------=_NextPart_000_0024_01C1CCF9.365EF3C0--



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux