Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Setting up test environment

Sviatoslav Chagaev edited this page Dec 31, 2020 · 1 revision

Introduction

This page describes one concrete way to set up a virtual testing environment where experiments with the xdp package can be performed safely.

Prerequisites

  1. Familiarity with Linux and virtualization.
  2. Host computer with enough memory and CPU cores to run at least 2 virtual machines.
  3. Some up-to-date distribution of Linux as the host OS, e.g. Fedora Linux.

Steps

Install Virtual Machine Manager

In Software app, look for and install the Virtual Machine Manager, it's a GUI which allows to manage KVM/QEMU virtual machines and virtual networks that connect them.

Screenshot-from-2020-12-31-15-40-56

Create an isolated virtual network for XDP experiments

Open Virtual Machine Manager, click EditConnection DetailsVirtual Networks and add a new 'isolated' network for XDP experiments, each VM will have a second network interface connected to this network to enable the VMs to communicate using XDP with each other without risking leaking the packets into your home/office network.

Screenshot-from-2020-12-31-15-52-00

Install and configure an Ubuntu 20.04 VM

Download Ubuntu 20.04 Server ISO and use it to create a new virtual machine in Virtual Machine Manager.

Once the VM is installed, log in and install the software that you will need, it's better to do this now, because we will use this first VM as a "template" to instantiate a second VM, for example:

sudo apt install ethtool tmux git golang vim netcat iperf3 tcpdump
go get github.com/asavie/xdp

Configure the second network interface

Shut down the VM and in it's window, click ViewDetailsAdd Hardware and add a second network interface, putting it inside the XDP test network and adding the <driver name="vhost" queues="X"/> (where X is the number of queues you want the network interface to have) line in the network interface's XML, to enable multi-queue.

Screenshot-from-2020-12-31-15-58-34 Screenshot-from-2020-12-31-15-58-57

Clone the first VM to create a pair of testing VMs

Right-click on the original Ubuntu VM and then click Clone....

Log into the cloned VM using the Virtual Machine Manager's GUI console and

  1. Change the hostname of the cloned VM:
sudo hostnamctl set-hostname u002
# Edit /etc/hosts to add an entry for 127.0.0.1 for the new hostname:
sudo vi /etc/hosts
  1. Generate a new machine ID so that the cloned VM doesn't get the same IP address as the original VM:
sudo rm -f /etc/machine-id
sudo systemd-machine-id-setup
sudo reboot

Check if configuration is working and start experimenting

Bring the second network interfaces up on each VM by running sudo dhclient enp6s0 and not the IP address that was assigned to the second network interface by running ip addr.

Try pinging the other VM using the second network interface's IP address to check that there's connectivity between the VMs.

Before starting the experiments, you might want to configure the queues on the second network interface, you can do that using the sudo ethtool -L enp6s0 combined X command, where X is the number of RX queues you want the network interface to have. It seems that at least in Linux kernel 5.4, the virtio_net driver doesn't allow any more fine-tuning than this (e.g. the ethtool -N command is not supported), but it's still enough to be able to experiment with multiple queues.

Start experimenting with XDP!

References