How to install dummynet on CentOS

Last updated on February 5, 2013 by Dan Nanni

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
2.6.32-220.17.1.el6.x86_64

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 http://vault.centos.org/6.2/os/Source/SPackages/kernel-2.6.32-220.el6.src.rpm
$ 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 http://info.iet.unipi.it/~marta/dummynet/ipfw3-20120119.tar.gz
$ 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

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean