Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have upload traffic shaping set up as follows (this is my NAS box, eth0 serves both LAN and internet traffic):

# root handle
tc qdisc add dev eth0 root handle 1:0 htb default 12
# lan class - no limit, 2 subclasses
tc class add dev eth0 parent 1:0 classid 1:1  htb rate 1gbit quantum 60000
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 1gbit prio 0 quantum 60000
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 1gbit prio 1 quantum 60000
# wan class - interface limit, 4 subclasses
# allocate 200kbit to p2p upload to enable fast downloads and limit seed uploads in torrent client so that excess bw will be distributed according to priorities
MAX=530
tc class add dev eth0 parent 1:0 classid 1:2  htb rate ${MAX}kbit ceil ${MAX}kbit
tc class add dev eth0 parent 1:2 classid 1:21 htb rate 180kbit ceil ${MAX}kbit prio 0 quantum 1500
tc class add dev eth0 parent 1:2 classid 1:22 htb rate 100kbit ceil ${MAX}kbit prio 1 quantum 1500
tc class add dev eth0 parent 1:2 classid 1:23 htb rate 50kbit  ceil ${MAX}kbit prio 2 quantum 1500
tc class add dev eth0 parent 1:2 classid 1:24 htb rate 200kbit ceil ${MAX}kbit prio 3 quantum 1500

Monitoring the statistics for the classes by a script processing the output of tc -s class show dev eth0, I see following data (3 seconds interval):

<1:2>60.24[60.24]/64.70(  0/ 60) <1:21> 1.77[ 1.77]/21.97(  0/ 78) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>52.97[52.97]/ 6.10( 60/  8) <1:24> 5.50[ 5.50]/24.41(  0/ 23)
<1:2>57.16[58.69]/64.70(  0/ 51) <1:21> 1.22[ 1.50]/21.97(  0/ 53) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>52.92[52.94]/ 6.10( 50/  7) <1:24> 3.02[ 4.25]/24.41(  1/ 14)
<1:2>66.39[61.23]/64.70(  0/ 69) <1:21> 2.98[ 1.99]/21.97(  0/138) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>53.48[53.12]/ 6.10( 69/  9) <1:24> 9.93[ 6.13]/24.41(  0/ 39)
<1:2>52.87[59.05]/64.70(  0/ 75) <1:21> 2.97[ 2.24]/21.97(  0/136) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>40.73[49.89]/ 6.10( 73/ 12) <1:24> 9.18[ 6.92]/24.41(  2/ 46)
<1:2>57.82[58.81]/64.70(  0/ 47) <1:21> 4.26[ 2.64]/21.97(  0/189) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>45.23[48.98]/ 6.10( 46/  7) <1:24> 8.32[ 7.20]/24.41(  1/ 32)
<1:2>52.87[57.84]/64.70(  0/ 59) <1:21> 2.51[ 2.62]/21.97(  0/121) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>42.67[47.95]/ 6.10( 57/ 10) <1:24> 7.69[ 7.28]/24.41(  2/ 22)
<1:2>62.14[58.45]/64.70(  0/ 51) <1:21> 2.45[ 2.59]/21.97(  0/120) <1:22> 0.00[ 0.00]/12.21(  0/  0) <1:23>54.70[48.90]/ 6.10( 51/  7) <1:24> 4.99[ 6.95]/24.41(  0/ 12)

The lines are to be interpreted as follows: < class id > followed by average speed in kib/s during the last sampling period (3s), [average speed in last 60 secs)/configured max rate (borrowed packets in the last sampling period / lended packets in the last sampling period).

So looking at the last line for example, we see that classes 1:21 and 1:24 lended 120+12 packets respectively, which is fine (though 12 seems to be low for 1:24), but what I do not understand is that:

  1. class 1:22 is unused but it has allocated bandwidth - why is it not lending packets to others? Traffic allocation seems to be fine though.
  2. class 1:23 (which is dominating the traffic) is borrowing, but why is the borrowed amount (51) different from the amount lended by other classes?
  3. how can class 1:23 borrow (51) and lend (7) packets at the same time?
share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.