ipfw+dummynet bandwidth control for multi-ip jail

Jeremie Le Hen jeremie at le-hen.org
Fri Jul 22 23:43:03 GMT 2005


>     I have a jail with 4 ips, say, the net interface is lnc0.
> I would like to use ipfw(8) and dummynet to control the bandwidth of the 
> jail, also the different ips. I know that only limit the jail's inbound and 
> outbound bandwidth is very simple. But for the multi-ip jail, I guess that
> I should use the dynamic queue rules of ipfw(8). 
>     My idea is like this: configure the jail's pipe for given bandwidth, 
> while the 4 ips with 4 queues with different weights. The jail's pipe is 
> the 4 queues' parent pipe. They share the pipe's bandwidth. The 4 
> queues can be created using the "mask" option in ipfw(8) rule. Is this 
> feasible?
>     I've read the ipfw(8) man page, but found ALMOST nothing about the 
> jail related configuration. I also googled the Internet, few things helpful. I 
> am not very familiar with ipfw and dummynet. Any one with any hints or 
> directions is appreciated!

What's wrong with :

    # Upload
    ipfw pipe 1 config 100KBits/s
    ipfw queue 1 config pipe 1 weight 25 mask src-ip 0xfffffff
    # Download
    ipfw pipe 2 config 100KBits/s
    ipfw queue 2 config pipe 2 weight 25 mask dst-ip 0xfffffff
    ipfw add queue 1 any from any to any xmit lnc0
    ipfw add queue 2 any from any to any recv lnc0

Note that I didn't tested, this comes from my memory.

Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >

More information about the freebsd-ipfw mailing list