How to install dummynet on CentOS

Dummynet is an open-source network emulation tool which allows one to emulate various networking properties of a physical link, such as bandwidth capacity, packet losses, delays and queue length. Dummynet can be used to test experimental network protocols in an emulated network environment.

While dummynet had originally been developed for FreeBSD platform, it was later ported to Linux systems as an external kernel module. In this guide, I will describe how to compile and install dummynet kernel module on CentOS. This setup was tested on CentOS 6.2.

To start out, install all necessary prerequisites for building dummynet kernel module.

$ sudo yum -y groupinstall "Development Tools"

The next step is to install a matching kernel source on CentOS. You need to use a matching kernel source in order to be able to load dummynet in your kernel. CentOS 6.2 has the following kernel.

$ sudo uname -r

Install the matching kernel source, and prepare for building dummynet against the kernel source.

$ mkdir -p /tmp/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
$ echo "%_topdir /tmp/rpmbuild" > ~/.rpmmacros
$ wget
$ rpm -i kernel-2.6.32-220.el6.src.rpm 2>&1 | grep -v mockb
$ sudo tar xvfvj /tmp/rpmbuild/SOURCES/linux-2.6.32-220.el6.tar.bz2 -C /usr/src/kernels/
$ cd /usr/src/kernels/2.6.32-220.17.1.el6.x86_64
$ sudo make oldconfig
$ sudo make prepare
$ sudo make scripts

Download the latest dummynet source code, and compile it against the matching kernel source.

$ wget
$ tar xvjvz ipfw3-20120119.tar.gz
$ cd ipfw3-20120119
$ make KERNELPATH=/usr/src/kernels/2.6.32-220.17.1.el6.x86_64

If build is successful, you will have dummynet kernel module called ipfw_mod.ko created in ipfw3-20120119/dummynet2 directory. Try loading the module.

$ sudo insmod ipfw_mod.ko

If successful, finally go ahead and install the dummynet module. Optionally, you can make it automatically loaded upon boot as follows.

$ sudo cp ipfw_mod.ko /lib/modules/2.6.32-220.el6.x86_64/kernel/net/netfilter
$ sudo depmod
$ sudo sh -c 'echo modprobe ipfw_mod >> /etc/rc.modules'
$ sudo chmod +x /etc/rc.modules

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

3 thoughts on “How to install dummynet on CentOS

  1. I found that you really don't need to build against the kernel source, as outlined in the CentOS wiki here . Since you are not changing any kernel options in the tutorial, and netfilter seems to be on by default, there really isn't a need for rebuilding from kernel source. You can check the existing kernel options for your installation with the following command:
    less /boot/config-`uname-r`

    The build process I used is below and was against a basic server install of CentOS 6.4:
    sudo yum install kernel-devel
    sudo yum group install "Development Tools"
    sudo mkdir /tmp/dummynet
    cd /tmp/dummynet
    tar -zxvf 20120812-ipfw3.tgz
    cd ipfw3-2012
    make KSRC=/usr/src/kernels/2.6.32-358.6.2.el6.i686/

    Hope that helps simplify things for others. Thanks for your tutorial

Leave a comment

Your email address will not be published. Required fields are marked *