Install the VNX network simulator

In this post, I describe the procedure I followed to install the VNX Network Simulator on a computer running the Ubuntu Linux 13.10 operating system.

The VNX system consists of the VNX program that parses the scenario description XML file and builds and manages the virtual network elements; XML files that contain a description of the network scenario to be created; and preconfigured KVM or UML root filesystems that are used to create the virtual machines in the network simulation scenario.

VNX open-source Linux network simulator

The VNX program and some example scripts are installed by the install_vnx script during the installation procedure. The root filesystems must be downloaded separately and you must check to determine which root filesystems you need for the scenarios you plan to run or create.

Linux host computer required

The VNX network simulator uses the KVM hypervisor to run the guest virtual machines used in the simulated network. KVM relies on hardware extensions provided by the computer’s microprocessor.

When evaluating other network simulators, we were able to install and run them on a Linux system in VirtualBox. This allowed us to test these other simulators in a VirtualBox virtual machine on any computer we were using, without installing Linux on that computer. In this case, we will install Linux on a computer so we can use the prepared example scenarios that come bundled with VNX.

The VNX network simulator also supports user-mode linux (UML) — which will work in VirtualBox — as a virtualization method so it is possible to use the VNX network simulator inside a VirtualBox virtual machine if we create networks using UML instead of KVM. However, the developers of VNX do not provide documented example scenarios using UML; they only provide documented example scenarios using KVM.

So, to test VNX, we will install and run VNX on an Apple iMac (2008) computer running the 64-bit Mac version of ubuntu 13.10 as its operating system.

Test the host computer for KVM compatibility

The virtualization support technologies used by KVM are called VT-x or AMD-V. Most computers sold in the past 5 years support these technologies, but computers that have low-cost or low-power microprocessors may not support them. To test your system, execute the following command in a terminal or xterm:

$ egrep -c '(vmx|svm)' /proc/cpuinfo

If the return is 0, the microprocessor on your computer does not support the required virtualization extensions, VT-x or AMD-V.

In my case, on my 2008 Apple iMac computer, this command returns the value, 2, so I know my iMac will run KVM.

Alternatively, you can run the command:

$ lscpu

In the output, you will see the value “VT-X” or “AMD-V” opposite the entry for “Virtualization” if your computer’s microprocessor supports these technologies.

Install VNX

To install VNX, follow the installation instructions in the VNX Documentation. I provide a listing of the procedure I followed below, which is the same as listed in the VNX documentation.

Supporting software

First, we install all the supporting software required by VNX:

$ apt-get install qemu-kvm libvirt-bin vlan \
  bridge-utils screen virt-manager virt-viewer \
  libxml-checker-perl libxml-parser-perl \
  libnetaddr-ip-perl libnet-pcap-perl \
  libnet-ipv6addr-perl liberror-perl xterm \
  libexception-class-perl uml-utilities \
  libxml-libxml-perl libterm-readline-perl-perl \
  libnet-telnet-perl libnet-ip-perl libreadonly-perl \
  libmath-round-perl libappconfig-perl \
  libdbi-perl graphviz genisoimage gnome-terminal \
  tree libio-pty-perl libsys-virt-perl \
  libfile-homedir-perl curl w3m picocom expect \
  imagemagick

Next, we set up libvirt configuration files. Edit the /etc/libvirt/qemu.conf file and set the following parameters. All of these are already in the file on commented-out lines so search for the parameter name to find each one, then modify the parameter value as needed and remove the comment marks on that line.

security_driver = "none"
user = "root"
group = "root"
cgroup_device_acl = [
   "/dev/null", "/dev/full", "/dev/zero",
   "/dev/random", "/dev/urandom",
   "/dev/ptmx", "/dev/kvm", "/dev/kqemu",
   "/dev/rtc", "/dev/hpet", "/dev/net/tun"
]

Then, restart libvirtd for the changes to take effect:

$ sudo restart libvirt-bin

VNX program

Next, I downloaded the VNX software from the VNX web site and installed it using the following commands:

$ mkdir /tmp/vnx-update
$ cd /tmp/vnx-update
$ wget http://vnx.dit.upm.es/vnx/vnx-latest.tgz
$ tar xfvz vnx-latest.tgz
$ cd vnx-*
$ sudo ./install_vnx

Create the VNX config file /etc/vnx.conf. You just can copy the sample config file:

$ sudo cp /usr/share/vnx/etc/vnx.conf.sample /etc/vnx.conf

Download VNX root filesystems

The VNX project provides preconfigured root filesystems in the VNX repository at http://vnx.dit.upm.es/vnx/filesystems. Downloaded filesystems must be stored in the /usr/share/vnx/filesystems directory.

To select, download, and install root filesystems you can use the vnx_download_rootfs script provided by the VNX project or you can manually download and install the root filesystems using a web browser and Linux commands.

What root filesystems do we need?

If you intend to run one of the example scenarios provided with VNX, you need to determine which filesystems you need to install for that scenario.

The VNX documentation describes only a few of the example scenarios provided by VNX. If you wish to run an undocumented example, you need to look in the example XML file to determine which root filesystems you need. List the XML file search for the word, “rootfs”. One quick way to do this is to use the grep command. For example:

$ cd /usr/share/vnx/filesystems
$ grep rootfs tutorial_ubuntu.xml
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu-gui</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>

In the example above, we see that the tutorial_ubuntu.xml example script requires two root filesystems: rootfs_ubuntu-gui and rootfs_ubuntu. The script is referring to the names of the symbolic links that are created when the root filesystem is downloaded using the vnx_download_rootfs script. If we know the file naming conventions used by VNX (which are described at the end of the Downloading VNX root filesystems section of the VNX documentation), we see that we need to download an Ubuntu root file system (of any release) and another Ubuntu root filesystem (of any release) with the GUI installed.

The vnx_download_rootfs script

In the example below, I show how the vnx_download_rootfs script works by using it to install the Debian server root filesystem, which is option 4.

$ cd /usr/share/vnx/filesystems
$ sudo /usr/share/vnx/bin/vnx_download_rootfs

----------------------------------------------------------------------------------
Virtual Networks over LinuX (VNX) -- http://www.dit.upm.es/vnx - [email protected]
Version: 2.0b.2869 (05/07/2013_02:42)
----------------------------------------------------------------------------------

vnx_download_rootfs: download, uncompress and optionally create links to
                     root filesystems for VNX to current directory

Repository:    http://vnx.dit.upm.es/vnx/filesystems/
Current dir:   /usr/share/vnx/filesystems

Num   Rootfs name                                    Date        Size
-----------------------------------------------------------------------
0     vnx_rootfs_kvm_caine-3.0-gui-v025.qcow2.bz2       12-Mar-2013 1.5G  
1     vnx_rootfs_kvm_centos-6.4-gui-v025.qcow2.bz2      08-Sep-2013 2.4G  
2     vnx_rootfs_kvm_centos-6.4-v025.qcow2.bz2          08-Sep-2013 407M  
3     vnx_rootfs_kvm_debian-6.0.7-gui-v025.qcow2.bz2    08-Apr-2013 2.1G  
4     vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.bz2        08-Apr-2013 359M  
5     vnx_rootfs_kvm_fedora-16-gui-v025.qcow2.bz2       09-May-2013 2.3G  
6     vnx_rootfs_kvm_fedora-16-v025.qcow2.bz2           09-May-2013 492M  
7     vnx_rootfs_kvm_fedora-18-v025.qcow2.bz2           18-Apr-2013 932M  
8     vnx_rootfs_kvm_fedora64-18-v025.qcow2.bz2         18-Apr-2013 725M  
9     vnx_rootfs_kvm_freebsd-9.1-v025.qcow2.bz2         21-May-2013 294M  
10    vnx_rootfs_kvm_freebsd64-9.1-v025.qcow2.bz2       21-May-2013 329M  
11    vnx_rootfs_kvm_honeywall-1.4-v024.qcow2.bz2       22-Oct-2012 386M  
12    vnx_rootfs_kvm_kali-1.0-v025.qcow2.bz2            10-Apr-2013 2.4G  
13    vnx_rootfs_kvm_kubuntu-12.10-gui-v025.qcow2.bz2   12-Mar-2013 1.7G  
14    vnx_rootfs_kvm_lubuntu-12.10-gui-v025.qcow2.bz2   12-Mar-2013 1.0G  
15    vnx_rootfs_kvm_lubuntu64-12.10-gui-v025.qcow2.bz2 11-Mar-2013 1.1G  
16    vnx_rootfs_kvm_lubuntu64-13.04-gui-v025.qcow2.bz2 28-Jun-2013 1.0G  
17    vnx_rootfs_kvm_ubuntu-10.04-gui-v025.qcow2.bz2    12-Mar-2013 967M  
18    vnx_rootfs_kvm_ubuntu-10.04-v025.qcow2.bz2        12-Mar-2013 692M  
19    vnx_rootfs_kvm_ubuntu-11.04-gui-v025.qcow2.bz2    12-Mar-2013 1.1G  
20    vnx_rootfs_kvm_ubuntu-12.04-gui-v025.qcow2.bz2    11-Mar-2013 2.0G  
21    vnx_rootfs_kvm_ubuntu-12.04-v025.qcow2.bz2        11-Mar-2013 810M  
22    vnx_rootfs_kvm_ubuntu-12.10-gui-v025.qcow2.bz2    11-Mar-2013 1.3G  
23    vnx_rootfs_kvm_ubuntu-12.10-v025.qcow2.bz2        20-Apr-2013 521M  
24    vnx_rootfs_kvm_ubuntu-13.04-v025.qcow2.bz2        02-Jun-2013 660M  
25    vnx_rootfs_kvm_ubuntu64-12.10-v025.qcow2.bz2      11-Mar-2013 647M  
26    vnx_rootfs_kvm_ubuntu64-13.04-gui-v025.qcow2.bz2  28-Jun-2013 1.3G  
27    vnx_rootfs_kvm_ubuntu64-13.04-v025.qcow2.bz2      28-Jun-2013 714M  
28    vnx_rootfs_kvm_xfedora-18-gui-v025.qcow2.bz2      18-Apr-2013 1.2G  
29    vnx_rootfs_kvm_xfedora64-18-gui-v025.qcow2.bz2    18-Apr-2013 1.3G  
30    vnx_rootfs_uml-debian-6.0-v022.bz2                23-May-2012 369M  
31    vnx_rootfs_uml-n3vlr-0.11-v022.img.bz2            23-May-2012 6.6M  
32    vnx_rootfs_uml_debian-6.0-v024.img.bz2            11-Jun-2012 261M

Type the number [0-32] of rootfs to download or 'q' to quit: 

Enter “4” at the prompt top select the Debian 6.0.7 root filesystem.

Type the number [0-32] of rootfs to download or 'q' to quit: 4

--2013-11-25 23:18:03--  http://vnx.dit.upm.es/vnx/filesystems/vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.bz2
Resolving vnx.dit.upm.es (vnx.dit.upm.es)... 138.4.7.228, 2001:720:1500:57:92b1:1cff:fe6a:5b98
Connecting to vnx.dit.upm.es (vnx.dit.upm.es)|138.4.7.228|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 376832423 (359M) [application/x-bzip2]
Saving to: ‘vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.bz2’

100%[======================================>] 376,832,423 1.08MB/s   in 5m 39s

2013-11-25 23:23:45 (1.06 MB/s) - ‘vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.bz2’ saved [376832423/376832423]

Extracting vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.bz2...
Do you want to create a symbolic link: ''->'vnx_rootfs_kvm_debian-6.0.7-v025.qcow2' (y/n)?

Where the script asks if you want to create a symbolic link, enter “y” to create the link. The script will choose the symbolic link name based on the file name of the chosen filesystem.

Do you want to create a symbolic link: ''->'vnx_rootfs_kvm_debian-6.0.7-v025.qcow2' (y/n)? y

Creating simbolic link...
--2013-11-25 23:55:46--  http://vnx.dit.upm.es/vnx/filesystems/vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.md5
Resolving vnx.dit.upm.es (vnx.dit.upm.es)... 138.4.7.228, 2001:720:1500:57:92b1:1cff:fe6a:5b98
Connecting to vnx.dit.upm.es (vnx.dit.upm.es)|138.4.7.228|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 73
Saving to: ‘vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.md5’

100%[======================================>] 73          --.-K/s   in 0s

2013-11-25 23:55:47 (2.66 MB/s) - ‘vnx_rootfs_kvm_debian-6.0.7-v025.qcow2.md5’ saved [73/73]

------------------------------------------------------------------------
vnx_rootfs_kvm_debian-6.0.7-v025.qcow2 successfully installed.
   md5 in repository:      444d17714b71722e925bb8b5f40d40d3
   md5 of downloaded file: 444d17714b71722e925bb8b5f40d40d3
------------------------------------------------------------------------

The vnx_download_rootf script downloads the filesystem archive, uncompresses it, compares the MD5 checksum to ensure integrity, and create a symbolic link with a simpler name for the filesystem (for use when running the example scripts).

Manual rootfs download

Alternatively, one can download the root filesystems from the VNX repository using a web browser, uncompress the files, install them in the correct directory, and manually create the symbolic links.

In my case, I had previously downloaded the ubuntu filesystems so the Ubuntu filesystems were already in my ~/Downloads folder. These filesystems will be used in the tutorial_ubuntu.xml example scenario.

I executed the following commands to set up these filesystems.

$ sudo cp ~/Downloads/vnx_rootfs_kvm_ubuntu* /usr/share/vnx/filesystems/
$ cd /usr/share/vnx/filesystems
$ sudo bunzip2 vnx_rootfs_kvm_ubuntu-12.04-v025.qcow2.bz2
$ sudo bunzip2 vnx_rootfs_kvm_ubuntu-12.04-gui-v025.qcow2.bz2
$ sudo ln -s vnx_rootfs_kvm_ubuntu-12.04-v025.qcow2 rootfs_ubuntu 
$ sudo ln -s vnx_rootfs_kvm_ubuntu-12.04-gui-v025.qcow2 rootfs_ubuntu-gui

The last two commands in the listing above assign symbolic links to the directories containing the uncompressed filesystems.

If using one of the VNX example scripts — in our case we will use the /usr/share/vnx/examples/tutorial_ubuntu script — check for the symbolic link names used by the XML script. To do this, search the XML example script source code for the *rootfs* link names. A fast way to do this is to use the grep command:

$ cd /usr/share/vnx/examples
$ grep rootfs tutorial_ubuntu.xml
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu-gui</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>
    <filesystem type="cow">/usr/share/vnx/filesystems/rootfs_ubuntu</filesystem>

We can see in the listing above that the tutorial_ubuntu.xml script will use the symbolic links, rootfs_ubuntu-gui and rootfs_ubuntu.

Verify all filesystems are installed

Now we just do a quick check to ensure all the filesystems and symbolic links are installed properly. If we used the vnx_download_rootfs script, we can be confident that everything is OK. Where we installed the filesystems manually, we can check the integrity of the filesystem checksums and verify the symbolic links are set up.

First we check the symbolic link by listing the directory with the command:

$ ls -l
total 10931600
lrwxrwxrwx 1 root root         37 Nov 26 11:13 rootfs_freebsd -> vnx_rootfs_kvm_freebsd-9.1-v025.qcow2
lrwxrwxrwx 1 root root         40 Nov 26 11:36 rootfs_ubuntu -> vnx_rootfs_kvm_ubuntu64-13.04-v025.qcow2
lrwxrwxrwx 1 root root         44 Nov 26 11:36 rootfs_ubuntu-gui -> vnx_rootfs_kvm_ubuntu64-13.04-gui-v025.qcow2
lrwxrwxrwx 1 root root         38 Nov 26 11:40 simple_debian -> vnx_rootfs_kvm_debian-6.0.7-v025.qcow2
-rw-r--r-- 1 root root 1103298560 Apr  8  2013 vnx_rootfs_kvm_debian-6.0.7-v025.qcow2
-rw-r--r-- 1 root root 2257584128 May 20  2013 vnx_rootfs_kvm_freebsd-9.1-v025.qcow2
-rw-r--r-- 1 root root 5074452480 Nov 26 10:57 vnx_rootfs_kvm_ubuntu-12.04-gui-v025.qcow2
-rw-r--r-- 1 root root 2758606848 Nov 25 08:42 vnx_rootfs_kvm_ubuntu-12.04-v025.qcow2

We see the symbolic links in the first four lines of the listing (with the “l” flag), each one pointing to a root filesystem file.

Now we can check the MD5 checksum of the uncompressed filesystems. Download the corresponding .md5 file for each of the filesystems downloaded from the VNX repository and use the md5sum command to check the uncompressed filesystem file. Ensure the .md5 files are in the same directory as the filesystem files (move it to /usr/share/vnx/filesystems), then run the md5sum -c command on the .md5 files. This will check the filesystem file described by the .md5 file.

For example, assume we downloaded the files, vnx_rootfs_kvm_ubuntu-12.04-gui-v025.qcow2.md5 and vnx_rootfs_kvm_ubuntu-12.04-v025.qcow2.md5 to the /usr/share/vnx/filesystems directory. Then we run the command:

$ sudo md5sum -c *.md5
vnx_rootfs_kvm_ubuntu-12.04-gui-v025.qcow2: OK
vnx_rootfs_kvm_ubuntu-12.04-v025.qcow2: OK

Conclusion

We successfully installed the VNX network simulator on an Ubuntu 13.10 system and we are now ready to test this network simulation tool using some of the example scenario XML files provided by the VNX project (specifically, the tutorial_ubuntu.xml scenario).

The VNX project provided adequate documentation for the install procedure and also provided a helpful tool for downloading the filesystems to be used in the example scripts.

Next, We will begin testing the VNX open-source network simulator.

1 thought on “Install the VNX network simulator”

  1. Pingback: VNX Linux Network Simulator Review | Open-Source Routing and Network Simulation Blog

Comments are closed.

Scroll to Top