HTB and filters
Folks,
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
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 8 lines · Stephane Ouellette
Folks,
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):
Quoted 7 lines
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)
The default class MUST be a leaf class. A leaf class is a class with no child classes. If no filter is matched, the packet is dequeued in the default class. This means that no filter is tested so your packets ends in 4:100. The filters attached to 4:100 are never checked.
Stef
Signature · 8 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 20 lines · Stef Coene
Quoted 8 lines · Stephane Ouellette
Folks,
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):
Quoted 9 lines
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)
Quoted 9 lines
The default class MUST be a leaf class. A leaf class is a class with no child classes. If no filter is matched, the packet is dequeued in the default class. This means that no filter is tested so your packets ends in 4:100. The filters attached to 4:100 are never checked.
Stef
Stef,
If I understand correctly, all filters related to the HTB leaf
classes should be attached to the HTB qdisc.
It would have been nice to attach filters to parent HTB classes...
Stephane.
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 24 lines · Stephane Ouellette
Quoted 23 lines · Stef Coene
Quoted 9 lines · Stephane Ouellette
Folks,
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):
Quoted 7 lines
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)The default class MUST be a leaf class. A leaf class is a class with no child classes. If no filter is matched, the packet is dequeued in the default class. This means that no filter is tested so your packets ends in 4:100. The filters attached to 4:100 are never checked.
Quoted 6 lines
Quoted 1 line
Stef
Stef,
If I understand correctly, all filters related to the HTB leaf
classes should be attached to the HTB qdisc.
No, I was only speaking about the default class. You have a filter that put some packets in 4:200. The rest of the traffic goes to the default class 4:100. But the packets are immediatly dequeued in class 4:100 so the filters attached to 4:100 are never checked. You can simulate a default class if you add a u32 filter with src 0/0.
The default class is for unclassified packets.
Stef
Signature · 8 lines
[email protected] "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/