This post will guide you through setting up a standard Windows computer into a fully capable Network Automation Lab.

To start, we need some hardware. I am using a 16 core CPU and 64GB of RAM, but no specific hardware is required for this. The more CPU and RAM you have, the more Virtual Network Functions (VNF) you can run in parallel.

For the lab to meet our needs, we want to virtualise two different things; VNFs and Containers. Our VNFs require virtual hardware to run; this means that our routers, firewalls and switches need to be run as Virtual Machines (VM) – for this, we will use VirtualBox. We might also want to run different Linux software packages (containerised NFVs, network monitoring etc.) inside Docker containers on our Windows hardware. To do this, we will be using a Windows component called Windows Subsystem for Linux 2 (WSL2).

We will be using Virtual Studio (VS) Code for all of our coding in Windows. As we will probably want most of our code to be running within the Linux environment, VSCode has a feature called “VSCode Server”, which allows you to develop within the Windows environment and run the code within the Linux environment.

Creating VNF/VMs within VirtualBox can be cumbersome. To help with this, we will be installing a package called Vagrant within our Linux environment, which can help automate the creation of VMs within our Windows VirtualBox install.

Virtual Architecture

Installing Software

To start, we need to install some software:

Verifying WSL2

Now that everything is installed. Let’s confirm the Ubuntu and Docker elements are correct in our WSL2 environment. Open a Powershell terminal and run:

PS C:\Users\nfvdev> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         1
  docker-desktop         Running         2
  docker-desktop-data    Running         2

You should see the default installed Ubuntu and the two needed for docker.

If you see Ubuntu at Version 1 like I did above, you should convert it to Version 2 with:

PS C:\Users\nfvdev> wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2, please visit
Conversion complete.
PS C:\Users\nfvdev> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Stopped         2
  docker-desktop         Running         2
  docker-desktop-data    Running         2

Connecting VSCode to Ubuntu

Now that our WSL2 Ubuntu environment is running, we need to connect to it from VSCode.

  • Open Visual Studio Code
  • Navigate to the Extensions section (Ctrl+Shift+X) and search for “remote”.
  • For our purposes, we need “Remote – WSL”; however, I would recommend installing “Remote Development” to get access to “Remote – SSH” and “Remote – Containers” as well. Click the blue “Install” button.
VSCode Remote Development Plugin
  • Once the plugin is installed, click the small green “><” button in the bottom left of the window and click “New WSL Window”.
  • A new window should open, and in the bottom corner, it should say “WSL: Ubuntu”.
  • If you open a new terminal (Ctrl+Shift+’), you should now see you are connected to your Ubuntu instance (Note: it will say the name of your computer rather than “ubuntu”).
VSCode connected to WSL2 (Ubuntu)

Installing Vagrant within Ubuntu

We can now code in Windows and run our code within the Linux environment. The next step is to look at automating VirtualBox with Vagrant. To install Vagrant, follow the steps below from a WSL2 terminal (either in VSCode or Windows Terminal). First, ensure everything is up to date by running:

nfvdev@ubuntu:~$ sudo apt-get update
[sudo] password for nfvdev: 
Get:1 focal InRelease [265 kB]
nfvdev@ubuntu:~$ sudo apt-get upgrade
Reading package lists... Done

Now head to and click on “Debian”, then right-click on “64-bit” and copy the download link.

Vagrant Download

In the WSL2 terminal, enter “wget”, then paste the download link and press enter.

nfvdev@ubuntu:~$ wget
--2021-12-30 10:45:35--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41472132 (40M) [application/x-debian-package]
Saving to: ‘vagrant_2.2.19_x86_64.deb’
vagrant_2.2.19_x86_64.deb                  100%[======================================================================================>]  39.55M  8.55MB/s    in 4.6s    
2021-12-30 10:45:40 (8.51 MB/s) - ‘vagrant_2.2.19_x86_64.deb’ saved [41472132/41472132]

Install Vagrant and confirm it is installed with:

nfvdev@ubuntu:~$ sudo dpkg -i vagrant_2.2.19_x86_64.deb 
Selecting previously unselected package vagrant.
(Reading database ... 32129 files and directories currently installed.)
Preparing to unpack vagrant_2.2.19_x86_64.deb ...
Unpacking vagrant (1:2.2.19) ...
Setting up vagrant (1:2.2.19) ...
nfvdev@ubuntu:~$ vagrant -v
Vagrant 2.2.19
nfvdev@ubuntu:~$ rm vagrant_2.2.19_x86_64.deb 

Next, we will be following the commands listed in The commands below will configure Vagrant within Linux to control the VirtualBox application with Windows.

nfvdev@ubuntu:~$ echo 'export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"' >> ~/.bashrc
nfvdev@ubuntu:~$ echo 'export VAGRANT_WSL_DISABLE_VAGRANT_HOME="1"' >> ~/.bashrc
nfvdev@ubuntu:~$ echo 'export PATH="${PATH}:/mnt/c/Program Files/Oracle/VirtualBox"' >> ~/.bashrc
nfvdev@ubuntu:~$ source ~/.bashrc
nfvdev@ubuntu:~$ vagrant plugin install virtualbox_WSL2
Installing the 'virtualbox_WSL2' plugin. This can take a few minutes...
Fetching rake-13.0.6.gem
Fetching virtualbox_WSL2-0.1.3.gem
Installed the plugin 'virtualbox_WSL2 (0.1.3)'!

Validating Vagrant

Ok, great, we have Vagrant installed within our Linux environment, running on our Windows computer. Let’s check everything is working correctly. First, make a new testing folder in your Ubuntu Terminal with:

nfvdev@ubuntu:~$ mkdir testing && cd testing

Then in VSCode, go to “File” > “Open Folder…” and navigate to your testing folder. For me it is at “/home/nfvdev/testing/”. If you open a terminal again with Ctrl+Shift+’, you should now see a prompt with something like “nfvdev@ubuntu:~/testing$”.

Let’s make a test VM with:

nfvdev@ubuntu:~/testing$ vagrant init hashicorp/bionic64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.

This creates a file called “Vagrantfile” in the folder, open it up by clicking on it:


You can think of this file as an instruction set that tells Vagrant what type of device to create and how to create it. This instance should create a Linux VM for us using the “hashicorp/bionic64” image.

To play nicely with WSL and VirtualBox, we need to disable synced folders by adding the following text into the configuration file. You can add it anywhere within the indented section, but I added it near the synced_folder config:

   config.vm.synced_folder '.', '/vagrant', disabled: true # Added line to disable synced_folders.

A full version of the Vagrantfile can be found at

Now we can spin up our test virtual machine with “vagrant up”:

nfvdev@ubuntu:~/testing$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hashicorp/bionic64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'hashicorp/bionic64' version '1.0.282' is up to date...
==> default: Setting the name of the VM: testing_default_1640862439257_62411
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases, this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: Guest Additions Version: 6.0.10
    default: VirtualBox Version: 6.1

If you now check within VirtualBox, you should see a new VM created:

VirtualBox with test VM

We can also SSH to the testing Virtual Machine from our Ubuntu terminal with “vagrant ssh <name>”:

nfvdev@ubuntu:~/testing$ vagrant ssh default
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-58-generic x86_64)
 * Documentation:
 * Management:
 * Support:
  System information as of Thu Dec 30 11:10:04 UTC 2021
  System load:  0.07              Processes:           92
  Usage of /:   2.5% of 61.80GB   Users logged in:     0
  Memory usage: 11%               IP address for eth0:
  Swap usage:   0%
 * Super-optimized for small spaces - read how we shrank the memory
   footprint of MicroK8s to make it the smallest full K8s around.
0 packages can be updated.
0 updates are security updates.

Once we are done exploring, we can destroy the VM with “vagrant destroy”:

vagrant@vagrant:~$ exit
Connection to closed.
nfvdev@ubuntu:~/testing$ vagrant destroy
    default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...

This tears down the VM and removes it from VirtualBox. Finally, we can remove our testing folder:

nfvdev@ubuntu:~/testing$ cd .. && rm -r testing

Installing Python within Ubuntu

Whilst you have a terminal open to the Ubuntu WSL2 environment, it is a good time to also install python with:

nfvdev@ubuntu:~/testing$ sudo apt-get install python3 python3-venv python3-pip

Wrap Up

So what have we done? We gave our Windows computer the ability to:

  • Write code in Visual Studio Code from our Windows interface and have the ability to run it within our Linux environment.
  • Use Vagrant (in Linux) to automate the provision of Virtual Machines for us within Virtual Box (in Windows).
  • Installed Docker to play around with containers in the future.