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.
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.
Install the matching kernel source, and prepare for building dummynet against the kernel source.
$ 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.
$ 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.
If successful, finally go ahead and install the dummynet module. Optionally, you can make it automatically loaded upon boot as follows.
$ 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.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015