Skip to contentSkip to conversation

HTB steals bandwidth

LARTC Robert Brueckmann 3 participants 5 messages Dec 16, 2002 – Dec 20, 2002

lore
Share & tools
lore
#0 lore raw

Hi!

I just tested my HTB setup. But I have a problem. Let's assume I run the following script (even if it might do nothing useful, just for demonstrating my problem):

#!/bin/bash
/usr/sbin/tc qdisc add dev ppp0 root handle 1: htb default 12 /usr/sbin/tc class add dev ppp0 parent 1: classid 1:1 htb rate 125kbit ceil 125kbit
/usr/sbin/tc class add dev ppp0 parent 1:1 classid 1:14 htb rate 125kbit ceil 125kbit prio 0
iptables -A POSTROUTING -t mangle -o ppp0 -p tcp --dport ftp-data -j MARK --set-mark 14
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 14 fw flowid 1:14

I have an adsl-connection (768kbit down/128kbit up), Linux kernel 2.4.20. The script should do nothing to an outgoing ftp-upload, since I grant all the available bandwith to it. No other traffic is happending during all that, only one ftp-upload from a computer inside the LAN. I start the upload without the rules above, and the upload is at a constant maximum of 128kbit/sec. After running the script above and waiting for say 5 seconds, the upload speed drops down to app. 80 kbit/s! After removing the rules above, the speed climbs up again to top speed.

Can someone explain to me why this happens? I think I didn't quite understand HTB...

Thanks,
Robert

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

#1 lore raw
Quoted 17 lines · Robert Brueckmann

Hi!

I just tested my HTB setup. But I have a problem. Let's assume I run the following script (even if it might do nothing useful, just for demonstrating my problem):

#!/bin/bash
/usr/sbin/tc qdisc add dev ppp0 root handle 1: htb default 12 /usr/sbin/tc class add dev ppp0 parent 1: classid 1:1 htb rate 125kbit ceil 125kbit
/usr/sbin/tc class add dev ppp0 parent 1:1 classid 1:14 htb rate 125kbit ceil 125kbit prio 0
iptables -A POSTROUTING -t mangle -o ppp0 -p tcp --dport ftp-data -j MARK --set-mark 14
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 14 fw flowid 1:14

Quoted 8 lines

I have an adsl-connection (768kbit down/128kbit up), Linux kernel 2.4.20. The script should do nothing to an outgoing ftp-upload, since I grant all the available bandwith to it. No other traffic is happending during all that, only one ftp-upload from a computer inside the LAN. I start the upload without the rules above, and the upload is at a constant maximum of 128kbit/sec. After running the script above and waiting for say 5 seconds, the upload speed drops down to app. 80 kbit/s! After removing the rules above, the speed climbs up again to top speed.

Have you tried with other rates and ceil values?
And you defined a default class 12, but there is no such class. Ftp-data can use dynamic ports. So can you check that the iptables line with "--dport ftp-data" is really catching the ftp packets??

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/
#2 lore raw
In reply to Robert Brueckmann
Quoted 10 lines · Robert Brueckmann
Quoted 9 lines

Hi!

I just tested my HTB setup. But I have a problem. Let's assume I run the following script (even if it might do nothing useful, just for demonstrating my problem):

#!/bin/bash
/usr/sbin/tc qdisc add dev ppp0 root handle 1: htb default 12 /usr/sbin/tc class add dev ppp0 parent 1: classid 1:1 htb rate 125kbit

ceil

Quoted 9 lines
Quoted 9 lines

125kbit
/usr/sbin/tc class add dev ppp0 parent 1:1 classid 1:14 htb rate 125kbit ceil 125kbit prio 0
iptables -A POSTROUTING -t mangle -o ppp0 -p tcp --dport ftp-data -j MARK --set-mark 14
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 14 fw flowid 1:14

I have an adsl-connection (768kbit down/128kbit up), Linux kernel

2.4.20.

Quoted 1 line
Quoted 1 line

The script should do nothing to an outgoing ftp-upload, since I grant

all

Quoted 3 lines
Quoted 3 lines

the available bandwith to it. No other traffic is happending during all that, only one ftp-upload from a computer inside the LAN. I start the upload without the rules above, and the upload is at a constant maximum

of

Quoted 1 line
Quoted 1 line

128kbit/sec. After running the script above and waiting for say 5

seconds,

Quoted 5 lines
Quoted 2 lines

the upload speed drops down to app. 80 kbit/s! After removing the rules above, the speed climbs up again to top speed.

Have you tried with other rates and ceil values?
And you defined a default class 12, but there is no such class. Ftp-data can use dynamic ports. So can you check that the iptables line

with

Quoted 2 lines

"--dport ftp-data" is really catching the ftp packets??

If I reduce rate and ceil, it doesn't work properly either. I tried setting the rate to 8kbit and the ceil to 16kbit and the upload did get less than 2kbyte/s, it was app. 1,3kbyte/s.

I modified the script to satisfy the need for the default class 12:

#!/bin/bash
/usr/sbin/tc qdisc add dev ppp0 root handle 1:0 htb default 12 /usr/sbin/tc class add dev ppp0 parent 1:0 classid 1:1 htb rate 125kbit ceil 125kbit
/usr/sbin/tc class add dev ppp0 parent 1:1 classid 1:12 htb rate 25kbit ceil 125kbit prio 1
/usr/sbin/tc class add dev ppp0 parent 1:1 classid 1:14 htb rate 100kbit ceil 125kbit prio 0
iptables -A POSTROUTING -t mangle -o ppp0 -p tcp --dport ftp-data -j MARK --set-mark 14
tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 14 fw flowid 1:14

The ftp-data-port rule works for all active ftp-connections, and the packet dounter of the rule increases just as I expected.

Any ideas, why the rate crashes down with these rules? May the processor-power be the problem? The router is a Pentium-200, 64mb ram.

Thanks,
Robert

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

#3 lore raw
In reply to Robert Brueckmann
Quoted 3 lines

If I reduce rate and ceil, it doesn't work properly either. I tried setting the rate to 8kbit and the ceil to 16kbit and the upload did get less than 2kbyte/s, it was app. 1,3kbyte/s.

16kbit is 2 kbyte and 1,3 is allmost 2kbyte. So it seems to me that you are shaping what you want. But what worried me was the fact that in you first
post, the bandwidth dropped after 5 sec from 128kbit to 80kbit. Do you
still have the same problem with the lower rate/ceil?

Quoted 2 lines

Any ideas, why the rate crashes down with these rules? May the processor-power be the problem? The router is a Pentium-200, 64mb ram.

What's the load and memory usage on that box ?

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/
#4 lore raw
In reply to Robert Brueckmann

On Thu, 2002-12-19 at 08:08, Robert Brueckmann wrote:
<SNIPPED>

Quoted 6 lines

The ftp-data-port rule works for all active ftp-connections, and the packet dounter of the rule increases just as I expected.

Any ideas, why the rate crashes down with these rules? May the processor-power be the problem? The router is a Pentium-200, 64mb ram.

I'm running HTB to split 512Kb DSL connection between two people, and it seems to be working as expected... I can't remember any figures - but never had reason for concern.

This is a P166 (no MMX), and 96Mb memory, and has NFS/HTTP/MYSQL happening much of the time.

Signature · 6 lines
NAME    :	Adam Allen.
EMAIL   :	[email protected]

COMMENT :	~~~~ insert your favourite signature comment here ~~~~

PGP     :	http://search.keyserver.net:11371/pks/lookup?op=vindex&search=adam%40dynamicinteraction.co.uk