Skip to contentSkip to conversation

htb & filter on classes

LARTC [email protected] 3 participants 3 messages Apr 29, 2002 – Apr 30, 2002

lore
Share & tools
lore
#0 lore raw

I am trying to do some simple filtering with htb and the following class hierarchy:

        1:
        |
       1:10
       /  \
   1:100  1:200
    /  \

1:1000 ...

Internal traffic should go to 1:200 and external traffic to 1:100 with further distinction based on dst ip made there.
The problem is that I just don't get the second distinction (filter on class 1:100) right. I have not found any working example where filters were not attached to qdiscs but on classes instead. Is it possible to do so? If yes:
am I using the right syntax (parent 1:100)?

The packets just get dropped in class 1:100 although the filter should definitely match and enqueue them into 1:1000.

Is there anything like a default filter on class basis which always matches or do I have to use something like "match ip dst 0.0.0.0/0"?

Here are the commands I'm using:

##########
tc qdisc add dev eth1 root handle 1: htb default 100
tc class add dev eth1 parent 1: classid 1:10 htb rate 10mbit ceil 10mbit burst 20k

# external traffic
tc class add dev eth1 parent 1:10 classid 1:100 htb rate 1mbit ceil 1mbit 
burst 10k
# internal traffic
tc class add dev eth1 parent 1:10 classid 1:200 htb rate 9mbit ceil 9mbit 
burst 10k

tc class add dev eth1 parent 1:100 classid 1:1000 htb rate 0.5mbit ceil 0.5mbit burst 2k prio 10

# filters
tc filter add dev eth1 pref 1 protocol ip parent 1: u32 match ip src 
195.58.166.176/28 flowid 1:200
tc filter add dev eth1 pref 1 protocol ip parent 1:100 u32 match ip dst 
195.58.0.0/16 flowid 1:1000
##########

Many thanks in advance,

Andreas Lehrbaum
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 9 lines · 0On Tuesday 30 April 2002 01:11, [email protected] wrote:

I am trying to do some simple filtering with htb and the following class hierarchy:

        1:

       1:10
       /  \
   1:100  1:200
    /  \
Quoted 8 lines

1:1000 ...

Internal traffic should go to 1:200 and external traffic to 1:100 with further distinction based on dst ip made there.
The problem is that I just don't get the second distinction (filter on class 1:100) right. I have not found any working example where filters were not attached to qdiscs but on classes instead. Is it possible to do so? If
yes: am I using the right syntax (parent 1:100)?

The syntax is OK. But I don't think htb can do this (yet). Devik ?

Stef

Signature · 7 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to [email protected]

You have to use dst 0.0.0.0/0 to direct "other" flows to 1:100. The default kw has global and definitive meaning - when it is used no other filter is tested. Whe default is 100 is will not test filters here. It is by-design, it could be changed but use dst 0.0.0.0/0 flowid 1:100 now.
devik

Quoted 49 lines · On Tue, 30 Apr 2002 [email protected] wrote:

I am trying to do some simple filtering with htb and the following class hierarchy:

        1:
        |
       1:10
       /  \
   1:100  1:200
    /  \

1:1000 ...

Internal traffic should go to 1:200 and external traffic to 1:100 with further distinction based on dst ip made there.
The problem is that I just don't get the second distinction (filter on class 1:100) right. I have not found any working example where filters were not attached to qdiscs but on classes instead. Is it possible to do so? If yes:
am I using the right syntax (parent 1:100)?

The packets just get dropped in class 1:100 although the filter should definitely match and enqueue them into 1:1000.

Is there anything like a default filter on class basis which always matches or do I have to use something like "match ip dst 0.0.0.0/0"?

Here are the commands I'm using:

##########
tc qdisc add dev eth1 root handle 1: htb default 100
tc class add dev eth1 parent 1: classid 1:10 htb rate 10mbit ceil 10mbit burst 20k

# external traffic
tc class add dev eth1 parent 1:10 classid 1:100 htb rate 1mbit ceil 1mbit
burst 10k
# internal traffic
tc class add dev eth1 parent 1:10 classid 1:200 htb rate 9mbit ceil 9mbit
burst 10k

tc class add dev eth1 parent 1:100 classid 1:1000 htb rate 0.5mbit ceil 0.5mbit burst 2k prio 10

# filters
tc filter add dev eth1 pref 1 protocol ip parent 1: u32 match ip src
195.58.166.176/28 flowid 1:200
tc filter add dev eth1 pref 1 protocol ip parent 1:100 u32 match ip dst
195.58.0.0/16 flowid 1:1000
##########
Quoted 8 lines

Many thanks in advance,

Andreas Lehrbaum
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/