HTB Troubleshooting

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

Probably a silly problem as a result of lack of understanding here, but I'm having some trouble with a supposedly simple shaping script here.

I have a bunch of IPs on an interface tun0 (VPN clients) which I'm trying to rate limit to 5Mbps default, and then set externally by a script to 1Mbps or 10Mbps. All traffic goes out of eth0 from the clients - no routeback.

Shaping doesn't seem to be working correctly (user's upload is ~250KB/sec + when it's meant to be rate limited to 1Mbps  - ip ending .6 - the corresponding class id is 1:6 in the below/attached logs)

Here's my tc script:

### tun0 setup
        tc qdisc add dev tun0 root handle 1: htb default 99
        tc class add dev tun0 parent 1: classid 1:1 htb rate 100mbit
        tc class add dev tun0 parent 1:1 classid 1:99 htb rate 100mbit

### eth0 setup
        tc qdisc add dev eth0 root handle 1: htb default 99
        tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit
        tc class add dev eth0 parent 1:1 classid 1:99 htb rate 100mbit

### shaping for users, 5Mbps down, 5Mbps up. default for beta test
for q in `seq 2 30` ; do
        d=`printf "%x" $q`
        ### tun0
                 tc class add dev tun0 parent 1:1 classid 1:$q htb rate 5Mbit
                 tc filter add dev tun0 protocol ip parent 1:0 prio 1 u32 match ip dst 208.100.21.$q flowid 1:$q

        ### eth0
                 tc class add dev eth0 parent 1:1 classid 1:$q htb rate 5Mbit
                 tc filter add dev eth0  protocol ip parent 1:0 prio 1 u32 match ip src 208.100.21.$q flowid 1:$q

done

attached is the output of "tc -s -d class show dev tun0" and "tc -s -d class show dev eth0", as well as "tc -s -d filter show dev eth0"  (they were fairly long).


[root@chi01-050-05 shorewall]# tc -s -d qdisc show dev eth0
qdisc htb 1: r2q 10 default 99 direct_packets_stat 29 ver 3.17
 Sent 1749531575 bytes 2569426 pkts (dropped 0, overlimits 875543 requeues 0)
 backlog 3p

[root@chi01-050-05 shorewall]# tc -s -d qdisc show dev tun0
qdisc htb 1: r2q 10 default 99 direct_packets_stat 1 ver 3.17
 Sent 750893493 bytes 1188097 pkts (dropped 1575, overlimits 334927 requeues 0)

Several users were using Bittorrent at the time - including .6.

Can anyone shed some light on how best to fix this problem, or any additional information you may need?

Thank you,

Jan
[root@chi01-050-05 shorewall]# tc -s -d class show dev tun0
class htb 1:99 parent 1:1 prio 0 quantum 200000 rate 100Mbit ceil 100Mbit burst 14087b/8 mpu 0b overhead 0b cburst 14087b/8 mpu 0b overhead 0b level 0
 Sent 3818 bytes 34 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 34 borrowed: 0 giants: 0
 tokens: 1152 ctokens: 1152

class htb 1:11 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1208 bytes 24 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 24 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:22 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 872 bytes 17 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 17 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:1 root rate 100Mbit ceil 100Mbit burst 14087b/8 mpu 0b overhead 0b cburst 14087b/8 mpu 0b overhead 0b level 7
 Sent 718046853 bytes 1137426 pkts (dropped 0, overlimits 0 requeues 0)
 rate 325616bit 464pps
 lended: 0 borrowed: 0 giants: 0
 tokens: 1152 ctokens: 1152

class htb 1:10 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 14230 bytes 179 pkts (dropped 0, overlimits 0 requeues 0)
 rate 5bit
 lended: 179 borrowed: 0 giants: 0
 tokens: 3541 ctokens: 3541

class htb 1:23 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1084 bytes 14 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 14 borrowed: 0 giants: 0
 tokens: 3554 ctokens: 3554

class htb 1:2 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 125836268 bytes 253056 pkts (dropped 0, overlimits 0 requeues 0)
 rate 72441bit 131pps
 lended: 253061 borrowed: 0 giants: 0
 tokens: 3580 ctokens: 3580

class htb 1:13 parent 1:1 prio 0 quantum 131072 rate 1310720bit ceil 1310720bit burst 2908b/8 mpu 0b overhead 0b cburst 2908b/8 mpu 0b overhead 0b level 0
 Sent 1815 bytes 35 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 35 borrowed: 0 giants: 0
 tokens: 2237 ctokens: 2237

class htb 1:20 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1868 bytes 36 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 36 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:3 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 22399137 bytes 38641 pkts (dropped 0, overlimits 0 requeues 0)
 rate 9593bit 17pps
 lended: 38641 borrowed: 0 giants: 0
 tokens: 3580 ctokens: 3580

class htb 1:12 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1292 bytes 24 pkts (dropped 0, overlimits 0 requeues 0)
 rate 1bit
 lended: 24 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:21 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 820 bytes 16 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 16 borrowed: 0 giants: 0
 tokens: 3554 ctokens: 3554

class htb 1:30 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1252 bytes 25 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 25 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:4 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 82765251 bytes 133445 pkts (dropped 0, overlimits 0 requeues 0)
 rate 38659bit 66pps
 lended: 133445 borrowed: 0 giants: 0
 tokens: 3213 ctokens: 3213

class htb 1:15 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 2542 bytes 46 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 46 borrowed: 0 giants: 0
 tokens: 3502 ctokens: 3502

class htb 1:26 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1564 bytes 24 pkts (dropped 0, overlimits 0 requeues 0)
 rate 3bit
 lended: 24 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:5 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 300641036 bytes 327513 pkts (dropped 3, overlimits 0 requeues 0)
 rate 186291bit 176pps
 lended: 327513 borrowed: 0 giants: 0
 tokens: 3437 ctokens: 3437

class htb 1:14 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1736 bytes 35 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 35 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:27 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 776 bytes 15 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 15 borrowed: 0 giants: 0
 tokens: 3554 ctokens: 3554

class htb 1:6 parent 1:1 prio 0 quantum 131071 rate 1310712bit ceil 1310712bit burst 2908b/8 mpu 0b overhead 0b cburst 2908b/8 mpu 0b overhead 0b level 0
 Sent 180823964 bytes 376299 pkts (dropped 1572, overlimits 0 requeues 0)
 rate 53331bit 106pps
 lended: 376299 borrowed: 0 giants: 0
 tokens: 2243 ctokens: 2243

class htb 1:17 parent 1:1 prio 0 quantum 131072 rate 1310720bit ceil 1310720bit burst 2908b/8 mpu 0b overhead 0b cburst 2908b/8 mpu 0b overhead 0b level 0
 Sent 968 bytes 19 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 19 borrowed: 0 giants: 0
 tokens: 2237 ctokens: 2237

class htb 1:24 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 3080 bytes 34 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 34 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:7 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 5344805 bytes 5685 pkts (dropped 0, overlimits 0 requeues 0)
 rate 51bit
 lended: 5685 borrowed: 0 giants: 0
 tokens: 3541 ctokens: 3541

class htb 1:16 parent 1:1 prio 0 quantum 13107 rate 131072bit ceil 131072bit burst 1730b/8 mpu 0b overhead 0b cburst 1730b/8 mpu 0b overhead 0b level 0
 Sent 1766 bytes 33 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 33 borrowed: 0 giants: 0
 tokens: 13148 ctokens: 13148

class htb 1:25 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1448 bytes 29 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 29 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:8 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 110471 bytes 1297 pkts (dropped 0, overlimits 0 requeues 0)
 rate 43bit
 lended: 1297 borrowed: 0 giants: 0
 tokens: 3541 ctokens: 3541

class htb 1:19 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1400 bytes 28 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 28 borrowed: 0 giants: 0
 tokens: 3554 ctokens: 3554

class htb 1:9 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 72466 bytes 769 pkts (dropped 0, overlimits 0 requeues 0)
 rate 40bit
 lended: 769 borrowed: 0 giants: 0
 tokens: 3502 ctokens: 3502

class htb 1:18 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 844 bytes 9 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 9 borrowed: 0 giants: 0
 tokens: 3554 ctokens: 3554

class htb 1:28 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 786 bytes 15 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 15 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

class htb 1:29 parent 1:1 prio 0 quantum 62500 rate 5Mbit ceil 5Mbit burst 2224b/8 mpu 0b overhead 0b cburst 2224b/8 mpu 0b overhead 0b level 0
 Sent 1256 bytes 25 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 25 borrowed: 0 giants: 0
 tokens: 3568 ctokens: 3568

[root@chi01-050-05 shorewall]# tc -s -d filter show dev tun0
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:2  (rule hit 1305271 success 282996)
  match d0641502/ffffffff at 16 (success 282996 )
filter parent 1: protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:3  (rule hit 1022273 success 43811)
  match d0641503/ffffffff at 16 (success 43811 )
filter parent 1: protocol ip pref 1 u32 fh 800::802 order 2050 key ht 800 bkt 0 flowid 1:4  (rule hit 978461 success 150853)
  match d0641504/ffffffff at 16 (success 150853 )
filter parent 1: protocol ip pref 1 u32 fh 800::803 order 2051 key ht 800 bkt 0 flowid 1:5  (rule hit 827607 success 376824)
  match d0641505/ffffffff at 16 (success 376824 )
filter parent 1: protocol ip pref 1 u32 fh 800::804 order 2052 key ht 800 bkt 0 flowid 1:6  (rule hit 450782 success 437570)
  match d0641506/ffffffff at 16 (success 437570 )
filter parent 1: protocol ip pref 1 u32 fh 800::805 order 2053 key ht 800 bkt 0 flowid 1:7  (rule hit 13212 success 5865)
  match d0641507/ffffffff at 16 (success 5865 )
filter parent 1: protocol ip pref 1 u32 fh 800::806 order 2054 key ht 800 bkt 0 flowid 1:8  (rule hit 7347 success 5664)
  match d0641508/ffffffff at 16 (success 5664 )
filter parent 1: protocol ip pref 1 u32 fh 800::807 order 2055 key ht 800 bkt 0 flowid 1:9  (rule hit 1683 success 866)
  match d0641509/ffffffff at 16 (success 866 )
filter parent 1: protocol ip pref 1 u32 fh 800::808 order 2056 key ht 800 bkt 0 flowid 1:10  (rule hit 817 success 207)
  match d064150a/ffffffff at 16 (success 207 )
filter parent 1: protocol ip pref 1 u32 fh 800::809 order 2057 key ht 800 bkt 0 flowid 1:11  (rule hit 610 success 30)
  match d064150b/ffffffff at 16 (success 30 )
filter parent 1: protocol ip pref 1 u32 fh 800::80a order 2058 key ht 800 bkt 0 flowid 1:12  (rule hit 580 success 28)
  match d064150c/ffffffff at 16 (success 28 )
filter parent 1: protocol ip pref 1 u32 fh 800::80b order 2059 key ht 800 bkt 0 flowid 1:13  (rule hit 552 success 39)
  match d064150d/ffffffff at 16 (success 39 )
filter parent 1: protocol ip pref 1 u32 fh 800::80c order 2060 key ht 800 bkt 0 flowid 1:14  (rule hit 513 success 35)
  match d064150e/ffffffff at 16 (success 35 )
filter parent 1: protocol ip pref 1 u32 fh 800::80d order 2061 key ht 800 bkt 0 flowid 1:15  (rule hit 478 success 48)
  match d064150f/ffffffff at 16 (success 48 )
filter parent 1: protocol ip pref 1 u32 fh 800::80e order 2062 key ht 800 bkt 0 flowid 1:16  (rule hit 430 success 40)
  match d0641510/ffffffff at 16 (success 40 )
filter parent 1: protocol ip pref 1 u32 fh 800::80f order 2063 key ht 800 bkt 0 flowid 1:17  (rule hit 390 success 27)
  match d0641511/ffffffff at 16 (success 27 )
filter parent 1: protocol ip pref 1 u32 fh 800::810 order 2064 key ht 800 bkt 0 flowid 1:18  (rule hit 363 success 17)
  match d0641512/ffffffff at 16 (success 17 )
filter parent 1: protocol ip pref 1 u32 fh 800::811 order 2065 key ht 800 bkt 0 flowid 1:19  (rule hit 346 success 33)
  match d0641513/ffffffff at 16 (success 33 )
filter parent 1: protocol ip pref 1 u32 fh 800::812 order 2066 key ht 800 bkt 0 flowid 1:20  (rule hit 313 success 36)
  match d0641514/ffffffff at 16 (success 36 )
filter parent 1: protocol ip pref 1 u32 fh 800::813 order 2067 key ht 800 bkt 0 flowid 1:21  (rule hit 277 success 16)
  match d0641515/ffffffff at 16 (success 16 )
filter parent 1: protocol ip pref 1 u32 fh 800::814 order 2068 key ht 800 bkt 0 flowid 1:22  (rule hit 261 success 23)
  match d0641516/ffffffff at 16 (success 23 )
filter parent 1: protocol ip pref 1 u32 fh 800::815 order 2069 key ht 800 bkt 0 flowid 1:23  (rule hit 238 success 22)
  match d0641517/ffffffff at 16 (success 22 )
filter parent 1: protocol ip pref 1 u32 fh 800::816 order 2070 key ht 800 bkt 0 flowid 1:24  (rule hit 216 success 38)
  match d0641518/ffffffff at 16 (success 38 )
filter parent 1: protocol ip pref 1 u32 fh 800::817 order 2071 key ht 800 bkt 0 flowid 1:25  (rule hit 178 success 31)
  match d0641519/ffffffff at 16 (success 31 )
filter parent 1: protocol ip pref 1 u32 fh 800::818 order 2072 key ht 800 bkt 0 flowid 1:26  (rule hit 147 success 34)
  match d064151a/ffffffff at 16 (success 34 )
filter parent 1: protocol ip pref 1 u32 fh 800::819 order 2073 key ht 800 bkt 0 flowid 1:27  (rule hit 113 success 17)
  match d064151b/ffffffff at 16 (success 17 )
filter parent 1: protocol ip pref 1 u32 fh 800::81a order 2074 key ht 800 bkt 0 flowid 1:28  (rule hit 96 success 15)
  match d064151c/ffffffff at 16 (success 15 )
filter parent 1: protocol ip pref 1 u32 fh 800::81b order 2075 key ht 800 bkt 0 flowid 1:29  (rule hit 81 success 27)
  match d064151d/ffffffff at 16 (success 27 )
filter parent 1: protocol ip pref 1 u32 fh 800::81c order 2076 key ht 800 bkt 0 flowid 1:30  (rule hit 54 success 25)
  match d064151e/ffffffff at 16 (success 25 )
[root@chi01-050-05 shorewall]#


tc class change dev eth0 parent 1:1 classid 1:6 htb rate $attributes[$j]{'value'}bit"
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux