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

Re: CBQ?



sample script attached:
cbq.on and cbq.off taked from linux-net mailing list,
shaper.e1 rewrited by me from cbq.init script for linux-router
also check this link ftp://ftp.equinox.gu.net/pub/linux/cbq/ (original
cbq.init script) and there: ftp://ftp.inr.ac.ru/ip-routing/ (iproute2
package)

Rolandas
"Init" Corporation


#!/bin/sh
tc qdisc del dev eth0 parent 1:2
sleep 1
tc qdisc del dev eth0 root
#! /bin/sh
# Set up the outer-most queuing discipline.
tc qdisc add dev eth0 root handle 1: cbq bandwidth 10Mbit cell 8 avpkt \
1000 mpu 64

# replace the rest like this
# Root class

tc class add dev eth0 parent 1:0 classid 1:1 cbq bandwidth 10Mbit rate \
10Mbit allot 1514 weight 1Mbit prio 7 maxburst 20 avpkt 1000

# Setup class 2
tc class add dev eth0 parent 1:0 classid 1:2 cbq bandwidth 10Mbit rate \
2Mbit allot 1514 weight 1 prio 1 maxburst 20 avpkt 1000

# Set up TBF for this class
tc qdisc add dev eth0 parent 1:2 tbf rate 128Kbit  burst 10Kbit \
mtu 380 peakrate 16386bps limit 10Kb
#!/bin/sh
#
dev=eth1 		#device,
BANDWIDTH=10Mbit 	#device speed (ethernet)
RATE=32Kbit  		#speed
WEIGHT=3Kbit 		#bits (RATE/10)
PRIO=5 			#shaper priority (1-8, 1 max)
FROM=0/0
TO=10.0.1.0/24
CLASS=2 		#on same card must be different!!!

#*-------------Dont't touch----------------*
ROOT="1`echo $dev|sed 's/[a-z,A-Z]//g'`" 
CLASSID="$ROOT:$CLASS"
BUFFER="10Kb/8"
LIMIT="15Kb"  

#all begins
#clear old
tc qdisc del dev $dev root
#create new
tc qdisc add dev $dev root handle  1`echo $dev|sed 's/[a-z,A-Z]//g'`: cbq bandwidth $BANDWIDTH avpkt 1000 cell 8

tc class add dev $dev parent 1`echo $dev|sed 's/[a-z,A-Z]//g'`:0 classid 1`echo $dev|sed 's/[a-z,A-Z]//g'`:1 cbq bandwidth $BANDWIDTH rate $BANDWIDTH allot 1514 cell 8 weight $WEIGHT prio 8 maxburst 20 avpkt 1000

### Create class and setup TBF 	
tc class add dev $dev parent $ROOT:1 classid $CLASSID cbq bandwidth $BANDWIDTH rate $RATE allot 1514 cell 8 weight $WEIGHT prio $PRIO maxburst 20 avpkt 1000 bounded

tc qdisc add dev $dev parent $CLASSID tbf rate $RATE buffer $BUFFER limit $LIMIT

u32_s="match ip src $FROM"
u32_d="match ip dst $TO"
#echo "$u32_s $u32_d"
#echo $dev
#echo $ROOT
#echo $CLASSID
tc filter add dev $dev parent $ROOT:0 protocol ip prio 100 u32 $u32_s $u32_d flowid $CLASSID
# thats all

Reply to: