-
Notifications
You must be signed in to change notification settings - Fork 62
Setting up test environment
This page describes one concrete way to set up a virtual testing environment where experiments with the xdp package can be performed safely.
- Familiarity with Linux and virtualization.
- Host computer with enough memory and CPU cores to run at least 2 virtual machines.
- Some up-to-date distribution of Linux as the host OS, e.g. Fedora Linux.
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.
Open Virtual Machine Manager, click Edit → Connection Details → Virtual 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.
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
Shut down the VM and in it's window, click View → Details → Add 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.
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
- 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
- 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
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!
- https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/sect-virtualization_tuning_optimization_guide-networking-techniques
- https://unix.stackexchange.com/questions/419321/why-are-my-cloned-linux-vms-fighting-for-the-same-ip