Installing Netkit for Emulating Linux Networks

Home / Installing Netkit for Emulating Linux Networks

What if you want to do some experiment for networking but you don’t have enough resource for it? Not enough PC / switch / router, or maybe don’t have any? You could use Virtual Machine such as VirtualBox and QEMU to emulates hardware. But as you can see, it is painfully and consume lot of resource such as memory and CPU utilization. What if you want to emulates dozens or event hundreds machines? See the point?

So what is the cheapest way to do so? Netkit can answer that. In this article we will installing Netkit to do emulation on Linux (and only linux). In this article I use:

  1. Slackware64 14.0 multilib. If you have Slackware64, you need to enable multilib. Using Slackware 32-bit can proceed.
  2. Netkit version 2.8
  3. Netkit Filesystem
  4. Netkit kernel

The netkit can be downloaded from their official site, here.

What is Netkit

So what is Netkit?

Netkit is an environment for setting up and performing networking experiments at low cost and with little effort. Low cost means you don’t need to setup many computers nor consume many resources on your workstations. It allows to “create” several virtual network devices (full-fledged routers, switches, computers, etc.) that can be easily interconnected in order to form a network on a single PC. Networking equipments are virtual but feature many of the characteristics of the real ones, including the configuration interface.

Emulating a network with Netkit is a matter of writing a simple file describing the link-level topology of the network to be emulated and some configuration files that are identical to those used by real world networking tools. Netkit then takes care of starting (emulated) network devices and of interconnecting them as required. Alternatively, networks can be described by using an XML-based language known as NetML. Starting from a network description in NetML, it is possible to automatically obtain configuration files which can be used with real routers, or Netkit scripts which can be used to emulate the described network.

Unlike Virtual Machine, Netkit use Linux Kernel to emulate device. Therefore, only Linux machine is supported. Netkit exploits open source software and heavily based on the User Mode Linux (UML) variant of the Linux kernel.

Obtaining the Materials

Now, let’s download the required materials. Netkit is composed of three components: the main system, the kernel, and the filesystem. We will download it separately. Again, you can download all of them here.

The main system is the core or the main engine for netkit. The one we use here is Netkit version 2.8 which can be downloaded here.

The filesystem is the “storage” or filesystem used by any of netkit machine. The one we use can be downloaded here.

Last one is the kernel. The kernel is a user process application which emulates linux system. The one we use can be downloaded here.

Install them

In this article we will use /opt directory as the root for installation. Now copy all files we have downloaded to /opt. Use these commands to extract them.

tar -jxf netkit-*

You should notice that we have new directory named netkit. Inside it, you will get some directory such as bin, fs, kernel, check_configuration.d. Netkit doesn’t need to be installed. Thus you can use them directly (but need to be configured, will be described on next section).

Setting the Environment Variable

Before using, we need to set the environment. You need to set following environment variable on your shell. You can set them by using export. These commands must be used on your shell.

export NETKIT_HOME=/opt/netkit
export PATH="${PATH}:${NETKIT_HOME}/bin"
export MANPATH="${MANPATH}:${NETKIT_HOME}/man"

It might be simple, but it will be painful if you want to use netkit on multiple shell, or use netkit multiple times as you need to type them everytime you want to use netkit. The smart way would be save it to some file that will be read by your shell everytime you open terminal. In this case we use bash, and we need to set the configuration locally. Thus we need to modify our .bashrc file. Edit your ~/.bashrc and add following lines.

export NETKIT_HOME=/opt/netkit
export PATH="${PATH}:${NETKIT_HOME}/bin"
export MANPATH="${MANPATH}:${NETKIT_HOME}/man"

When you are done, proceed to next stage.

Checking Configuration

Although I have stated that we can use netkit directly, but we need to check whether netkit can be run or not. At least you have to finish previous stage (setting the environment variables) before proceeding.

Now, open your terminal and go to /opt/netkit. Then invoke following command:

./check_configuration.sh

You should have no problem and will receive message like this:

>  Checking path correctness... passed.
>  Checking environment... passed.
>  Checking for availability of man pages... passed.
>  Checking for proper directories in the PATH... passed.
>  Checking for availability of auxiliary tools:
awk          : ok
basename     : ok
date         : ok
dirname      : ok
find         : ok
getopt       : ok
grep         : ok
head         : ok
id           : ok
kill         : ok
ls           : ok
lsof         : ok
ps           : ok
readlink     : ok
wc           : ok
port-helper  : ok
tunctl       : ok
uml_mconsole : ok
uml_switch   : ok
passed.
>  Checking for availability of terminal emulator applications:
xterm          : found
konsole        : found
gnome-terminal : not found
passed.
>  Checking filesystem type... passed.
>  Checking whether 32-bit executables can run... passed.

[ READY ] Congratulations! Your Netkit setup is now complete!
Enjoy Netkit!

If you don’t get congratulations, you should recheck your installation again. Either way, congratulation! You have installed netkit.

, , , ,

About Author

about author

xathrya

A man who is obsessed to low level technology.

1 Comment
  1. Installing Packet Tracer for Slackware - Xathrya.ID

    […] experiment with network, especially for Cisco based device. If you have read previous article about netkit, you will notice that we can only simulate network using linux devices. In this article we will […]

Leave a Reply

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

Social media & sharing icons powered by UltimatelySocial