# QoS (guaranteed min bandwidth) under FreeBSD 9.1?



## AngryWolf (Apr 12, 2013)

Hi all,

I would like to do the following:


Normally, let everyone do anything without any bandwidth limitation.
If there is traffic on a certain port, it has to be guaranteed certain minimal bandwidth
Is that doable with one of the firewall solutions in FreeBSD?

I would prefer ipfw but if for example only pf can do that, I am fine with switching to the latter. (I have read up on ipfw, and weighted queues do not seem to fit what I want to achieve.)

If you could show me an example that would be appreciated.

Thanks in advance!


----------



## DutchDaemon (Apr 12, 2013)

I _think_ you can do that using the pipes feature of ipfw. You can do something similar with pf's altq, but you'd have to run queues on two separate interfaces to guarantee upload and download bandwidth integrity, because altq can only queue outbound traffic, so it needs a WAN-facing and a LAN-facing instance.


----------



## phoenix (Apr 12, 2013)

IPFW + dummynet does what you want.

Create a pipe with the max bandwidth you want to use.

Then create two queues using that pipe.  Set the weights for each pipe such that you get the minimum bandwidth required.

Then write IFPW rules that send traffic into the queues based on whatever criteria you have.

If you search the forums, I've posted a couple different examples of how this works.


----------



## AngryWolf (Apr 13, 2013)

Thanks for the answers,

The only problem with the pipe feature of ipfw is that it requires me to configure the max bandwidth. However, our max bandwidth is not constant for two reasons:


our ISP provides a guaranteed bandwidth and a maximal bandwidth, which are often not the same,
we occasionally ask our ISP to increase the maximal bandwidth (well, to be honest only a few times in a year, but still).

So we need a solution that can adapt to such changes.


----------



## DutchDaemon (Apr 13, 2013)

Is the value something you can 'harvest' and feed to a script that alters the pipe's parameters?


----------



## AngryWolf (Apr 13, 2013)

Unfortunately I don't think so. But thanks for the idea.


----------



## DutchDaemon (Apr 13, 2013)

There is no way for ipfw or pf to divine what the upstream bandwidth is, I'm afraid. Something has to be scripted around it to feed that information to the ruleset and reload it.


----------

