The Cloonix development team recently released a major update to the Cloonix network simulator.
Cloonix version 28 makes major changes to the infrastructure of Cloonix. It changes the installation procedure, the location of Cloonix files on your computer, and the names of the commands used to start and administer Cloonix.
Cloonix version 28 also makes changes to the features available to users. It adds support for multiple Cloonix servers running on the same machine, and standardizes and documents the new interface types used to connect virtual machines to each other.
Read the rest of this post for more details about what’s new in Cloonix v28.
In this post, I wrote some examples to show how to use the changed features in Cloonix v28 but I will not discuss the basics of using Cloonix because I assume the reader is already familiar with Cloonix.
If you are not already familiar with Cloonix, you should read the Cloonix documentation. Also, I have written many posts about using the Cloonix network simulator. Please check these posts if you need more information about using Cloonix.
The procedure to install Cloonix v28 has changed slightly — one new software dependency has been added.
We will compile Cloonix to install it. Compiling Cloonix from source code will work on most Linux distributions and it is easy to do. The Cloonix development team created scripts that will compile and install Cloonix.
The Cloonix project also provides pre-compiled files for a variety of Linux distributions and you may read the Cloonix installation documentation if you want to install the pre-compiled Cloonix binaries and files.
Download Source Files
Download the Cloonix v28 source code for the user interface and the server. In this example, I am downloading the source code for Cloonix v28.09. The Cloonix development team releases updates frequently so you should check the Cloonix web site for the latest file names.
$ cd $ wget http://cloonix.net/cloonix/built_cloonix-2015-11-11/cloonix_cli-28.09.tar.gz $ wget http://cloonix.net/cloonix/built_cloonix-2015-11-11/cloonix_serv-28.09.tar.gz $ tar -xvf cloonix_cli-28.09.tar.gz $ tar -xvf cloonix_serv-28.09.tar.gz $ rm cloonix_cli-28.09.tar.gz $ rm cloonix_serv-28.09.tar.gz
Install Software Dependencies
The software dependencies are almost the same as the previous version of Cloonix. Cloonix v28 adds gcc-multilib as a dependency. Install the dependencies using the following commands:
$ sudo apt-get update $ sudo apt-get --allow-unauthenticated -y install \ rxvt-unicode bc build-essential \ libncurses5-dev libpulse-dev \ libssl-dev libgtk2.0-dev libcap-dev \ libevent-dev libreadline-dev \ libsdl1.2-dev libogg-dev libsasl2-dev \ libgtk-3-dev intltool libjpeg-dev \ python-pyparsing libsoup2.4 \ libusb-1.0-0-dev libgudev-1.0-dev \ libopus-dev python-six \ Gcc-multilib
Enter the following commands to enable KVM:
$ sudo modprobe kvm-intel nested=1 $ sudo chmod 666 /dev/kvm
chmod 666 /dev/kvm command makes the kvm folder available to all users. This is fine as long as you are the only user on your computer, or you want all users to have access to kvm. A more secure method would be to add only your userid and the userids of other users who need access to kvm to the kvm group. See the Cloonix documentation for the way to do this.
Compile and Install Cloonix
Build and install the user interface files. Enter the following commands in a terminal window.
$ cd ~/cloonix_cli-28.09 $ ./doitall $ ./install_cli.sh
Build and install the server files.
$ cd ~/cloonix_serv-28.09 $ ./doitall $ ./install_serv.sh
To add Cloonix commands to the system path and initialize the new environment variables, run the bashrc file — which was updated during the Cloonix install process — by executing the following command:
$ source ~/.bashrc
Download VM Images
Load VM images into the bulk directory.
$ cd ~/cloonix/bulk $ wget http://cloonix.net/vm/bulk-2015-11-11/jessie.qcow2.xz $ unxz jessie.qcow2.xz
We downloaded only one image but the Cloonix project provides guest images for most popular Linux distributions so it is possible to perform simulations with different Linux distributions running on each node.
We must start Cloonix in a terminal window.
Cloonix version 28 renames all the Cloonix commands. The new commands for starting Cloonix are described below.
Starting the Cloonix Server
To start an instance of the Cloonix server, use the command cloonix_startnet. The command syntax is:
The name parameter is the server name and is required. Now that Cloonix v28 supports multiple servers on the same machine, it must provide a way to differentiate them so it uses a naming convention for each server. The server name has to be chosen from the following list: nemo, mito, fido, pipo, soyou, coco.
The server names and configurations may be changed in the ~/cloonix/cloonix_config file.
The port parameter is the TCP port number that the server will use to connect to the user interface and it is optional. You may enter any valid port number, or enter no parameter and Cloonix will choose a port number for you.
The password parameter is the Cloonix server password and it is optional.
To start a cloonix server, enter the command:
$ cloonix_startnet nemo
Cloonix prints some information to the screen when it starts, showing the directories and the TCP port number this instance of the Cloonix server will use. The TCP port is listed as the Server Doors Port in the command output.
Cloonix Name: nemo Cloonix Tree Path: /usr/local/bin/cloonix_serv-28.09 Work Zone Path: /home/brian/cloonix/nemo Bulk Path: /home/brian/cloonix/bulk Server Doors Port: 43211 uml_cloonix_switch now running $
Make a note of the TCP port number used by this server. You will need it if you want to run multiple Cloonix servers.
Starting the Cloonix GUI
To start the user interface, use the cloonix_graph command.
You must match the name of a running server when you start the cloonix user interface. If you have multiple servers running, you must start a different user interface for each server.
To start the user interface matched to the server we already started, enter the command:
$ cloonix_graph nemo
New Network Interfaces
Cloonix added new interface types starting in version 26. The main change is version 28 is that these interface types and LAN types are now well documented in the Cloonix documentation.
There are three LAN types:
These are each described in the Cloonix documentation.
I recommend using the Classic LAN and interface types in all cases because it is the default configuration and it works well for the simulation scenarios one would use as an education tool.
If you do have specific requirements for performance or processing overhead, you may evaluate your requirements to use the mu-shared and mu-sock LAN and interface types.
Graphical User Interface
Cloonix v28 makes a few minor changes to the GUI. It adds a sniffer configuration command to the main menu and adds one new option to the KVM configuration window.
After starting the cloonix_graph command as shown above, the Cloonix graphical user interface window opens up. Right-click anywhere in the canvas to show the command menu:
The Cloonix v28 menu remains almost the same as in previous releases. There is one new menu command: snf_conf, which allows the user to change the name of the sniffer device and select the type of LAN interface to which it will be connected.
The KVM_conf command has changed a little in version 28: there is a new option to select the cirrus vga QEMU display driver, which you can safely ignore. I cover the KVM other configuration options in my post about Cloonix v24.
Demonstrating Cloonix v28
Use the Cloonix GUI to create a test network of three nodes in a ring configuration, with a sniffer monitoring all the links, as shown below. We’ll use this to demonstrate one of the new Cloonix CLI commands, below.
Command Line Interface
Cloonix v28 makes major changes to the command line interface, making new functionality available via the CLI and renaming existing commands so they do not conflict with other Linux commands.
The renamed Cloonix commands are:
The cloonix_dbssh command is used to execute commands on a Cloonix guest VM from the host computer’s terminal and the cloonix_dbscp command is used to copy files between the Cloonix guest VM and the host computer.
The cloonix_ctrl command is the command-line interface for Cloonix. Use this command to create new VMs and LANs from the terminal prompt and to completely stop a cloonix session. See the documentation for more information about using the Cloonix command-line interface.
To see the full list of cloonix_ctrl command options, enter the command with no options or parameters, except for the server name:
$ cloonix_ctrl nemo
We will cover the two most commonly used cloonix_ctrl commands in the sections below.
Stopping a Cloonix Session
cloonix_ctrl <name> -k command to halt a Cloonix server session. For example, to stop the Cloonix server session named nemo, execute the command:
$ cloonix_ctrl nemo -k
This will kill all processes related to the Cloonix session and cleans up any files and virtual bridges.
If you have multiple Cloonix servers running, you must enter the command for each server.
Saving the Topology
Cloonix version 28 does not have a command in the GUI menu that will save topologies created in the GUI.
To save the topology, we now use the
cloonix_ctrl <name> -l command to list all the CLI commands that would be needed to create the topology currently running on the Cloonix server. Then, use this output to build a shell script that will automatically create and configure a simulated network with the required topology.
See the example below, which shows the set of commands that would create the three-node network we created above in the section about the Cloonix GUI.
$ cloonix_ctrl nemo -l cloonix_ctrl nemo add kvm Cloon1 1000 1 classic,classic,classic jessie.qcow2 --balloon cloonix_ctrl nemo add lan eth Cloon1 0 lan01 cloonix_ctrl nemo add lan eth Cloon1 2 lan04 cloonix_ctrl nemo add kvm Cloon2 1000 1 classic,classic,classic jessie.qcow2 --balloon cloonix_ctrl nemo add lan eth Cloon2 1 lan03 cloonix_ctrl nemo add lan eth Cloon2 2 lan04 cloonix_ctrl nemo add kvm Cloon3 1000 1 classic,classic,classic jessie.qcow2 --balloon cloonix_ctrl nemo add lan eth Cloon3 0 lan01 cloonix_ctrl nemo add lan eth Cloon3 1 lan03 cloonix_ctrl nemo add snf snf1 classic cloonix_ctrl nemo add lan sat snf1 lan03 cloonix_ctrl nemo add lan sat snf1 lan01 cloonix_ctrl nemo add lan sat snf1 lan04 cloonix_ctrl nemo cnf lay stop cloonix_ctrl nemo cnf lay width_height 539 403 cloonix_ctrl nemo cnf lay scale 150 113 539 403 cloonix_ctrl nemo cnf lay abs_xy_kvm Cloon3 188 225 cloonix_ctrl nemo cnf lay abs_xy_kvm Cloon1 25 66 cloonix_ctrl nemo cnf lay abs_xy_kvm Cloon2 215 11 cloonix_ctrl nemo cnf lay abs_xy_lan lan03 209 104 cloonix_ctrl nemo cnf lay abs_xy_lan lan01 116 159 cloonix_ctrl nemo cnf lay abs_xy_lan lan04 118 33
The Cloonix development team is working on some improvements to the way the QEMU filesystems can be saved and then incorporated into scripts. When these improvements are made available, I will write about the methods of saving topologies and creating scripts to launch network simulation scenarios.
Using multiple servers
Cloonix 28 can run multiple Cloonix servers on the same host, or on different host computers. Servers are identified by the server name assigned to each one.
Cloonix servers can be connected to each other to support larger network simulations than can be supported on a single server. This is especially effective when servers are running on different computers, spreading the workload among multiple computers.
It can also be useful to run separate servers on the same host. For example, to separate a complex network into different logical parts.
Example: Run a second server
We will discuss more about running multiple Cloonix servers in another post. For now, let’s show a simple example. Start a second Cloonix server, mito, with the command:
$ cloonix_netstart mito Cloonix Name: mito Cloonix Tree Path: /usr/local/bin/cloonix_serv-28.09 Work Zone Path: /home/brian/cloonix/mito Bulk Path: /home/brian/cloonix/bulk Server Doors Port: 43212 uml_cloonix_switch now running
Start the mito graphical user interfaces:
$ cloonix_graph mito
Now we see two Cloonix windows, each one attached to different servers.
Create a network in the mito GUI, similar to what we created previously on the nemo GUI. Now we have two separate Cloonix sessions running at the same time.
Two Cloonix servers connected to each other
Stopping Cloonix on Multiple Servers
As shown above, to halt Cloonix v28, use the
cloonix_ctrl <name> -k command. In the case where multiple servers are running, the command must be entered for each server.
For example, to halt all VMs, delete the Cloonix topology, and clear all configurations for the Cloonix servers we started above, execute the commands:
$ cloonix_ctrl nemo -k $ cloonix_ctrl mito -k
Users of Cloonix will find the changes in version 28 do not impact they way they use the Cloonix graphical user interface. However, Cloonix v28 makes major changes to the the command line interface so users who created scripts to run Cloonix commands must update their scripts.
The Cloonix development team continues to regularly update Cloonix.