Inaccurate bandwidth limiting in altq queues
- by overkordbaever
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