after spending a lot of time experimenting with HTB, I found that filters cannot be attached to HTB classes...
The class hierarchy I use is the following (for my upstream internet link):
PRIO (with priomap that sends everything by default to class 1:3)
/ | \
/ | \
/ | \
1:1 1:2 1:3
PFIFO PFIFO HTB qdisc (default to 4:100)
|
|
4:1
HTB class (100% bandwidth)
/ \
/ \
4:100 4:200
(50% bandwidth) (50% bandwidth)
---- HTB class HTB class--------\
/ / | \ | \ \ \
/ / | \ | \ \ \
4:110 4:120 4:130 4:140 4:210 4:220 4:230 4:240
HTB HTB HTB HTB HTB HTB HTB HTB
| | | | | | | |
| | | | | | | |
SFQ SFQ SFQ SFQ SFQ SFQ SFQ SFQ
NOTES:
Class 1:1 is used for NTP Class 1:2 is used for DNS and ICMP
Classes 4:100 and 4:200 are used to divide bandwidth between two hosts
Classes 4:110 and 4:210 are used for audio and video traffic Classes 4:120 and 4:220 are used for interactive traffic (such as HTTP) Classes 4:130 and 4:230 are used for bulk traffic (such as FTP downloads) Classes 4:140 and 4:240 are used for idle traffic (such as POP3 and SMTP)
Related tc commands:
# Traffic from $HOST_B must be sent to 4:200 tc filter add dev eth1 parent 4: u32 match ip src $HOST_B flowid 4:200 # Everything else comes from $HOST_A and is sent to 4:100
# For each host, divide the traffic according to its nature
tc filter add dev eth1 parent 4:100 protocol ip prio 10 handle $MARK_REALTIME fw flowid 4:110
tc filter add dev eth1 parent 4:100 protocol ip prio 20 handle $MARK_INTERACTIVE fw flowid 4:120
tc filter add dev eth1 parent 4:100 protocol ip prio 30 handle $MARK_BULK fw flowid 4:130
tc filter add dev eth1 parent 4:100 protocol ip prio 40 handle $MARK_IDLE fw flowid 4:140
tc filter add dev eth1 parent 4:200 protocol ip prio 10 handle $MARK_REALTIME fw flowid 4:210
tc filter add dev eth1 parent 4:200 protocol ip prio 20 handle $MARK_INTERACTIVE fw flowid 4:220
tc filter add dev eth1 parent 4:200 protocol ip prio 30 handle $MARK_REALTIME fw flowid 4:230
tc filter add dev eth1 parent 4:200 protocol ip prio 40 handle $MARK_REALTIME fw flowid 4:240
If I print statistics, the filters attached to HTB classes never match... :-(
Does anyone know what's going wrong ???
Stephane