[LARTC] HTB and GRED

Linux Advanced Routing and Traffic Control

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

 



Hi all.

I am trying to implement diffserv on a router running linux using HTB. I
am not getting it to work!
My problem appears when I try to implement the AF classes. I am not able
to do the mapping from DSCP to GRED's DPs.
I have found some scripts implementing AF, but these use CBQ, and I want
to use HTB. I have tried to copy some scripts that works with CBQ and
"translate" them into HTB, but tc will not accept to assign a tcindex
filter to a HTB qdisc. I get a RTNETLINK error message, sying "no such
file or directory".
I do not quite understand the automatic creation of classes done by
tcindex.
Could anyone enlighten me?

My script with one AF class is as follows:

#Path:
TC=/home/oystelok/iproute2/tc/tc
$TC qdisc del dev eth0 root

#dsmark as root qdisc:
$TC qdisc add dev eth0 root handle 1:0 dsmark indices 64 set_tc_index 
$TC filter add dev eth0  parent 1:0 protocol ip prio 1 tcindex mask 0xfc
shift 2 pass_on

#Uses htb for link sharing
$TC qdisc add dev eth0 parent 1:0 handle 2:0 htb default 23

#Root class for htb, to make all the bandwidth available to AF and BE:
$TC class add dev eth0 parent 2:0 classid 2:1 htb rate 10Mbit burst 10kbit
cburst 1000

#EF class
$TC class add dev eth0 parent 2:1 classid 2:11 htb rate 5Mbit burst 5kbit
cburst 1000 

#Class for  AFxx and BE
$TC class add dev eth0 parent 2:1 classid 2:12 htb rate 5Mbit ceil 10Mbit
burst 5kbit cburst 1000 prio 1

#Class for AF1x
$TC class add dev eth0 parent 2:12 classid 2:21 htb rate 2Mbit ceil 10Mbit
burst 2kbit cburst 1000 prio 1
#Class for BE
$TC class add dev eth0 parent 2:12 classid 2:23 htb rate 1Mbit ceil 10Mbit
burst 2kbit cburst 1000 prio 2

#----Trying to configure GRED, does not succeed!!!-----
#Qdisc for AF1x
$TC qdisc add dev eth0 parent 2:21 handle 3:0 gred setup DPs 3 default 1

#Setup for AF11
$TC filter add dev eth0 parent 1:0 protocol ip  prio 2 handle 10 tcindex
classid 1:111
$TC qdisc change dev eth0 parent 2:21 gred min 8kbit max 10kbit burst 2
limit 200kbit avpkt 1000 probability 0.001 DP 1

#Setup for AF12
$TC filter add dev eth0 parent 1:0 protocol ip  prio 2 handle 12 tcindex
classid 1:112
$TC qdisc change dev eth0 parent 2:21 gred min 8kbit max 10kbit burst 2
limit 200kbit avpkt 1000 probability 0.001 DP 2

#Setup for AF13
$TC filter add dev eth0 parent 1:0 protocol ip  prio 2 handle 14 tcindex
classid 1:113
$TC qdisc change dev eth0 parent 2:21 gred min 8kbit max 10kbit burst 2
limit 200kbit avpkt 1000 probability 1.0 DP 3

#Qdisc for BE
$TC qdisc add dev eth0 parent 2:23 handle 5:0 red min 12kbit max 25kbit
burst 20 limit 200kbit avpkt 1000 bandwidth 10Mbit

#Filter for EF:
$TC filter add dev eth0 parent 2:0 protocol ip u32 match ip tos 0xb8 0xff
flowid 2:11
#Filter for AF1x:
$TC filter add dev eth0 parent 2:0 protocol ip u32 match ip tos 0x20 0xe0
flowid 2:21
#Filter for BE:
$TC filter add dev eth0 parent 2:0 protocol ip u32 match ip tos 0x00 0xff
flowid 2:23




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