[LARTC] HTB + PPPOE : inaccurate rates ?

Linux Advanced Routing and Traffic Control

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

 



Hi all !

(English is not my native langage but I will try to be as simple as
possible.)

The question is at the end !

-----

I am using Debian Woody (stable). Kernel 2.4.18 is patched with
patch-o-matic, HTB, IMQ, ESFQ and some other things.

At home, an old 486dx4-100mhz acts as a firewall/gateway.
This PC is connected to Internet with an Ethernet ADSL Modem
(Speed Touch Home). The protocol used is PPPOE.

I am playing with Qos and HTB since two months and it works
great !

All should be perfect in a perfect world except one thing : rates used
by htb do not include (I think so) PPPOE overhead...

From
http://tldp.org/HOWTO/ADSL-Bandwidth-Management-HOWTO/implementation.html :

> This means that if you are sending a typical TCP ACK packet
> which consists of 0 bytes data + 20 bytes TCP header + 20 bytes
> IP header + 18 bytes Ethernet header. In actuality, even though the
> ethernet packet you are sending has only 40 bytes of payload (TCP
> and IP header), the minimum payload for an Ethernet packet is 46
> bytes of data, so the remaining 6 bytes are padded with nulls.
> This means that the actual length of the Ethernet packet plus header
> is 18 + 46 = 64 bytes.

This is for standard ethernet but with PPPOE, you must add 8 bytes.
So, when sending "a typical TCP ACK packet", payload is 48 bytes
(0 data +20 tcp + 20 ip + 8 pppoe) plus 18 bytes Ethernet header
(14 header + 4 crc).

Total transmited : 66 bytes. The problem is that HTB do not see these
extra bytes (26). This is not a big problem with large packets but when
you send many little packets (ssh keystokes) the overhead is quite big.

------

An example :

Supose I want to limit total upload bandwidth to 10ko/s.
(rate = ceil = 10000 bytes/s)

When I send a (big) email, packets are truncated to 1420bytes (from
ppp and htb point of view). so 10000bytes/s / 1420 = 7 packets/s

If we add pppoe overhead (1420+26*7), 10122 bytes are *realy*
transmitted per second.

Now, imagine that while I am sending that big mail, I use ssh "intensively"
(like holding "down" key to go further in a long man page...)

When pressing a key, ssh send two packets : each one is 92 bytes long
so if you keyboard rate is set to 30 keys/s, 60 packets are sent.
60 packets/s * 92 bytes = 5520 bytes/s.

Because my ssh htb class has a lower prio than smtp htb class, ssh
packets are sent first.

As a result 9780 bytes/s are allowed to be sent by HTB
(60 * 92 bytes (ssh) + 3 * 1420 (mail) )

But with pppoe overhead, 11418 bytes/s are transmited
( 60 * (92+26) + 3 * (1420+26) )

-------

Now, if I want to avoid that, I must limit total upload speed
arround 8600 bytes/s :


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