We will install the Cloonix open-source network simulator on a Knoppix Live USB drive. Knoppix is a version of Linux that is designed to boot from a CD, DVD, or USB drive. It can run on almost any computer hardware and it runs in memory, so it does not affect the hard drive of computer on which it is running. If we install Knoppix on a USB thumb drive and then install Cloonix, we can run network simulation experiments on almost any computer, without having to install any software on that computer.
Using a special version of Cloonix, cloonix-19.brian, and after some more trial and error, I was able compile and run Cloonix on the Knoppix Linux operating system. I describe the procedure I followed below,
Initially, Cloonix would not compile in Knoppix. Even though Knoppix can boot with a 64-bit kernel, there seemed to be some issues with the Cloonix compilation process in Knoppix. I reported the issues to the Cloonix development team and they created a version of Cloonix that would compile on Knoppix. This version was not a standard version so they named it cloonix-19.brian.
Boot up Knoppix DVD
We must use the DVD version of Knoppix because it has the 64-bit kernel available as an option. Cloonix requires a 64-bit OS.
You can get the Knoppix DVD ISO file from: mirrors.kernel.org
Burn the ISO file to DVD, then insert the DVD into the computer’s DVD drive and reboot the computer. Press the key that starts the BIOS Settings menu when the computer starts again. This should bring up a menu of boot disks available. Select the DVD drive and continue.
If you do not have a DVD drive, you can directly create a bootable USB flash drive from the Knoppix ISO file using the instructions at the following links, for each of the following popular operating systems:
Knoppix boot options
When booting Knoppix, either from a DVD or from a USB drive, watch the screen carefully during startup. When the Knoppix boot prompt appears, press the F2 key to select boot options. You must select the “knoppix64” boot option to boot the 64-bit kernel. You can also select the screen size if Knoppix has trouble auto-detecting the correct screen size. In my case, the boot options I used were:
Create Knoppix Live USB
Perform the following steps to create a Knoppix Live USB with a persistent file system.
Note: if you already installed Knoppix directly to a USB flash drive from the ISO file, you can skip this step.
Insert a USB thumb drive into a free port on your computer (I suggest you use an inexpensive 8GB drive). The drive will be erased, so ensure any files on the drive are copied to another location, if you need them.
Start the Install KNOPPIX to flash disk program from the start menu:
- Menu → Knoppix → Install KNOPPIX to flash disk
In the dialogue box, select the Flash disk (sdb, in this case). Make sure you select the flash disk, not some other drive.
Select “OK” when the program asks if you want to format the flash disk. Wait about 20 minutes for files to copy.
When the program asks you to configure the size of the data disk, choose the maximum size.
The Install KNOPPIX to flash disk program will complete and you will now have a bootable Knoppix Live USB.
Then, restart your computer and press the key that start the BIOS Settings menu when the computer starts again. This should bring up a menu of boot disks available. Select the USB drive and continue. Knoppix should boot up. Remember to enter in the correct Knoppix boot options every time you boot Knoppix. Again, the knoppix64 option is mandatory. Once again, I entered the following at the boot options prompt:
Download and set up the Cloonix source files
As discussed, the Cloonix development team created a special version of Cloonix that will compile on Knoppix. Download the Cloonix-19.brian source files.
Then, extract the cloonix-19.brian directory from the downloaded archive file to the home directory using the Archive Manager program. So, the Cloonix source files are located at: ~/cloonix-19.brian.
Install prerequisite packages
Then, open the file, ~/cloonix-19.1/README in a text viewer and follow the instructions in the file to compile Cloonix.
$ cd ~/cloonix-19.brian $ gedit README
Some of the packages from the README file are already installed in Knoppix, so you only have to the following:
$ sudo modprobe kvm-intel nested=1 $ sudo chmod 666 /dev/kvm $ sudo apt-get update $ sudo apt-get --allow-unauthenticated -y install libssl-dev $ sudo apt-get --allow-unauthenticated -y install libgtk2.0-dev $ sudo apt-get --allow-unauthenticated -y install libcap-dev $ sudo apt-get --allow-unauthenticated -y install libevent-dev $ sudo apt-get install libspice-server-dev $ sudo apt-get install libspice-protocol-dev $ sudo apt-get install spice-client $ sudo apt-get install spice-client-gtk
To compile Cloonix, go to the directory ~/cloonix-19.brian and run the doitall script.
$ cd ~/cloonix-19.brian $ ./doitall
Important Note: Do not use the sudo command to run the doitall script. you must run the doitall script as a normal user or Cloonix will encounter problems with file permissions when it runs.
Download the Cloonix filesystems
Download the following files from the Cloonix web site. Go to the URL, http://clownix.net, and then:
The following files are optional. We will use them some day but you can download them when you need them. If you are running out of disk space, try downloading an archive, then extracting it to the bulk directory (see below), and then delete the archive before downloading the next archive file.
- Click on Downloads v19.
Extract filesystems to bulk directory
All the downloaded filesystems must be installed in the ~/cloonix-19.brian/bulk directory. Use the Archive Manager program to extract the filesystems from the downloaded archives to the bulk directory. You will have about 940 MB remaining in disk space when you are done (and have deleted all the archive files).
The bulk directory will look like this:
$ cd ~/cloonix-19.brian/bulk $ ls -l total 2000500 -rw-r--r-- 1 knoppix knoppix 3793216 Nov 14 19:26 bzImage -rw-r--r-- 1 knoppix knoppix 20709376 Nov 14 18:51 kvm_openwrt_qcow2 -rw-r--r-- 1 knoppix knoppix 862650368 Nov 15 21:17 kvm_wheezy_lab_qcow2 -rw-r--r-- 1 knoppix knoppix 475463680 Nov 14 20:15 kvm_wheezy_qcow2 -rw-r--r-- 1 knoppix knoppix 683868160 Oct 17 22:15 vyatta_qcow2
Here, we will try a different test script instead of the one I tried in my previous Cloonix test drive post. The Cloonix developers created a simple demo script that starts up two virtual machines and a sniffer.
To run the demo, go to the cloonix-19.brian directory and execute the simple_tst.sh script.
$ cd ~/cloonix-19.brian $ ./simple_tst.sh_
This will start the graph program and then it will start two virtual machines and a sniffer on the graph canvas, all connected to the same virtual Ethernet switch, my_lan.
Double-click on the sniffer, the yellow circle with the green dot inside it. The green dot will turn red, which indicate the sniffer is capturing packets.
Generate some packets between the two virtual machines. Double-click on the Cloon2 VM to open an xterm window connected to that machine. Then execute a ping command to generate packets addressed to Cloon1.
$ ping -c 10 188.8.131.52
This will generate 10 ICMP Echo Request packets and corresponding responses.
Double-click on the sniffer again to stop the capture. The red dot will turn green, again.
The packet-capture (pcap) file generated by the sniffer is: ~/cloonix-19.brian/pcap_simple_tst.pcap. Use the Wireshark program to view the packets. Start the Wireshark program from the terminal:
$ wireshark &
Open the ~/cloonix-19.brian/pcap_simple_tst.pcap file in Wireshark and look at the packets.
Clean up the demo
End the demo with the following demand:
$ cd ~/cloonix-19.brian $ ./ctrl kill
After a lot of trial and error, and with a lot of support from the Cloonix development team, we have installed Cloonix on Knoppix. Now, we can run Cloonix on any PC we have.
Anyone should now be able to easily create a portable installation, if they follow the steps described above.
So, we do not have to carry around a PC with Cloonix installed. We just carry our Knoppix Live USB flash drive and use it on any PC to which we have access, when we want to run an IP or Ethernet network simulation scenario.