Bandwidth squeeze dummynet

hi,

I am new to FreeBSD. I am using Dummynet shaper. Can someone give me an idea how to squeeze and release bandwidth over time? For example: total experimentation time is 10 seconds. close bandwidth at 2 seconds and release after 4 seconds to 10 seconds. Any shell script with ipfw commands will do it?

I had an idea of an algorithm like this:

1. start script at time 't'.
2. create a pipe using ipfw from source to destination with a bandwith of 1Mbit/s.
3. after 2 seconds of script starting close bandwidth i.e, 0 bit/s.
4. restore the bandwidth after 4 seconds (back to 1Mbit/s).
5. after 10 seconds exit from the script.

Am I going in a right way? Or can anyone suggest a better algorithm than this?

Thanks in advance.

br,
boys21
 
You may create and manipulate on pipes and/or queues accordingly to your need:

Code:
ipfw pipe 1 config bw 1Mbits
ipfw add 100 pipe 1 all from any to any
sleep 2
ipfw pipe 1 config bw 32Kbits
sleep 2
ipfw pipe 1 config bw 1Mbits
sleep 10
ipfw delete 100
ipfw pipe 1 delete

May be starting control scripts on cron basis.
 
Thank you very much. That was really helpful.

I have a doubt in the implementation, when I say sleep for 2 seconds do the incoming packets form a queue in the pipe until the 2 seconds are finished?

Using cron will it be possible to control the script in seconds or milliseconds resolution?

br,
boys21
 
I have a doubt in the implementation, when I say sleep for 2 seconds do the incoming packets form a queue in the pipe until the 2 seconds are finished?

Since firewall is independent subsystem then it will keep pipe width until you change bandwidth with corresponding command besides 'sleep'.

Using cron will it be possible to control the script in seconds or milliseconds resolution?

Just refer to man pages for 'sleep' (sleep(1)) and 'cron' (cron(8)) for exact information. Also you can use other scripting/programming languages for your purpose. For example PHP has 'usleep' function. Also there was 'millisleep' program in ports collection.
 
Back
Top