Installation

netlab is a Python3 package[1] that uses Python 3.8[2] or later. We recommend using netlab on Linux (we’re doing all our tests on Ubuntu), including Windows Subsystem for Linux or Multipass on macOS. While you might be able to get netlab to run natively on Windows or macOS with VirtualBox, we no longer support that.

netlab is a high-level abstraction and orchestration tool that relies on other tools to provide the low-level functionality:

  • VM/container virtualization with KVM or Docker[3]

  • Virtualization API: libvirt (used with KVM on Linux)

  • VM/container orchestration: Vagrant or containerlab

  • Configuration deployment: Ansible 2.9.1[4] or later

High-level architecture

If you already have an environment that can be used with netlab, please proceed directly to installing Python package. Otherwise, you’ll have to select the platform you want to use and create your lab environment (including netlab installation). You can also run netlab with container-based network devices in GitHub Codespaces (netlab examples, BGP labs, IS-IS labs).

Selecting the Platform and Low-Level Tools

We have tested netlab with libvirt/KVM and Vagrant on Ubuntu and Fedora and with Docker and containerlab on Ubuntu[5]. Both combinations should work on other Linux distributions. You can also run netlab in a Linux virtual machine or a Ubuntu instance in a public cloud.

When selecting the virtualization environment, consider the following:

  • We are developing and testing netlab on Ubuntu. Ubuntu-based netlab is also easiest to set up; the netlab install command does all the heavy lifting for you and installs all the prerequisite software (KVM, libvirt, Vagrant, Docker, containerlab, Ansible).

  • Vagrant provider for libvirt supports parallel VM provisioning, resulting in pretty fast lab creation. Unfortunately, most vendors don’t offer virtual devices packaged as libvirt Vagrant boxes, so you must build your boxes manually. The netlab libvirt package usually does 90% of the work for you.

  • Containers provisioned with containerlab start much faster than virtual machines, but you can get only a few network devices in native container format (Arista cEOS, FRR, Nokia SR Linux, VyOS). On the other hand, the vrnetlab fork by Roman Dodin can build containers running virtual machines for numerous network devices.

We no longer recommend or support VirtualBox-based solutions. It is no longer needed on Windows; Windows Subsystem for Linux is a much better option. Apple stopped shipping x86-based hardware years ago, and no major vendor is shipping ARM-based VM images for network devices.

Creating the Lab Environment

We have documented how you can set up your lab:

Tip

If you decide to run the network labs within an Ubuntu VM, create a new VM and use the automated software installation procedure. Starting with a fresh VM is much easier and safer than installing the necessary software on an existing VM.

Finally, you can use netlab on Apple Silicon (basics, using Arista cEOS), but all we managed to do was to run containers (Arista EOS, FRR, SR Linux) on a Multipass-provisioned Ubuntu VM. If you’re using a laptop with Apple silicon, run more complex labs on a Ubuntu VM running on-premises or in a public cloud, or a bare-metal server.

Building Boxes and Containers

Installing Python Package

To install netlab on an existing system that already has the low-level tools installed, use python3 -m pip install networklab. The installation process will install all prerequisite Python packages and create the netlab command.

If you want to get the latest development code or if you want to participate in netlab development, clone the GitHub repository.