Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can I attach a tc filter to an HTB class rather than to an HTB qdisc?

For example:

tc class add dev $IF_LAN parent 1:100 classid 1:180 htb rate 19kbit ceil 2000kbit prio 4


 1:100 -> Is an HTB inner class.

This question arises from the fact that I could be able to attach a tc filter to a class without throwing an error but later when I saw the tc statistics I realized that there is no filtering being made.

Thanks in advance.

EDIT: I found in the tc manual tc-filter syntax:

tc  filter  [  add  |  change  | replace ] dev DEV [ parent qdisc-id | root ] protocol prootocol prio priority filtertype [ filtertype specific parameters ] flowid flow-id

(the relevant part is parent qdisc-id)

So, I only can be able to attach a filter to a qdisc or there is a workaround?

share|improve this question

Should be possible, we use:

/sbin/tc qdisc add dev $DEV root handle 1: htb default 1
/sbin/tc class add dev $DEV parent 1: classid 1:3 htb rate $RATE burst $BURST
/sbin/tc filter add dev $DEV parent 1:0 protocol ip prio 1 u32 match ip src $IP flowid 1:3

The third line attaches a filter to the class defined in the second line (classid 1:3 and flowid 1:3).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.