Dealing with VLANs with IMUNES and OpenVSwitch


it has been a long time since my last post.
I'm writing this to make a brief recap on how to deal with VLANs in IMUNES on Linux, using the Open-vSwitch CLI tools.

The purpose is to give a reference point to students who are approaching the final project for the Computer Networking classroom @ Unimi.
As I've discussed during the class (see Lesson 3, Bridges and Switches), IMUNES doesn't come with built-in support for VLAN tags at switch level.
You can set up VLAN tags only on interfaces declared with iproute2, I think for a compatibility reason between the BSD version and the Linux version of the product.

However we should keep in mind that IMUNES makes use of Open vSwitch to manage bridges on Linux. That is to say that one can use Open vSwitch CLI tools to accomplish advanced tasks, such as assigning VLAN tags directly on the switch ports through Open vSwitch.

Another important thing we have to consider before proceeding, is the mapping between IMUNES UI and real bridges names.

What happens when the user runs the experiment?

IMUNES spawns a Docker container for each host or L3 device (router) declared in the topology.

Le frasi tipiche del non-informatico all'informatico

Solitamente scrivo post esclusivamente in inglese, per rivolgermi a un pubblico un più vasto, nonostante i visitatori del mio blog non siano poi molti.
Ho deciso, però, di fare un'eccezione per questo articolo, e di rivolgermi per questa volta a un pubblico di soli italiani.

Voglio riassumere qui le frasi, le domande, le richieste tipiche, rivolte dai non-informatici agli informatici, giusto per provare a essere simpatico, o magari per stare un po' più sulle palle a chi si sentirà ripreso da questo articolo.
Sono richieste usuali, a volte (spesso) imbarazzanti, a cui solitamente non segue risposta alcuna o, raramente, seguono risposte vaghe e senza senso.

  • "Allora? Oh questo è n'hacker, è er mejo. Quanno ce entramo nei computer della banca per fregà qualche soldo?

  • Qual'è il miglior antivirus?

  • Ma se io ho l'antivirus perché continuo a prendere virus?

  • Oh, ho comprato il computer nuovo! Però non tutto... solo il cervello, il televisore ho lasciato quello che avevo prima (con ovvia accezione al proprio monitor, rigorosamente 15", con risoluzione massima 1024x768)

  • Oh, te che te ne intendi di computer, mi rimetti l'orologio della macchina?

  • Senti, te fai il programmatore no? Ah non fai il programmatore? Vabbè mi aggiusti il pc?

  • Un

Networking Laboratory - Lessons archive

Hi :)
These are the slides I've made with prof. Claudio Ardagna for the Networking laboratory class, which I've been supporting during this academic year at University of Milan.
The main tool we've used during the lab has been IMUNES, an open-source network topology simulator built on top of Docker and Open vSwitch.

Using this software we've been able to explore characteristics and implement functionalities of the whole network stack.

Slides are in italian language and cover only a part of the whole course.
They are open and free to use, but please if you use them as provided, keep the credits :)
If you need the PPTs, contact me via mail.

Enjoy them!


  1. Software defined networks and IMUNES
  2. Introduction to IMUNES
  3. Level 2 - Bridging and Switching
  4. Introduction to Level 3 - ARP Protocol
  5. Level 3 - IP Protocol
  6. Level 3 / Level 7 - DHCP
  7. Exporting a network topology with IMUNES
  8. Level 3 - Static routing
  9. Level 3 - Cisco syntax, dynamic routing and OSPF
  10. Level 3 - Firewalls and NAT
  11. Level 7 - Domain name system


If you find any error or inaccuracy in the content please report it to me, so that I can fix it.

IMUNES: how to export changes made to an experiment - Part 2


Today I've written again from scratch the two BASH scripts to export changes made in IMUNES, this time using Python.
I've built a UI with GTK3 using Glade, and I've organized the code in a more clean and safe way.
Docker management is done via the official library docker-py.


The software is available on GitHub:


  • Clone the repository and browse it
git clone  
cd ImunesExperimentExporter  
  • Install dependencies through Pip
pip install -r requirements.txt  
  • Install the software by calling
sudo python2 install  
  • Enjoy the software calling it with the command

You need to have Docker configured for listening on UNIX socket (at the path /var/run/docker.sock). Please note that in a normal environment this socket file is owned by root and docker group, so it could be needed to run imunes-export with root or docker group privileges.

Export a topology

You can choose to export a single container or the whole experiment.
The execution flow is the same as the last time.

  1. Draw a topology
  2. Run the experiment
  3. Make changes you want to make (e.g. configurations, your files, etc.)
  4. Use my software

IMUNES: how to export changes made to an experiment

These are two snippets I've written in BASH in the last few days to allow IMUNES users to export changes made to an experiment in runtime, on Linux.
The former allows users to export changes, the latter allows them to load changes back to Docker containers.
They will be improved day by day, so it's recommended to consult this page to get an updated version of them, especially if you encounter problems.

The execution flow to use these scripts properly is:

  1. Draw a topology
  2. Run the experiment
  3. Make changes you want to make (e.g. configurations, your files, etc.)
  4. Use the first script to export those changes to your computer's file system
  5. Stop the experiment
  6. Save the topology
  7. Close IMUNES

  1. Open IMUNES again
  2. Load the topology back
  3. Execute the experiment
  4. Use the second script to load your previously exported changes back
  5. Enjoy!


  • Your Linux distribution needs to have the zenity package installed
  • Both scripts need to be executed with root privileges or by a user that is assigned to the docker group. Remember that if you run them with root privileges, the files created by them will be owned by root, so you could encounter permission problems.
  • You can

Some details about the network topology simulator

In my last post I told you I want to develop a network topology simulator, but I haven't given you any technical details about it, except for the fact I want to use Docker and OpenvSwitch, just like IMUNES already does.
The whole project was only on my mind, so I decided to take some notes about the components I have to build and about how I want to implement things.
Now, I'm sharing those notes with you.

To simulate a network topology I would have to reproduce the behavior of ISO/OSI's level 2 and level 3.
To implement level 2, I'd use OpenVSwitch, that is a SDN-based layer 2/3 switch. Links would be realized with Linux kernel's iproute, and associated with ports on OVS.
I also want to let the user specify some informations about the links, such as bandwidth, delay, MTU, etc.
Level 3 and above features are going to be implemented with Docker: containers can represent hosts running services and network devices (such as firewalls and routers).
To do this, I think I'd need to run Docker containers with all capabilities; this could represent a security issue, but I will address this later.
Since Docker

New project: SDN-based network topology simulator

Next week I'm going to start a tutoring for the Networking laboratory class at University of Milan, in Crema.
One of the most difficult tasks I had to accomplish, has been to find the right appliance to be used to teach networking concepts to students.
For the moment I've decided to use IMUNES, a software that builds network topologies on top of Docker containers and OpenvSwitch.
IMUNES is a great software, but it lacks of some functionalities I need to use (such as VLAN tagging on OpenvSwitch ports, trunking, and storage persistence for Docker containers running services), and even if it can be set up easily, its deployment required some effort due to some our environmental characteristics.
The result is that I decided to start a new project: my own network topology simulator, built on the same technologies as IMUNES, web based, multi-user and cloud ready.
I want to develop a software that developers, organizations and universities can use for testing, research, experiments and teaching purposes; it has to be elastic, scalable (cause it's cool too say to someone "my software scales well dude!"), as-a-service and obviously open-source.
Maybe I will fail, maybe it won't never work, maybe the project