Skip to contentSkip to conversation

Priorizing bandwidth share

LARTC Nguyen Dang Phuoc Dong 2 participants 2 messages Oct 13, 2003

lore
Share & tools
lore
#0 lore raw

Hi folks,

I have tested Priorizing bandwidth share feature of HTB and it results very bad.

My test environment is something like below. There only 2 PCs on my LAN

Internet

    |
ADSL
    | eth1
Linux box (iptables + HTB)
    | eth0 (192.168.1.254)
----------------------------
    |        LAN          |
PC1                      PC2
(192.168.1.1)     (192.168.1.2)

My ADSL is 512K up/down. Infact, the real bandwidth is about 450K in almost time.

Below is my tc script:

/bin/tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 2: htb r2q 1
tc class add dev eth0 parent 2: classid 2:1 htb rate 512Kbit ceil 512Kbit

iptables -t mangle -A POSTROUTING -o eth0 -d 192.168.1.1 -j MARK --set-mark 12
iptables -t mangle -A POSTROUTING -o eth0 -d 192.168.1.2 -j MARK --set-mark 14

tc class add dev eth0 parent 2:1 classid 2:12 htb rate 400Kbit ceil 512Kbit prio 0
tc qdisc add dev eth0 parent 2:12 sfq
tc filter add dev eth0 parent 2:0 protocol ip prio 0 handle 12 fw classid 2:12

tc class add dev eth0 parent 2:1 classid 2:14 htb rate 100Kbit ceil 512Kbit prio 7
tc qdisc add dev eth0 parent 2:14 sfq
tc filter add dev eth0 parent 2:0 protocol ip prio 7 handle 14 fw classid 2:14

Firstly, I start downloading an iso image from PC1, it can reach 448K. Then I start downloading from PC2, then the bandwidth of class 12 (PC1) is down to about 216K and bandwidth of class 14 (PC2) is about 220K.
So it's not what I've expected. Since I set the priority of class 12 ( = 0 ) higher than priority of class 14 ( = 7 ). In addition, the bandwidth of class 12 is assigned 4 time bigger than class 14. As I've expect, class 12 should be assigned enough bandwidth (400K), and class 14 only get about 50K.

I've tried with both HTB2 (I've removed HTB3 code from kernel 2.4.22, and patched it with HTB2 source code from HTB home page) and HTB3 (used original kernel 2.4.22). The result above is of HTB2. The result of HTB3 even worse.

Any idea?

regards,

Dong

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw
Quoted 59 lines · Nguyen Dang Phuoc Dong

Hi folks,

I have tested Priorizing bandwidth share feature of HTB and it results very bad.

My test environment is something like below. There only 2 PCs on my LAN

Internet

ADSL

    | eth1

Linux box (iptables + HTB)

    | eth0 (192.168.1.254)

----------------------------

| LAN |

PC1 PC2
(192.168.1.1) (192.168.1.2)

My ADSL is 512K up/down. Infact, the real bandwidth is about 450K in almost time.

Below is my tc script:

/bin/tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 2: htb r2q 1
tc class add dev eth0 parent 2: classid 2:1 htb rate 512Kbit ceil 512Kbit

iptables -t mangle -A POSTROUTING -o eth0 -d 192.168.1.1 -j MARK --set-mark 12
iptables -t mangle -A POSTROUTING -o eth0 -d 192.168.1.2 -j MARK --set-mark 14

tc class add dev eth0 parent 2:1 classid 2:12 htb rate 400Kbit ceil 512Kbit prio 0
tc qdisc add dev eth0 parent 2:12 sfq
tc filter add dev eth0 parent 2:0 protocol ip prio 0 handle 12 fw classid 2:12

tc class add dev eth0 parent 2:1 classid 2:14 htb rate 100Kbit ceil 512Kbit prio 7
tc qdisc add dev eth0 parent 2:14 sfq
tc filter add dev eth0 parent 2:0 protocol ip prio 7 handle 14 fw classid 2:14

Firstly, I start downloading an iso image from PC1, it can reach 448K. Then I start downloading from PC2, then the bandwidth of class 12 (PC1) is down to about 216K and bandwidth of class 14 (PC2) is about 220K.
So it's not what I've expected. Since I set the priority of class 12 ( = 0 ) higher than priority of class 14 ( = 7 ). In addition, the bandwidth of class 12 is assigned 4 time bigger than class 14. As I've expect, class 12 should be assigned enough bandwidth (400K), and class 14 only get about 50K.

Quoted 6 lines

I've tried with both HTB2 (I've removed HTB3 code from kernel 2.4.22, and patched it with HTB2 source code from HTB home page) and HTB3 (used original kernel 2.4.22). The result above is of HTB2. The result of HTB3 even worse.

Any idea?

Yes. You said yourself that your link is 450K, so limit all traffic to 445K so YOU are the bottleneck and not your ADSL router.
Also, your r2q setting is too low.
And for more htb tests, info and a faq, see www.docum.org.

Stef

Signature · 8 lines
[email protected]
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.openprojects.net

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/