# Traffic Shaper with IPFW DUMMYNET



## artakami (Nov 12, 2010)

Hi.

I have about 250 computer in my network, and my internet bandwidth is limited to 512/64 KBps.
Also I have my mail server in my network, which builds up very large queue during work hours.
I've tried to dedicate some bandwidth channel to mail server (port 25 particularly) with IPFW and DUMMYNET. but it is not a good solution for me, because when there is no email to send that bandwidth remains unused. 
Is there any way to prioritise traffic from\to a particular port? So it will push out traffic from\to other ports.

Thanks.


----------



## phoenix (Nov 12, 2010)

Create a *pipe* in dummynet that is equal to your total bandwidth.

Then create 2 separate *queue*s in dummynet, and assign them both to that pipe.  Set the weight of one queue to 2 (this is your smtp queue) and set the weight of the other queue to 3 (this is for non-smtp traffic).  Play around with the weights to find ones that work for you.

Thus, if everyone is going full-tilt with both SMTP and non-SMTP traffic, 40% of your bandwidth will be used for SMTP (weight 2 out of 5), and 60% will be used for non-SMTP traffic (weight 3 out of 5).  That's the minimums guaranteed bandwidth to each queue.

If there's no SMTP traffic, the non-SMTP queue will use 100% of the bandwidth.

If there only SMTP traffic, the SMTP queue will use 100% of the bandwidth.

There's no "wasted" bandwidth.

A pipe sets the maximum amount of traffic that can be passed through it.  A queue sets the minumum percentage of a pipe that can be used.  A queue will expand to fill the pipe if there is no other traffic in other queues assigned to that pipe.


----------



## artakami (Nov 12, 2010)

Sounds like that's what I need.

Thanks.


----------

