[LARTC] HTB question

Linux Advanced Routing and Traffic Control

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

 



Hello all,

I have a small problem with HTB which i would like to share with the list.
I have send tha same mail to Martin Devera and he replied but i would like to
post my problem here in order to have more information,because i am new in this
area of administration.

I have the simplest scenario that you can imagine.  I have a linux server which have internet
connection with 64Kbps ISDN line using an external modem and behind this server i have 5 WIN
clients. My linux server is RedHat 7.2 with kernel 2.4.17 patched with HTB and i used
the patched tc from Martin Devera site.

My clients use my server as a gateway to the internet. I need to ensure that one WIN client
have 5 kbytes/sec from the total bandwith of 8-9 kbytes when he wants!Why is that?
Because it use a VPN client which needs at least 4 kbytes in order to have useful connection.
As a result i have to devide my 8-9 kbytes/s bandwidth in 2 pieces, one with 5 kbytes and one
with 3-4 kbytes.i created the following script according your guide.

#!/bin/bash
tc="/root/QoS/QoS/tc" 
$tc qdisc del dev eth0 root
$tc qdisc add dev eth0 root handle 1: htb default 11

$tc class add dev eth0 parent 1: classid 1:1 htb rate 10kbps ceil 10kbps burst 12910b \
cburst 12910b
$tc class add dev eth0 parent 1:1 classid 1:10 htb rate 5kbps ceil 10kbps burst \
24910b cburst 12910b
$tc class add dev eth0 parent 1:1 classid 1:11 htb rate 2kbps ceil 10kbps burst \
12910b cburst 12910b

$tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.14 \
flowid 1:10
# 192.168.0.14 is the ip of my WIN clients which needs the 4kbytes

$tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
$tc qdisc add dev eth0 parent 1:11 handle 11: sfq perturb 10

I run it and i did some tests.
I use 2 WIN clients which belong to defualt class and started to download 1 big file from each
one. They had 4kbytes/sec download speed when downloading the files.
Then i started to download a big file from my WINclient(192.168.0.14) and he didn't managed to
have more that 3 kbytes download speed.
I run several time tc -s class show dev eth0 and saw that the default class borrowed several
packets.

see what i mean:
class htb 1:11 parent 1:1 leaf 11: prio 0 quantum 1000 rate 16Kbit ceil 80Kbit burst 12909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1401248 bytes 944 pkts (dropped 0, overlimits 0) 
 rate 4037bps 2pps 
 lended: 455 borrowed: 489 giants: 0
 tokens: -3184094 ctokens: 911840

class htb 1:1 root rate 80Kbit ceil 80Kbit burst 12909b/8 mpu 0b cburst 12909b/8 mpu 0b level 7
 Sent 2603364 bytes 1738 pkts (dropped 0, overlimits 0) 
 rate 7921bps 5pps 
 lended: 489 borrowed: 0 giants: 0
 tokens: 911840 ctokens: 911840

class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1000 rate 40Kbit ceil 80Kbit burst 24909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1202116 bytes 794 pkts (dropped 0, overlimits 0) 
 rate 3816bps 2pps 
 lended: 794 borrowed: 0 giants: 0
 tokens: 3406788 ctokens: 911840



class htb 1:11 parent 1:1 leaf 11: prio 0 quantum 1000 rate 16Kbit ceil 80Kbit burst 12909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1422444 bytes 958 pkts (dropped 0, overlimits 0) 
 rate 4037bps 2pps 
 lended: 461 borrowed: 497 giants: 0
 tokens: -1783000 ctokens: 911840

class htb 1:1 root rate 80Kbit ceil 80Kbit burst 12909b/8 mpu 0b cburst 12909b/8 mpu 0b level 7

 Sent 2644242 bytes 1765 pkts (dropped 0, overlimits 0) 
 rate 7921bps 5pps 
 lended: 497 borrowed: 0 giants: 0
 tokens: 911840 ctokens: 911840

class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1000 rate 40Kbit ceil 80Kbit burst 24909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1221798 bytes 807 pkts (dropped 0, overlimits 0) 
 rate 3816bps 2pps 
 lended: 807 borrowed: 0 giants: 0
 tokens: 3320517 ctokens: 911840



class htb 1:11 parent 1:1 leaf 11: prio 0 quantum 1000 rate 16Kbit ceil 80Kbit burst 12909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1430014 bytes 963 pkts (dropped 0, overlimits 0) 
 rate 4005bps 2pps 
 lended: 466 borrowed: 497 giants: 0
 tokens: -3078483 ctokens: 911840

class htb 1:1 root rate 80Kbit ceil 80Kbit burst 12909b/8 mpu 0b cburst 12909b/8 mpu 0b level 7

 Sent 2660896 bytes 1776 pkts (dropped 0, overlimits 0) 
 rate 7921bps 5pps 
 lended: 497 borrowed: 0 giants: 0
 tokens: 911840 ctokens: 911840

class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1000 rate 40Kbit ceil 80Kbit burst 24909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1230882 bytes 813 pkts (dropped 0, overlimits 0) 
 rate 3816bps 2pps 
 lended: 813 borrowed: 0 giants: 0
 tokens: 3320517 ctokens: 911840



class htb 1:11 parent 1:1 leaf 11: prio 0 quantum 1000 rate 16Kbit ceil 80Kbit burst 12909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1437584 bytes 968 pkts (dropped 0, overlimits 0) 
 rate 4005bps 2pps 
 lended: 471 borrowed: 497 giants: 0
 tokens: -5316046 ctokens: 911840

class htb 1:1 root rate 80Kbit ceil 80Kbit burst 12909b/8 mpu 0b cburst 12909b/8 mpu 0b level 7

 Sent 2676036 bytes 1786 pkts (dropped 0, overlimits 0) 
 rate 7887bps 5pps 
 lended: 497 borrowed: 0 giants: 0
 tokens: 911840 ctokens: 911840

class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1000 rate 40Kbit ceil 80Kbit burst 24909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1238452 bytes 818 pkts (dropped 0, overlimits 0) 
 rate 3848bps 2pps 
 lended: 818 borrowed: 0 giants: 0
 tokens: 3406788 ctokens: 911840



class htb 1:11 parent 1:1 leaf 11: prio 0 quantum 1000 rate 16Kbit ceil 80Kbit burst 12909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1448182 bytes 975 pkts (dropped 0, overlimits 0) 
 rate 4005bps 2pps 
 lended: 471 borrowed: 504 giants: 0
 tokens: -3276238 ctokens: 911840

class htb 1:1 root rate 80Kbit ceil 80Kbit burst 12909b/8 mpu 0b cburst 12909b/8 mpu 0b level 7

 Sent 2689662 bytes 1795 pkts (dropped 0, overlimits 0) 
 rate 7887bps 5pps 
 lended: 504 borrowed: 0 giants: 0
 tokens: 911840 ctokens: 911840

class htb 1:10 parent 1:1 leaf 10: prio 0 quantum 1000 rate 40Kbit ceil 80Kbit burst 24909b/8
mpu 0b cburst 12909b/8 mpu 0b level 0 
 Sent 1241480 bytes 820 pkts (dropped 0, overlimits 0) 
 rate 3848bps 2pps 
 lended: 820 borrowed: 0 giants: 0
 tokens: 3743680 ctokens: 911840

Then only way to ensure that my 192.168.0.14 client have 4-5 kbytes is when i change the ceil
for the default class to 2.
I also noticed that even i change the rate for default class to 1 they always have 2-3
kbytes/sec.
After several  tests i realized that my default class always borrowed packets from my 10 class
even when class 10 use tha bandwidth.As a result i couldn't ensure 4-5 kbytes for class 10.

Does anyone know a way to achive my goal.
I would be grateful if some can give me any hits about it.

Regards,
Pavlos


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I love having the feeling of being in control
while i have the sensation of speed

The surfer of life
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



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