[LARTC] Filter question

Andy Furniss andy.furniss@dsl.pipex.com
Fri, 07 Jan 2005 19:59:13 +0000


Andre Correa wrote:
> 
> Hi guys, I may not have made myself clear in my last message so I'll try 
>   it easy this time. Maybe someone can send me some help.
> 
> I'm trying something like this:
> 
> 
> # root stuff
> tc qdisc add dev eth0 root handle 1: htb default 2
> tc class add dev eth0 parent 1: classid 1:1 htb rate 50000kbit
> # default class
> tc class add dev eth0 parent 1: classid 1:2 htb rate 2000kbit
> 
> # root class for my "garanteed bandwidth" service
> tc class add dev eth0 parent 1: classid 1:3 htb rate 10Mbit
> 
> # class for a 1Mbit shared bandwidth
> tc class add dev eth0 parent 1:3 classid 1:1024 htb rate 1Mbit
> # qdisc used to _make my life easier scripting classes numbers_
> tc qdisc add dev eth0 parent 1:1024 handle 1024: htb default 250
> # default class for this second qdisc
> tc class add dev eth0 parent 1024: classid 1024:250 htb rate 32kbit
> 
> # each customer gets the following class and filter
> tc class add dev eth0 parent 1024: classid 1024:1 htb rate 256kbit
> tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst
> xxx.xxx.xxx.xxx/yy flowid 1024:1
> 
> # another customer...
> tc class add dev eth0 parent 1024: classid 1024:2 htb rate 256kbit
> tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst
> www.www.www.www/zzz flowid 1024:2
> 
> 
> My problem is that this filters are created but they don't send traffic 
> to the expected class. All traffic is going to 1:2 (default class). Can 
> somebody tell me why?
> 
> I apreciate any help, I'm in trouble with this...
> 
> tks in advance.
> 
> Andre

You've created a double htb like in the simulation example on deviks' 
page. You need to filter from the top of the first htb to the second 
then filter from there.

Below works for me

Andy.

# root stuff
tc qdisc add dev eth0 root handle 1: htb default 2
tc class add dev eth0 parent 1: classid 1:1 htb rate 50000kbit
# default class
tc class add dev eth0 parent 1: classid 1:2 htb rate 2000kbit

# root class for my "garanteed bandwidth" service
tc class add dev eth0 parent 1: classid 1:3 htb rate 10Mbit

# class for a 1Mbit shared bandwidth
tc class add dev eth0 parent 1:3 classid 1:1024 htb rate 1Mbit
# qdisc used to _make my life easier scripting classes numbers_
tc qdisc add dev eth0 parent 1:1024 handle 1024: htb default 250
# default class for this second qdisc
tc class add dev eth0 parent 1024: classid 1024:250 htb rate 32kbit

tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 
192.168.0.1 flowid 1:1024
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 
192.168.0.2 flowid 1:1024

# each customer gets the following class and filter
tc class add dev eth0 parent 1024: classid 1024:1 htb rate 256kbit
tc filter add dev eth0 parent 1024: protocol ip prio 1 u32 match ip dst 
192.168.0.1 flowid 1024:1

# another customer...
tc class add dev eth0 parent 1024: classid 1024:2 htb rate 256kbit
tc filter add dev eth0 parent 1024: protocol ip prio 1 u32 match ip dst 
192.168.0.2 flowid 1024:2