The cloonix project provides a variety of root filesystems for use in the cloonix network simulator. These root filesystem only have the most basic software packages installed and will not support advanced network configuration (with the exception of router filesystems such as openwrt).
To create a network simulation that runs real-world networking software, we need to install new software on the root filesystems we will use in cloonix. In this example, we chose to start with the Debian jessie root filesystem and we will install some networking software and a desktop environment.
We will also show how to save the upgraded root filesystem for future use as either a static or non-static root filesystem.
Download root filesystem
In our previous post about installing cloonix version 24, we downloaded the Debian jessie root filesystem, jessie.qcow2 to the cloonix bulk directory which, in our example, is ~/Netsims/cloonix-24.11/bulk.
If you have not already done this, execute the following commands:1
$ cd ~/Netsims/cloonix-24.11/bulk $ wget http://cloonix.fr/vm/v24/jessie.qcow2.xz $ unxz jessie.qcow2.xz
Start the cloonix graph graphical user interface with the following commands, assuming we are using cloonix version 24.11, as described in a previous post.
$ sudo modprobe kvm-intel nested=1 $ sudo chmod 666 /dev/kvm $ cd ~/Netsims/cloonix-24.11 $ ./start_cloonix_net $ ./graph
A cloonix window will appear showing a blank canvas with the cloonix toolbar.
Configure the VM object.
Right-click on the VM object in the tool bar to open the VM configuration panel.
Enter the name of the Jessie root filesystem in the Rootfs field. Set the RAM and number of CPUs to an appropriate value. For example, we chose to use 512 GB RAM and 2 virtual cores. For now, we use a non-static filesystem so we do not check the static_rootfs box.
Start a guest VM
Then, drag the VM object onto the graph canvas to start one VM. After the VM starts, it turns blue.
Connect the VM to the internet
To install new software, the guest VM must be connected to the internet. To connect the guest VM to the internet, use the slirp interface.
Reveal the slirp LAN
The slirp LAN is created by cloonix at startup, but it is hidden. To make it visible, right-click on a blank part of the canvas and select the Hidden/Visible menu item.
In the Hidden/Visible panel, uncheck the box next to cloonix_slirp_admin_vlan.
Now we see the slirp LAN on the canvas.
Connect the guest VM to the slirp LAN
To connect the guest VM to the slirp LAN, double-click the cloonix_slirp_admin_vlan LAN. It will turn pink. Then, click on the guest VM interface that is to be connected to the slirp LAN.
The cloonix documentation suggests using the highest Ethernet interface so click on the green circle labeled “2”, which represents interface eth2 on the guest VM. The slirp LAN and the eth2 interface on the guest VM are now connected.
Install new software on the guest VM
To install software or upgrade the operating system, we use standard Linux commands entered into aterminal connected to the guest VM. To connect to the guest VM with a terminal, double-click on the guest VM in the cloonix graph canvas. A terminal window will open.
Configure the guest VM Ethernet interface
We get IP configuration from the slirp LAN using the DCHP protocol. Remember: the Slirp LAN is connected to eth2 on the guest VM, so we start the DHCP client on interface eth2:
# dhclient eth2
Now, we have a valid IP configuration on the Ethernet interface and it is connected to the internet via the slirp LAN.
Install basic networking software
install software required for a basic network simulation using the following commands:
# apt-get update # apt-get dist-upgrade # apt-get --allow-unauthenticated -y install quagga \ tcpdump radvd traceroute wireshark tshark iperf
Save the upgraded root filesystem
Save the filesystem as a new qcow file. Right-click on the guest VM in the cloonix graph UI and select the save rootfs with cp menu command.
You will see a window asking for the path and filename. Save the file in the bulk directory if you will use it as the basis for a non-static root filesystem. Choose a new filename.
For example, save the filesystem to the bulk directory, use the path: /home/blinklet/Netsims/cloonix-24.11/bulk/jessie-networking.qcow2.
Add a desktop GUI interface
Now, we have a root filesystem based on a small root filesystem. But, what if we also need some guest VMs that can gun a graphical user interface? We can add more software.
To add a desktop interface, install your favorite desktop environment. In this example, we use XFCE because it is relatively efficient and should run well on a guest VM with limited resources.
To install XFCE without its supporting applications, which we don’t need, execute the command:
# apt-get install xfce4
Then follow the prompts to install XFCE:
Save a new copy of the filesystem
Now, save another copy of the guest VM root filesystem using the copy command. Right-click on the guest VM in the cloonix graph UI and select the save rootfs with cp menu command. Use a different file name so we create a new root filesystem.
For example, save the new root filesystem to the bulk directory. Use the path: /home/blinklet/Netsims/cloonix-24.11/bulk/jessie-networking-XFCE.qcow2.
Static root filesystems
During this process, we did not care if we will use static or non-static filesystems in the network simulation.
If we use non-static filesystems, we have completed our tasks. We have two root filesystem: one with basic networking software installed and one with an additional desktop environment installed. We can use one or both of these as the base non-static filesystem in a future simulation.
If we plan to use non-static filesystem in the simulation, we must plan ahead. We need to create a unique copy of the filesystem for each node that will run in the simulation. To create a set of unique filesystems that can be later set up as static filesystems in a simulation scenario, create multiple copies of the filesystem in a unique directory.
Right-click on the guest VM and choose the save rootfs with cp menu command. Do this once for each new, unique root filesystem we will need. Choose a different filename for each new root filesystem.
Check the cloonix bulk directory on the host PC, or the directory to which you saved the new root filesystems. We should see that, compared to the original jessie.qcow2 root filesystem, the two new filesystems are larger.
$ ls -l total 2735440 -rw-r--r-- 1 user1 user1 897777664 Jun 9 23:06 jessie-networking.qcow2 -rw-r--r-- 1 user1 user1 1238237184 Jun 9 23:15 jessie-networking-XFCE.qcow2 -rw-r--r-- 1 user1 user1 718602240 Jun 2 15:59 jessie.qcow2
Shut down cloonix.
So we can start with a clean slate, shut down cloonix.
Now, we are ready to re-start cloonix and run a simulation using the upgraded filesystems.
We upgraded the Debian jessie root filesystem running in a guest VM in the cloonix network simulator. We saved a snapshot of the filesystem after installing basic networking software and saved another snapshot after adding a desktop environment to the filesystem. This provides us with two root filesystems for use in a cloonix network simulation scenario.
The cloonix development team regularly updates cloonix and, when they do, the location of filesystems on the cloonix web site may change. If the following commands do not work, go directly to the cloonix web site and find the filesystem file. ↩