home user developer researcher download resource about



This page illustrates how to install and set up Netnice on your FreeBSD system, based on the install manual included in the package. The target of this document is novice administrators who have never applied kernel patches.

If you have any difficulties with this guide, please let us know by posting comments or questions. We will respond to you as soon as possible.


First, please download the package here.

The target system is FreeBSD4.9 (and 4.10). The installation requires the source code of the kernel and user commands. To check if your system has this source code, you may check /usr/src.

If there is a sys/ directory on your system, you probably have the kernel source. If there are other directories, it is highly likely that you have the other source. If there is no directory, you probably chose the "Minimum" install option when you installed the FreeBSD system. If that is the case, you may add the source by the installation program /stand/sysinstall. Execute the program, and go to "Configure" and "Distributions" listed in the menu. Then, choose "src" and press "OK".

Uncompress the package

Uncompress the package you have just downloaded.

% tar xzvf XXX.tgz

Replace "XXX" with the name of your package. The command will expand the package into your current directory.

Duplicate the source code

If you patch the source, it will overwrite the current contents (sounds fairly obvious). If you feel it necessary, please make a copy of all the source code before you patch, so that you can resume the original source code whenever needed.

To duplicate the source code, simply copy the entire source directory, as follows:

% cd /usr/src
% cp -r ./sys sys.clean

If you receive an error message, it is probably caused by access permissions. Use the "su" command or re-login as root to get administrator privileges.

Patch the kernel

Patch the kernel as follows:

% cd /usr/src/sys
% patch -p < $NETNICE/freebsd/sys/netnice-2.09-sys-freebsd-4.9.patch

Change "$NETNICE" to the directory where you expanded the package. (This rule applies throughout this guide. If you do not understand the notation, you may have to learn more about the Unix shell.)

Make a kernel

Now, you will need to build the kernel. First, make a copy of the configuration file of your existing kernel, so that you can edit the configuration of the new kernel.

% cd /usr/src/sys/i386/conf

The command above makes a copy of the configuration file, named GENERIC, to a new configuration file, named YOURKERNEL. You may change the name to whatever you wish.

Now, you have to add an option, "NETNICE", to the new kernel configuration file. Open the file "YOURKERNEL" with any text editor, and insert the following line into any place: (For readability, we recommend you insert it just below other "options".)

options         NETNICE

Prepare a working directory for the kernel compilation, and "make" the kernel, as follows:

% cd ../../compile/YOURKERNEL
% make depend; make

You will find the kernel image, kernel, in the directory.

Create the command binaries

Next, you will need to compile and create executables for commands. Go to the package directory, and type "make all".

% cd $NETNICE/freebsd/src               
% make all

If compilation is successful, you need install the executables to their proper locations. Type as follows for installation:

% make install

System initialization script

Next, modify the system initialization scripts so that the Netnice module is initialized when the system starts up. Copy the rc.netnice file, found in the package directory of the package, to /etc.

% cp $NETNICE/freebsd/etc/rc.netnice /etc/

Then, we will modify a system initialization script, /etc/rc. Please type

% patch -p /etc/rc < $NETNICE/etc/rc.patch

This patch modifies the initialization script to check the booting kernel type at startup, and execute the netnice initialization script, /etc/rc.netnice, automatically.

% cp $NETNICE/freebsd/etc/netnice.sh /etc/rc.d/netnice


For testing, copy the kernel into the root directory where the system searches for kernel images during the boot phase. Then reboot the system.

% cp ./kernel /kernel
% sync;sync;reboot

If the Netnice kernel boots successfully, it shows an initialization message of the Netnice module at the end of boot message. If it shows too quickly, use "dmesg" command for off-line checking.

After the boot phase, login and execute the netnice command.

% netnice
fxp0:  1024000 Kbps
lp0:   1024000 Kbps
faith0:1024000 Kbps
lo0:   1024000 Kbps
ppp0:  1024000 Kbps
sl0:   1024000 Kbps

If you see a message similar to this, it means your system is now supporting Netnice. Congratulations!!

System reconstruction

Finally, you will need to reconstruct the system to make all binaries compiled for non-Netnice system. Otherwise, you cannot use several useful commands, such as "ps" and "top".

Type as follows:

% cd /usr/src
% make world

Depending on your CPU power, it could take 1-2 hours, or more. If you observe abnormal termination of the compilation, you may type the following:

% nice +10 make world

This command will slow down the compilation process, resulting in less stress to the CPU. Change the value, 10, to slow this down further.

Since this operation overwrites some of the Netnice binaries, please run "make install" again in the netnice src directory.


You may find several useful files in the package.

For the latest information, please visit our project homepage at: http://www.netnice.org

Reload   New Edit Unfreeze Diff Upload Copy Rename   Front page List of pages Search Recent changes Backup   Help   RSS of recent changes
Last-modified: 2010-04-25 (Sun) 04:43:04 (2885d)