PDA

View Full Version : [ubuntu] Dummynet ipfw install



vweissman
November 25th, 2009, 10:19 PM
Hi all,

I am new to Ubuntu and Linux, I installed the Ubuntu 9.1 release since for my project I need to use Dummynet that is a part of the ipfw, it is a part of FreeBSD and in this page:

http://manpages.ubuntu.com/manpages/karmic/man4/dummynet.4freebsd.html

it says that it is possible to add Dummynet/ipfw to Ubuntu by doing this:
To compile ipfw into the kernel, place the following option in the kernel
configuration file:

options IPFIREWALL

Can someone guide me through the needed steps for this task? What files do I need to download and how to compile etc..?

Thank you all in advance.

Val

linxnub
May 24th, 2010, 07:34 PM
I am very new to linux and have recently tried out some different flavors. A few weeks ago I did setup Dummynet on Debian. Although this tut I created for myself may apply to yours or someones install on Ubuntu and Debian.

I have not tried this on Ubuntu but you could pick out the information that matters.

Install Debian

Change PC to boot from cdrom in your bios (usually F2 when you first power on will get you to your bios).
Select Install from the Menu option for basic core install.
-or-
Optionally you can choose Advanced Option and then Graphical Auto-Install and answers the prompts when given.

Install the following when listed

Standard System
Web Server (optional)
DNS Server (optional)
File Server (optional)

Rest of the prompts are self explanatory - root password, user name and user password…etc.
Finally the system reboots and you end up at a User login prompt. Once signed in you are at the User Terminal.
OS installation complete.

Debian configuration
Debian must be configured with a few apts so that you can install Dummynet. You will need to create your own executable and kernel module using your kernel headers. Without them you will get a constant errors when you try to use insmod or modprobe.

Create a new directory to house your ipfw install. I created a directory called ipfw3


First thing I would do is create a snapshot of your newly installed system.

List modules installed and save to file (Optional)

#lsmod > /ipfw3/mymod.txt


List hard drives and partitions. (Optional)

#fdisk –l > /ipfw3/mystorage.txt


Whatever else you wish to save (Optional)

I would log into root at this point, there are few packages that need to be installed.
apt-get show pkgname – gives a description of a package
apt-get stats pkgname – give size information
apt-get search pkgname or if you only know part of the pkgname you could use pkg*


As always update the packages before you do anything.

#apt-get update


Add the libncurses development package

#apt-get install libncurses5-dev

subsequently the following packages will also be installed automatically:
1. binutils
2. gcc
3. gcc-4.3
4. libc6-dev
5. libgomp1
6. linux-libc-dev

suggested packages are listed and you will need to install “make” next.


Add the make package

#apt-get install make


Add the headers for your system which will be needed when creating your ipfw_mod.ko kernel file.

#apt-get install linux-headers-$(uname –r)

subsequently the following packages will also be installed.
1. cpp-4.1
2. gcc-4.1
3. gcc-4.1base
4. linux-headers-2.6.26-2-common (2.6.26-2 can change based on your kernel)
5. liunx-kbuild-2.6.26 (2.6.26 can change based on your kernel)
6. That is all the configurations needed for Debian to allow the processes for installing Dummynet


Dummynet Installation
Without installing the packages as directed above you will not be able to install Dummynet. The version on the website is for the wrong kernel. Just do a modinfo command on the ipfw_mod.ko and you will see the kernel version it was created on. (You probably could download the kernel headers for that module and link the header for that apt, but I feel that this is not the best way.)

1. Now let’s get to business…Copy, move, download the source code to your /tmp directory.
Example: While in your /tmp directory initiate the following command
#wget http://info.iet.unipi.it/~luigi/dummynet/20100319-ipfw3.tgz
2. The file is a compressed in a .tgz format and you will have to expand it.
While in the /tmp directory initiate the following command and a new directory called /tmp/ipfw3/ will be created.
#tar xvzf 20100319-ipfw3.tgz
3. Navigate to the /tmp/ipfw3 directory and initiate the “make” command.
#make
4. 2 files were created and need to be copied to another location
a. ipfw executable was created in the directory /tmp/ipfw3/ipfw/ and
you should copy it to the /ipfw3 directory created earlier in this tut.
#cp /tmp/ipfw3/ipfw/ipfw /ipfw3
b. ipfw_mod.ko kernel module was created in the /tmp/ipfw3/dummynet2/ directory and should be copied to the /ifpw3 directory.
c. #cp /tmp/ipfw3/dummynet2/ipfw_mod.ko /ipfw3

5. Install the Dummynet files
a. Copy the ipfw executable file to the /usr/local/sbin
# cp /ipfw3/ipfw /usr/local/sbin
b. Copy the ipfw_mod.ko to its destination by initiating the following command
#cp /ipfw3/ipfw_mod.ko /lib/modules/`uname –r`
c. Run depmod to update the modules.dep file so that you can use modprobe.
#depmod
d. Now you can use modprobe to install the kernel module
#modprobe ipfw_mod

You can at this point lsmod to view the installed modules and to see if the module is working, type the following:
#ipfw list

Which displays:
65535 allow ip from any to any

e. You will loose the module if you reboot at this time, so to make the module load during boot you need to edit the etc/modules file with a text editor. Add ipfw_mod as the last entry in the file, save the file and you can now reboot and Dummynet is ready for rules to be added.
f. To restart the system and test the install initiate the following command:
#shutdown –r

There definitely maybe an easier way to accomplish but since I am new to the linux world this is all that I could do to get dummynet working on debian

Maybe someone can figure out how to maintain the rule sets after a reboot is done?

burnbrighter
June 18th, 2011, 05:33 AM
Validated as working in 9.10 (Karmic Koala) only! Later versions have issues.

YosemiteSam
January 31st, 2012, 07:43 AM
Worked for 9.04 Jaunty Jackalope.

Pfunk1410
February 8th, 2013, 07:14 PM
Worked on Ubuntu 12.04.1 LTS (Precise Pangolin).
I downloaded IPFW source from http://info.iet.unipi.it/~luigi/doc/20120812-ipfw3.tgz

oldos2er
February 8th, 2013, 10:33 PM
Old thread closed.