Install the Antidote (NRE Labs) network emulator on a Linux system

Antidote is a network emulator combined with a presentation framework. It was designed to create and deliver networking technology training. Its user interface operates in a web browser, including the terminals that students use to run commands on emulated network devices and servers.

Antidote is the engine that runs the Network Reliability Labs web site. Antidote is an open-source project, released under the Apache license. A standalone version of Antidote may be installed and run on your personal computer using the selfmedicate script. In this post, I will install Antidote and configure it to improve Antidote performance on my Linux system.

UPDATE November 15, 2019: The NRE Labs project has made significant changes to the way Antidote is installed on a local PC. They now use vagrant to simplify the process. Vagrant will perform all the steps outlined below so this post is now obsolete.

I will write a new blog post about modifying the Vagrantfile so you can run the Antidote VM on Libvirt instead of Virtualbox. To learn more, Read page 34 of the PDF version of the Antidote documentation or read the Vagrant section in the HTML version of the documentation.

Antidote documentation

The Antidote documentation is being expanded regularly but, at the time I am writing this, the most helpful information is in the NRE Labs blog and in the videos produced by the developers. Most of these are accessible from the NRE Labs Community Resources page.

Also, Antidote is in active development and it is changing quickly as the developers create new features and content. Keep that in mind when following this blog post. Some things may already have changed about the way Antidote installs or operates.

Install prerequisite software

Antidote requires that you install some prerequisite software before you try to run Antidote. I am changing the documented installation procedure a bit and installing KVM instead of VirtualBox so Antidote can use nested virtualization on my laptop. Then, I install Minikube and Kubectl so I can mimic a Kubernetes system on my laptop. Don’t worry; you do not need to know Kubernetes to use Antidote.

Check for virtualization support

Verify your computer has hardware support for virtualization. Enter the following commands in the VM’s terminal.

grep -cw vmx /proc/cpuinfo

It should return a value equal to the number of virtual cores on your processor. If it returns 0, then something is wrong.

We need to use nested virtualization because we are running network nodes inside a VM created by Antidote. Check the nested virtualization settings on the host computer:

cat /sys/module/kvm_intel/parameters/nested

The output should be “Y”. If it is “N”, run the following commands to enable nested virtualization:

sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1

To make the changes persistent after a reboot, edit the file /etc/modprobe.d/kvm.conf and modify the following line to:

echo "options kvm_intel nested=1" | sudo tee /etc/modprobe.d/kvm.conf

Install virtualization software

Install KVM and Libvirt on your Linux system:

sudo apt update
sudo apt -y install libvirt-clients libvirt-daemon-system qemu-kvm
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
sudo usermod -a -G libvirt $USER
newgrp libvirt

Docker KVM2 Driver

Install the Docker KVM driver:

curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
sudo install docker-machine-driver-kvm2 /usr/local/bin/
rm docker-machine-driver-kvm2

Docker

I need Docker so I can build my own images for Antidote and run Syringe commands on my Linux PC. Install Docker using the following commands:

sudo apt -y install docker.io
sudo usermod -aG docker $USER
newgrp docker

Kubernetes

Antidote uses Kubernetes to orchestrate the containers in its network emulation labs. You can run Kubernetes on a laptop computer using Minikube and Kubectl.

Install Kubectl. The Antidote-selfmedicate instructions require version v1.13:

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo cp ./kubectl /usr/local/bin
rm kubectl

Install Minikube. The Antidote-selfmedicate instructions require version v0.34.1

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.34.1/minikube-linux-amd64
chmod +x minikube
sudo cp minikube /usr/local/bin
rm minikube

Download and install Antidote

Antidote requires you to create a lessons directory before you install it. Download the nrelabs-curriculum directory from the NRE Labs Github repository.

cd ~
git clone https://github.com/nre-learning/nrelabs-curriculum

Download the antidote-selfmedicate directory. Unless you specificy a new location in the configuration file (see below), you must install this directory at the same point in your filesystem as the nrelabs-curriculum directory. That is, each of these should be sub-directories of the same directory.

cd ~
git clone https://github.com/nre-learning/antidote-selfmedicate
cd antidote-selfmedicate

Configure Antidote-Selfmedicate

Antidote-Selfmedicate has some default values pre-configured the tell it which hypervisor to use, how much resources the Minikube VM should consume, and the location of the lessons directory. The user may modify any of these values by creating an Antidote-Selfmedicate configuration file.

The file must be created in your home folder as a text file in a hidden directory. Create the configuration file, named config, in the hidden directory named ~/.antidote:

cd ~
mkdir .antidote
cd .antidote
nano config

Enter in values appropriate for your own situation. I explain how I chose my configuration later in this section. For my specific situation, I chose the following configurations, to be entered as shown in the config file:

CPUS=2
MEMORY=4096
VMDRIVER="kvm2"
LESSON_DIRECTORY="../nrelabs-curriculum"

Save the file.

Number of CPUs and Memory

I am using my 9-year old Lenovo T420 laptop, which only has two hyper-threaded CPU cores and 8 GB memory. It is not powerful enough to run the Antidote VM using default configurations. After some experiments ((When I increased the Antidote VM size to 4 GB, 95% of my system’s memory was consumed because I also needed a web browser and a text editor running at the same time.I was using Firefox and VScode on an Ubuntu 18.04 desktop. Maybe if I used lighter-weight tools like Midori and vim on an XFCE desktop, I could squeeze out enough space to run a larger VM for Antidote VM.)), I found that running an idle Antidote VM with 4 GB of RAM, alongside the other tools I use, results in the general performance of my laptop staying in an acceptable range.

I also found performance is much better when I respect the KVM Performance Limits for virtual CPU cores, so I set the VM vCPU requirements to 2 CPU.

This reduced configuration will probably not run the VQFX images that come pre-installed with Antidote, so I will not be able to experiment with the labs that require them. This is OK because I am not interested in working with commercial router images. Instead, I am planning to build and install my own images into Antidote and run open-source routers. Open-source routers require fewer resources.

VM Driver

By default, Antidote-selfmedicate uses the Virtualbox hypervisor to manage the Minikube VM, The latest version of VirtualBox supports nested virtualization on AMD processors but my laptop uses an Intel processor so I cannot use Virtualbox to run nested VMs on my laptop.

I will use the KVM hypervisor, which supports nested virtual network nodes on the Antidote VM on my Linux laptop. When using nested KVM virtual machines, you should expect to see less than a ten percent performance penalty, compared to normal virtual machines.

Lesson directory

I already installed the nrelabs-curriculum directory in the default location so I could leave our the line for configuring the directory location, but I chose to explicitly configure it just to show how it is done.

Start Antidote

After I configured it to meet my requirements, I ran the selfmedicate.sh script to start Antidote:

$ cd ~/antidote-selfmedicate
$ ./selfmedicate.sh start

This takes a long time because it downloads some large files. Be patient. The output will look like the screenshot below:

After it is running, you may access the Antidote web interface running on your PC by opening a web browser and entering the following URL:

http://antidote-local:30001

You should see a web page that looks and operates like the NRE Labs web page:

At this point, you can experiment with the existing NRE Labs lessons on your laptop. Remember, if you modified the size of the Minikube VM in the selfmedicate.sh script, you may not be able to run the lessons that use the VQFX routers.

Loading lessons

The selfmedicate.sh script does not load the lesson content into the Antidote VM when it starts. You must run the reload command to load in the lessons for the first time.

$ cd ~/antidote-selfmedicate
$ ./selfmedicate.sh reload

When you update lessons or add new lessons, you must run the reload command, again. Then, refresh your browser window to see the new lessons.

Stopping and restarting Antidote

You should not need to run the start option, again. From now on, only use the stop and resume options.

To stop the Antidote environment, run:

./selfmedicate.sh stop

To restart Antidote, run:

./selfmedicate.sh resume

If you use the start option, the selfmedicate.sh script will delete your existing Antidote VM and re-install everything. This is a good way to recover from a problem, but it is not something you need to do every time.

Creating labs for Antidote

In a future post, I’ll work through the process of creating a new lesson, using open-source router images instead of commercial router images. I still need to spend some time figuring this out.

At the time I wrote this post, the Antidote documentation does not cover much information about how to create new Antidote labs. The NRE Labs blog and videos on the NRE Labs Community Resources page provide some good information about building labs for Antidote. For example, read the post on the NRE Labs blog about how NRE Labs implements curriculum as code. You can also reverse-engineer existing lab lessons.

I found some useful information about making Docker images for Antidote on the OpenJNPR-Container-vMX project on GitHub and there’s also a VQFX image to reverse-engineer on the nre-learning GitHub page.

Conclusion

Antidote is a promising new platform upon which users can create classroom-style labs that are combined with documented procedures. It provides an easy-to-use web-based interface that makes it easy for students to log into the lab nodes using only a web browser. It is available as a free web service and can also be run on your laptop, as shown in this post.

Interestingly, Antidote is focused on the tools used to manage and support a network and used the network nodes only as a target for management. So, it does not offer “traditional” tools that allow manipulation or inspection of the network, such as a network graph tool or Wireshark. You are expected to define the network nodes and their connections in a YAML file and then use a Utility VM to run various network automation tools.

Antidote seeks to make it easy for users to create “next generation” network lab scenarios, where the focus is more on automation and management, instead of on protocols and configuration.

4 thoughts on “Install the Antidote (NRE Labs) network emulator on a Linux system”

  1. Thanks for the wonderful post. I followed all instructions exactly without errors except I cannot start Antidote due to error as follows. Please help

    root@ubuntu:~/antidote-selfmedicate# ./selfmedicate.sh start
    Error – ../nrelabs-curriculum doesn’t look like a proper curriculum directory.
    Either this directory wasn’t found, or the subdirectory ‘lessons’ within that directory wasn’t found.

    In either case, this script cannot continue. Please either place the appropriate directory in place, or
    edit the LESSON_DIRECTORY variable at the top of this script.

    root@ubuntu:~/antidote-selfmedicate#

    1. Hi Shahid, please check the the antidote-selfmedicate and nrelabs-curriculum directories are both in the same directory (example: both in your home directory). Thanks, Brian

  2. Pingback: Create lab lessons for the NRE Labs Antidote network emulator | Open-Source Routing and Network Simulation

  3. Pingback: Video chat about NRE Labs | Open-Source Routing and Network Simulation

Comments are closed.

Scroll to Top