Software Installation and Lab Setup

It’s easiest to use the BGP labs with netlab. Still, you can use most of them (potentially with slightly reduced functionality) with any other virtual lab environment or on physical gear. For the rest of this document, we’ll assume you decided to use netlab; if you want to set up your lab in some other way, read the Manual Setup document.

Warning

While BGP labs work with netlab release 1.8.3 or later, we recommend using a recent release (for example, 25.09). If you’re using an earlier netlab release, please upgrade with pip3 install --upgrade networklab.

Select the Network Devices You Will Work With

FRRouting devices can be run in all netlab-supported virtualization environments (Docker containers or KVM/libvirt virtual machines), and if you want to start practicing BGP with minimum hassle, consider using them for all lab devices.

If you’d like to use a more traditional networking device, use any other netlab-supported device for which we implemented basic BGP configuration as the device to practice with1. I recommend Arista cEOS or Nokia SR Linux containers; they are the easiest ones to install and use.

Tip

You must use container-based network devices such as Arista cEOS, FRR, Nokia SR Linux, or VyOS to run the BGP labs in GitHub Codespaces.

Select the Additional Devices in Your Lab

The labs heavily rely on external BGP feeds – preconfigured devices with which your routers exchange routing information. You won’t configure those devices, but you might have to log into them and execute show commands.

It’s best if you use FRR containers or virtual machines for external BGP feeds, but you can choose any one of these devices4:

Environment Devices that can be used
as external BGP feeds2
Containers (clab) Arista EOS, FRR, Nokia SR Linux3
Virtual machines (libvirt) Arista EOS, Aruba AOS-CX, Cisco IOSv, Cisco IOS-XE, FRR
ARM (Apple) CPU Arista EOS, FRR, or SR Linux containers

Tip

  • Several more complex labs require additional configuration on the external routers. That configuration is usually available for Arista EOS and FRR.
  • Each lab description contains specific device requirements section. Consult those if you want to use less-popular devices in your labs.

Select the Virtualization Environment

Now that you know which network device to use, check which virtualization environment you can use. I prefer containerlab over libvirt (containers usually start faster), but that’s just me.

Tip

You can also run the BGP labs in a free GitHub Codespace.

Everything else being equal, I’d create a Ubuntu VM on Windows or MacOS (including Macs with Apple silicon) to run netlab. You could also invest in a tiny brick of densely-packed silicon (example).

A gotcha: your hardware and virtualization software (for example, VirtualBox or VMware Fusion) must support nested virtualization if you want to use libvirt on that Ubuntu VM. You don’t need nested virtualization to run Docker containers unless you’re using the crazy trick we’re forced to use for Aruba AOS-CX, most Cisco platforms, Junos, or Nokia SR OS – they’re running as a virtual machine within a container.

Software Installation

Based on the choices you made, you’ll find the installation instructions in one of these documents:

Once you have completed the software installation, you have to deal with the stupidities of downloading and installing network device images (libvirt, containers) unless you decided to use FRR, Nokia SR Linux, or Vyos.

I would love to simplify the process, but the networking vendors refuse to play along. Even worse, their licenses prohibit me from downloading the images and creating a packaged VM with preinstalled network devices for you5. Fortunately, you only have to go through this colossal waste of time once.

Setting Up the Labs

We finally got to the fun part – setting up the labs. If you’re not using GitHub Codespaces:

  • Select a directory where you want to have the BGP labs
  • Clone the bgplab GitHub repository with git clone https://github.com/bgplab/bgplab.git. GitHub UI gives you other options in the green Code button, including Download ZIP

After you get a local copy of the repository:

  • Change the directory to the top directory of the cloned repository6.
  • Verify the current project defaults with the netlab defaults --project command7:
$ netlab defaults --project
device = frr (project)
groups.external.device = frr (project)
provider = clab (project)
  • If needed, change the project defaults to match your environment with the netlab defaults --project _setting_=_value_ command or edit the defaults.yml file with a text editor like vi or nano. For example, use these commands to change your devices to Cisco CSRs running as virtual machines8:
$ netlab defaults --project device=csr
The default setting device is already set in project defaults
Do you want to change that setting in project defaults [y/n]: y
device set to csr in /home/user/BGP/defaults.yml

$ netlab defaults --project provider=libvirt
The default setting provider is already set in netlab,project defaults
Do you want to change that setting in project defaults [y/n]: y
provider set to libvirt in /home/user/BGP/defaults.yml
  • In a terminal window, change the current directory to one of the lab directories (for example, basic/1-session), and execute netlab up.
  • Wait for the lab to start and use netlab connect to connect to individual lab devices
  • Have fun.
  • When you’re done, collect the device configurations with netlab collect (if you want to save them) and shut down the lab with netlab down
  • Change the current directory to another lab directory and repeat.
  • Once you run out of lab exercises, create a new one and contribute it with a pull request ;)

  1. You will have to run the labs on a device with an x86 CPU (Intel or AMD). 

  2. You can only use devices supported by bgp.session and bgp.policy netlab plugins as external BGP feeds. 

  3. You must install additional software to configure Nokia SR Linux. 

  4. If you’d like to use other devices as external BGP feeds and are willing to contribute your changes, please add the support for your devices to bgp.session and bgp.policy plugins. Thank you! 

  5. I’m not going to pay a lawyer to read their boilerplate stuff, and I’m definitely not going to rely on my amateur understanding of US copyright law. 

  6. bgplab if you used the simple version of the git clone command 

  7. Available in netlab release 2.0.1 and later. Edit the defaults.yml file if you’re using an older release. 

  8. Assuming you built the CSR Vagrant box first