Nicola Bena

IMUNES on Apple Silicon

April 22, 2022

In the laboratory of Computer Networks we use IMUNES. Contrary to other teaching tools, networking equipment in IMUNES is implemented in real, though virtualized, technologies. For instance, hosts are Docker containers, and switches are Open vSwitch bridges.

Since it is not very easy to install, in 2019 we started providing a fully-configured Ubuntu VM. Naturally, the VM is meant for AMD64 architectures, since all students laptops are (were) based on this architecture.

With the release of Mac powered by the Apple Silicon architecture, we had to figure out other ways to deliver IMUNES, since the AMD64 VM cannot be virtualized on an ARM PC as is. Emulating the whole Ubuntu VM is not a viable solution, since the overhead is very high, and the VM performances are poor. However, Mac can virtualize VM with the same native architecture. Below I provide the instructions on how to setup an Ubuntu VM with IMUNES with and on an ARM-based architectures. Note that the instructions apply to any non-AMD64 architectures. For instance, if you own an ARM laptop running Linux, these instructions should work too, just skip the first part related to the setup of the VM.

The main issue of IMUNES on ARM is related to the Docker images it uses to represent hosts. Docker runs natively on ARM, but the images used by IMUNES are not compiled for ARM and therefore do not work. The solution is simple: building the images natively on the ARM VM, and tagging them with the same tags used by IMUNES. In fact, images built on a local machine are of the same architecture of the local machine. This way, when IMUNES fires a new container, the images are available locally. This is the only difference, the other instructions describe a plain installation of IMUNES. Note that the long-term solution is the availability of multi-architecture build of the IMUNES images.

Ubuntu VM

As of now, we recommend using UTM for virtualization. It offers a user-friendly interface which is very easy to use and somewhat similar to VirtualBox. You then need to download the ISO of Ubuntu from the official website. Be sure to choose the ARM version 64 bit (downloadable from here). Different versions of Ubuntu and even of Linux should work fine too, provided that you use the correct package manager and the name of the packages.

To create a new VM follow the steps below.

  1. Open the app and select create a new virtual machine
  2. Choose Virtualize
  3. Choose Linux
  4. Click Browse of the option Boot ISO Image. I have not tested the usage of Apple Virtualization, but it might work. Click then next.
  5. Configure RAM, CPU, and disk size according to your hardware. 4 to 6 of RAM should be enough, as well as 40 GB of disk.
  6. Optionally, select a directory from your PC to mount as a shared directory within the guest.
  7. Finalize the settings and click Save.

Then, start the VM and follow the instructions provided by the installation process. Once complete, restart the VM and install the guest tools, allowing to use shared directories and shared clipboard between the guest and the host OS.

sudo apt install spice-vdagent spice-webdavd

No reboot is needed to enable these features once the packages are installed.

IMUNES Installation

The following steps apply for any IMUNES installation on a Linux PC. The installation basically is a two-steps process. First, we install all the required dependencies. Second, we download the IMUNES source code and package it into an executable.

Dependencies

First, we install Docker following the instructions from the official website. Follow the steps carefully, including the post-install instructions here.

We then install Open vSwitch and the other run-time requirements of IMUNES.

# Open vSwitch and additional dependencies
# make and git are required to package IMUNES.
sudo apt install util-linux openvswitch-switch xterm wireshark imagemagick tcllib tk git make

Finally, we download IMUNES and we package it.

# Execute this command in a directory of your choice, e.g., your home directory
git clone https://github.com/imunes/imunes.git

# cd into that directory
cd imunes
# and install IMUNES.
sudo make install

# Post-installation for IMUNES.
sudo imunes -p

Post-Installation

The following steps are peculiar for ARM and any other non-AMD64 architectures. They consist of cloning the repo containing the images IMUNES uses, and of building them locally, matching the PC’s architecture.

Update 2022-05-24: this (updated) step works also for anyone having problems with Quagga. By default, IMUNES uses debian 9, but the Quagga package in such image does support systemd only, while the image itself works with sys v. This means that commands such as service quagga start do not work [source]. To solve this issue, I forked the repository of the official IMUNES images, adding support for ubuntu 16.04, whose Quagga package supports sys v. The commands below clone this repository, build the images, and set the default image to ubuntu 16.04 rather than debian 9.

# clone the repo into the directory you prefer
# OLD: git clone https://github.com/imunes/vroot-linux.git
git clone https://github.com/nbena/vroot-linux.git

cd vroot-linux

# build the images
# OLD: edit the makefile excluding debian-8 from the list of tags
make build_all

These are the only required steps. The target build_all builds all the required images and tags them accordingly. At this point, you can start IMUNES and make sure everything works as expected.

Note: debian 9 has been heavily tested by the IMUNES team, while ubuntu 16.04 not, so there may be some other issues which we are currently not aware of. Our plan, as of writing, is to use two test suites to evaluate the suitability of ubuntu 16.04: our exercises, and, if not too complex, imunes-examples. If we manage to solve the issues that come up, we will make a pull request to the official repository, and include multi-platform images in the Docker hub, so that manual images building can be avoid at all.