Inaccurate bandwidth limiting in altq queues

Posted by overkordbaever on Server Fault See other posts from Server Fault or by overkordbaever
Published on 2010-05-07T17:30:34Z Indexed on 2010/05/07 17:38 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

I'm setting up an environment where I have one Linux server, one OpenBSD router and one Linux client and I want to be able to limit how much bandwidth the client should be able to use.

I've been performing these tests with "netcat" and "time" (using time to measure the time of the transfer with netcat), and what happens when trying these tests (using the TCP protocol, the queues will for some reason not work with UDP) is that the queues aren't exact at all.

For example: when setting a bandwidth limit of 10mbit, the client cannot use more than five mbits, when setting a limit of 100mbit, the client cannot use more than around 50mbit.

The config looks like (using a 100mbit limit in the example):

#queue rules
altq on { $int_if, $ext_if } cbq bandwidth 100Mb queue { def, low }
queue def bandwidth 0Mb cbq(default)
queue low bandwidth 100Mb cbq(default)

#Passrules test

pass out quick from $int_if to $ext_if queue low
pass in quick from $ext_if to $int_if queue low
pass out quick from $ext_if to $int_if queue low
pass in quick from $int_if to $ext_if queue low

© Server Fault or respective owner

Related posts about openbsd

Related posts about packet