bandwidth controlling with ALTQ

Volker volker at vwsoft.com
Fri May 18 11:16:29 UTC 2007


On 05/18/07 12:05, Umar wrote:
> Dear Volker
> 
>   Thanks for your reply!
> 
>   I have 1mb up and 1mb down DSL and i have total 20 client at this time.
> 
>>> if you want to limit per IP address, you need to create one queue for
>>> every IP address in your internal network. 
> 
>  Please tell me how i create the queue i will manage 20 queues by hand. But
> i don't know the exact syntax in PF-ALTQ

Umar,

well, here your nightmare comes true! It's not just creating the
queues, but have a different pass rule for every queue you're using.
Let's go (assuming hfsc scheduler, cbq, priq will also do it for you):

$clientIP1="192.168.0.2"
$clientIP2="192.168.0.3"

altq on $ext_if hfsc bandwidth 1Mb queue { qclient1, qclient2,
qclient3, ... }
queue qclient1 bandwdith 10Kb hfsc ( rio )
queue qclient2 bandwidth 10Kb hfsc ( rio )
...

pass in quick log on $int_if proto tcp from $clientIP1 to any \
 flags "S/SA" keep state queue qclient1
pass in quick log on $int_if proto tcp from $clientIP2 to any \
 flags "S/SA" keep state queue qclient2

Note: You also have to define one default queue "hfsc ( default )".
Note2: You'll also want to pass other traffic (udp, icmp etc.).

Happy maintenance! ;)

HTH

Volker

PS: I suggest using a bandwidth for your root queue a bit lower than
what you think your connections' upstream really is. For a 1 Mb
upstream, a value of 940 Kb should be appropriate.


More information about the freebsd-pf mailing list