Question about subclasses and filters
Hi,
unfortunately I did not get any response to my last message, so let me describe my problem in detail.
I am setting up a router that is responsible for four different offices like shown below:
|--- Office 1 (192.168.100.242)
|
__________ |--- Office 2 (192.168.100.243)
---| Router |---|
---------- |--- Office 3 (192.168.100.244)
|
|--- Office 4 ------- 192.168.100.245
|
|--- 192.168.100.246
|
|--- 192.168.100.247Each office should have one fourth of the available bandwidth, but can borrow bandwidth if necessary. 192.168.0.246 in Office 4 is something special. This server should have a maximum of one fourth.
Therefore I created the following classes:
# queuing discipline tc qdisc add dev eth1 root handle 1: cbq bandwidth 2MBit allot 1514 cell 8 avpkt 1000 mpu 64
# root class tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 2MBit rate 2MBit allot 1514 cell 8 weight 200KBit prio 5 maxburst 20 avpkt 1000
# offices tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:4 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:5 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000
# Special treatment for 192.168.100.246
tc qdisc add dev eth1 parent 1:5 handle 2: cbq bandwidth 512KBit allot 1514 cell 8 avpkt 1000 mpu 64
tc class add dev eth1 parent 2:0 classid 2:1 cbq bandwidth 512KBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 2:1 classid 2:2 cbq bandwidth 512KBit rate 128KBit allot 1514 cell 8 weight 12KBit prio 5 maxburst 20 avpkt 1000
Then I added the following filters:
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.242 flowid 1:2
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.243 flowid 1:3
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.244 flowid 1:4
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.245 flowid 1:5
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.247 flowid 1:5
# Special treatment for 192.168.100.246
tc filter add dev eth1 parent 2:0 prio 5 protocol ip u32 tc filter add dev eth1 parent 2:0 prio 5 protocol ip u32 match ip dst 192.168.100.246 flowid 2:2
Everything okay up to here. But then I looked ar the following:
# tc -s class show dev eth1
class cbq 2: root rate 512Kbit (bounded,isolated) prio no-transmit
Sent 261534164 bytes 433080 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 12499 undertime 0
class cbq 2:1 parent 2: rate 512Kbit prio 5
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 12499 undertime 0
class cbq 2:2 parent 2:1 rate 128Kbit prio 5
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 1.13741e+06 undertime 0
class cbq 1: root rate 2Mbit (bounded,isolated) prio no-transmit
Sent 142271650091 bytes 210353356 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 3124 undertime 0
class cbq 1:1 parent 1: rate 2Mbit prio no-transmit
Sent 2136522126 bytes 2961604 pkts (dropped 0, overlimits 0)
borrowed 432995 overactions 0 avgidle 3124 undertime 0
class cbq 1:2 parent 1:1 rate 512Kbit prio 5
Sent 6450824 bytes 12703 pkts (dropped 0, overlimits 0)
borrowed 7022 overactions 0 avgidle 282608 undertime 0
class cbq 1:3 parent 1:1 rate 512Kbit prio 5
Sent 1846942719 bytes 2448726 pkts (dropped 0, overlimits 0)
borrowed 420044 overactions 0 avgidle 284352 undertime 0
class cbq 1:4 parent 1:1 rate 512Kbit prio 5
Sent 21594419 bytes 67095 pkts (dropped 0, overlimits 0)
borrowed 5312 overactions 0 avgidle 284352 undertime 0
class cbq 1:5 parent 1:1 leaf 2: rate 512Kbit prio 5
Sent 261534164 bytes 433080 pkts (dropped 0, overlimits 0)
borrowed 617 overactions 0 avgidle 284352 undertime 0
Now I have two questions.
1. Why is the package count of class 2:0 equal to the one of class 1:5?
2. Why are there no packets in class 2:2 and 2:1 respectively?
It would be nice if someone could help me or show me a place where I can find an answer to my questions.
Thanks in advance.
Tilman Giese
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
Quoted 103 lines · Tilman Giese
Hi,
unfortunately I did not get any response to my last message, so let me describe my problem in detail.
I am setting up a router that is responsible for four different offices
like shown below:
|--- Office 1 (192.168.100.242)__________ |--- Office 2 (192.168.100.243) ---| Router |---| ---------- |--- Office 3 (192.168.100.244)|--- Office 4 ------- 192.168.100.245 | |--- 192.168.100.246 | |--- 192.168.100.247Each office should have one fourth of the available bandwidth, but can borrow bandwidth if necessary. 192.168.0.246 in Office 4 is something special. This server should have a maximum of one fourth.
Therefore I created the following classes:
# queuing discipline tc qdisc add dev eth1 root handle 1: cbq bandwidth 2MBit allot 1514 cell 8 avpkt 1000 mpu 64# root class tc class add dev eth1 parent 1:0 classid 1:1 cbq bandwidth 2MBit rate 2MBit allot 1514 cell 8 weight 200KBit prio 5 maxburst 20 avpkt 1000# offices tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:3 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:4 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 1:1 classid 1:5 cbq bandwidth 2MBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000# Special treatment for 192.168.100.246
tc qdisc add dev eth1 parent 1:5 handle 2: cbq bandwidth 512KBit allot 1514 cell 8 avpkt 1000 mpu 64
tc class add dev eth1 parent 2:0 classid 2:1 cbq bandwidth 512KBit rate 512KBit allot 1514 cell 8 weight 50KBit prio 5 maxburst 20 avpkt 1000 tc class add dev eth1 parent 2:1 classid 2:2 cbq bandwidth 512KBit rate 128KBit allot 1514 cell 8 weight 12KBit prio 5 maxburst 20 avpkt 1000Then I added the following filters:
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.242 flowid 1:2
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.243 flowid 1:3
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.244 flowid 1:4
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.245 flowid 1:5
tc filter add dev eth1 parent 1:0 prio 5 protocol ip u32 match ip dst 192.168.100.247 flowid 1:5# Special treatment for 192.168.100.246
tc filter add dev eth1 parent 2:0 prio 5 protocol ip u32 tc filter add dev eth1 parent 2:0 prio 5 protocol ip u32 match ip dst 192.168.100.246 flowid 2:2Everything okay up to here. But then I looked ar the following:
# tc -s class show dev eth1class cbq 2: root rate 512Kbit (bounded,isolated) prio no-transmit
Sent 261534164 bytes 433080 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 12499 undertime 0
class cbq 2:1 parent 2: rate 512Kbit prio 5
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 12499 undertime 0
class cbq 2:2 parent 2:1 rate 128Kbit prio 5
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 1.13741e+06 undertime 0
class cbq 1: root rate 2Mbit (bounded,isolated) prio no-transmit
Sent 142271650091 bytes 210353356 pkts (dropped 0, overlimits 0)
borrowed 0 overactions 0 avgidle 3124 undertime 0
class cbq 1:1 parent 1: rate 2Mbit prio no-transmit
Sent 2136522126 bytes 2961604 pkts (dropped 0, overlimits 0)
borrowed 432995 overactions 0 avgidle 3124 undertime 0
class cbq 1:2 parent 1:1 rate 512Kbit prio 5
Sent 6450824 bytes 12703 pkts (dropped 0, overlimits 0)
borrowed 7022 overactions 0 avgidle 282608 undertime 0
class cbq 1:3 parent 1:1 rate 512Kbit prio 5
Sent 1846942719 bytes 2448726 pkts (dropped 0, overlimits 0)
borrowed 420044 overactions 0 avgidle 284352 undertime 0
class cbq 1:4 parent 1:1 rate 512Kbit prio 5
Sent 21594419 bytes 67095 pkts (dropped 0, overlimits 0)
borrowed 5312 overactions 0 avgidle 284352 undertime 0
class cbq 1:5 parent 1:1 leaf 2: rate 512Kbit prio 5
Sent 261534164 bytes 433080 pkts (dropped 0, overlimits 0)
borrowed 617 overactions 0 avgidle 284352 undertime 0
Quoted 3 lines
Now I have two questions.
1. Why is the package count of class 2:0 equal to the one of class 1:5?
Because all packets entering class 1:5 are queued in the qdisc attached to that class. And that qdisc is 2:0.
Quoted 1 line
2. Why are there no packets in class 2:2 and 2:1 respectively?
You have a filter that puts packets from 2:0 to 2:2 if the dst address is X.X.X.246. But you never put these packets in the 2:0 qdisc ... So you have to add that filter to 1:0 and not to 2:0.
And some other remarks. Bandwidth is the real NIC bandwidth. So 10mbit or 100mbit. And you have to bound class 1:1 so the child classes can share the bandwidth.
And why do you add the qdisc 2:0? You can do this also with classes. A cbq qdisc to a cbq class is never a good idea.
Quoted 2 lines
It would be nice if someone could help me or show me a place where I can find an answer to my questions.
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/