Tuesday, July 13, 2010

DummyNet - HowTo { an open-source tool to tweak network latency and bandwidth }

Any service allowing to  tweak Network Latency and Bandwidth as per desire
for testing application  performance at different network latency scenarios.

Tools/Technology Used:
DummyNet
{Home}URL: http://info.iet.unipi.it/~luigi/dummynet/

Background:
Normally the difference which comes in  development and  deployment
environment of Web Applications, is of bandwidth and latency.
To test the applications in actual scenario, one needs to tweak the latency as
per deployment scene and then use it.
There are few paid VE Technology based services like "Shunra" for this. But
we required a free, open-source application, if possible for windows.
DummyNet, it's an old Italian university project started for BSD systems,
recently ported for Windows also. It helps in reducing latency of NIC to
desired level.

Execution Method:
[] Install NDIS Driver
1.  Open the configuration panel for the network card in use
  {right click on the icon on the SYSTRAY, or go to 'Control
Panel' > 'Network' to select}
2.  Click on 'Properties' > 'Install' > 'Service' > 'Add'
3.  Click on 'Driver Disk' and select 'netipfw.inf' in the
folder it has been extracted to.
4.  Select 'ipfw+dummynet' which should be the only service
visible.
5.  Click 'Accept' on the warnings for the installation of an
unknown driver.

Create a BAT-File for your Application to be run under test bandwidth &
latency with following content
--------------------------------------File Content Starts  from Next line
@echo off
@set CYGWIN=nodosfilewarning
@ipfw -q flush
@ipfw -q pipe flush
@echo #################
@echo ## Setting up ##
@echo #################
ipfw pipe 3 config delay 1000ms bw 500Kbit/s mask all
ipfw add pipe 3 ip from any to any
ipfw pipe show

@echo ""
@echo "Network Tweaking Done, Start Testing."
@echo ""
@echo "Press Enter when testing is done, to restore original Network Settings."
pause

@echo #################
@echo ## Cleaning up ##
@echo #################
ipfw -q flush
ipfw -q pipe flush
pause
--------------------------------------File Content Ends at Previous line
Here, 1000ms is latency set and can be changed to desired value
500 Kbps is bandwidth set and can be changed to desired value
'delay x' and 'bw x'; both can be used separately also as per need
either place a command running your application to be tested in place of
'your_command_running_your_app'; or simple remove that line 
and when the command gets paused at the first pause, run your appl ication
manually.
 

Installation:
Follow the wlak-through video on Youtube at :
http://www.youtube.com/watch?v=jP-DrxTMXDc

Then, to test if it gets installed properly as a network services. It has a testme.bat file showing different tests, just run it and
check statistics.

I tested it on Windows XP, Vista, 7... and it worked great.

10 comments:

  1. I got the following error on windows 7 32 bit. ipfw pipe show my_socket failed 5, cannot talk to kernel module ipfw: socket
    Kindly advise.

    ReplyDelete
    Replies
    1. I'll re-try it on my new updated 32-bit Win7 and be back with the solution ASAP, if its to do anything with the newer updates

      Delete
    2. Just start your cmd.exe using "Run as administrator". In my case that solved the error message.

      Delete
    3. Unfortunately, it doesnt work by me with "Run as administrator". I still get the error: "my_socket failed 2, cannot talk to kernel module" I use Win 7 , x64 . If someone found a solution, I will be very thankful to share it here.

      Delete
  2. Did you try this on win 7-64 bit or 32 bit? My 64 bit windows doesn;t recognise a driver after the first step

    ReplyDelete
    Replies
    1. I don't have a 64-bit Win7 version, can't test it out on that, though I'll try it on my 32-bit Win7

      Delete
  3. Hi there, thank you for the guide.

    Question #1
    I would like to ask you if there is a way to not open the pipes right away put when it have to send something.

    Question #2
    Is it a great overhead to have say ... 200 pipes opened at the same time? Is there a mechanism in DummyNet to put in sleep those that are not in use?

    ReplyDelete
  4. Hi every one!
    My computer installed it.However ,there is one mistake when I run bat file :
    "ipfw is not recognized as an internal or external command"
    give me some advises :)

    ReplyDelete
    Replies
    1. You have to put the path in the system enviroment:

      Press Window+PauseBreak or ControlPanel->System and Maintainance->System->Advanced system settings->enviroment variables->system variables->Path and put ;yourpath(where ipfw is), click ok and it's done! dpam.cin@gmail.com if you need help.

      Delete
  5. Hiii!
    I want to use DummyNet in ubuntu 18.04. Kindly guide.

    ReplyDelete