Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 May 2005 23:19:47 +0200
From:      "Alexandre D." <alexandre.delay@free.fr>
To:        <freebsd-ipfw@freebsd.org>
Subject:   RE: QoS and guaranteed bandwidth
Message-ID:  <MAEBLPAGHGPMOKCBICBNEEHACFAA.alexandre.delay@free.fr>
In-Reply-To: <008801c55fd5$d6e7dec0$0100000a@R3B>

next in thread | previous in thread | raw e-mail | index | archive | help
I have another procedure to submit to you all:

1) sysctl net.inet.ip.fw.one_pass=0
   this allow to set several pipes for each data
2) add a pipe for each user in order limit the user bandwidth:
	ipfw pipe $pipe config bw ${kbps}Kbit/s
	ipfw add $fwrule pipe $pipein ip from any to $clientip in
3) add a global pipe for the global bandwidth and then add a weighted queue
for each users:
	for this, we use weight (ie: 1 for 128, 2 for 256...)
	ipfw pipe 1 config bw ${global_bw}Kbit/s
	ipfw queue $queue config pipe 1 weight 1	# for 128 user
	ipfw queue $queue config pipe 2 weight 2 # for 128k user
	# then redirect the traffic
	ipfw add $fwrule queue $queue ip from any to $clientip in

of course we do the same for outgoing traffic

For the guaranteed bandwidth, one more time, it is given by a "weight
calculation".

What do you think of it?

Alex


-----Message d'origine-----
De : owner-freebsd-ipfw@freebsd.org
[mailto:owner-freebsd-ipfw@freebsd.org]De la part de Chris
Dionissopoulos
Envoyι : lundi 23 mai 2005 22:27
ΐ : ovidiue@unixware.ro; freebsd-ipfw@freebsd.org
Objet : Re: QoS and guaranteed bandwidth


>I must have two different values for every user: guaranteed bandwidth and
> maximum bandwidth
>
> Citat "Alexandre D." <alexandre.delay@free.fr>:

This adds a little complexity to the previous procedure.

Variables:
~~~~~~~~
$N = group number of users [1,2,.....]
$USER_MAX_BW[$N] max bandwidth of a single user in group $N.
$USER_MIN_BW[$N] min bandwidth of a single user in group $N.
$USERS_SUBNET[$N], a group subnet (of users) in CIDR format.
$WAN_INTERFACE, your gateway wan interface name.


Procedure:
========
1. Calculate your priority
~~~~~~~~~~~~~~~~~~~
The rule says that the priority in WFQ is calculated if you divide your
total  bandiwdth
with the minimum allocated bandwidth to each user. So we have:

$WFQ_Priority[$N] =  $USER_MAX_BW[$N] / $USER_MIN_BW[$N].


2.Add a proper Pipe and Queue
~~~~~~~~~~~~~~~~~~~~~~~~~
ipfw pipe $N config bw  $USER_MAX_BW[$N]  queue 20Kbytes
ipfw queue $N pipe $N weight $WFQ_Priority[$N]  mask src-ip 0xffffffff queue
10kbytes

ipfw add queue $N ip from $USERS_SUBNET[$N]  to any xmit out $WAN_INTERFACE


example:
=======
2 groups of users:
Group1 - 192.168.0.0/28 , Bandwidth = min 32Kbps - max 256kbps
Group2 - 192.168.0.16/28 , Bandwidth = min 32Kbps - max 384Kbps
$wan  = fxp0

(I assume that your line has at least the minimum bandwidth you guarantee.
in our case is 32users x 32kbps = 1024Kbps )

1.priorities:

$wfq[1] = 256 / 32 = 12
$wfq[2] = 384/ 32  = 16

2.ipfw commands:

ipfw pipe 1 config bw  256Kb/s  queue 20Kbytes
ipfw queue 1 pipe 1 weight 12  mask src-ip 0xffffffff queue 10kbytes
ipfw add queue 1 ip from 192.168.0.0/28  to any xmit out fxp0
ipfw pipe 2 config bw  384Kb/s  queue 20Kbytes
ipfw queue 2 pipe 2 weight 16 mask src-ip 0xffffffff queue 10kbytes
ipfw add queue 2 ip from 192.168.0.16/28  to any xmit out fxp0


So simple!

Chris.

____________________________________________________________________
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
http://www.freemail.gr - free email service for the Greek-speaking.
_______________________________________________
freebsd-ipfw@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ipfw
To unsubscribe, send any mail to "freebsd-ipfw-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MAEBLPAGHGPMOKCBICBNEEHACFAA.alexandre.delay>