Skip to content

Open vSwitch VXLAN Support

Pablo Murillo edited this page Nov 13, 2023 · 24 revisions

Ratio

OpenKilda functional tests are based on lab-service which spawns virtual network typologies for testing purposes. However, not all features of hardware switches are available there. One of them is VXLAN transit encapsulation. This limits amount of functional tests that could be run against pull requests and limits local testing possibilities. This page is a guide that explains how to enable vxlan for testing on a machine with ovs virtual topologies.

Description

Lab service starts a new docker container that runs OVS under the hood and builds network topology. However, OVS also has its own kernel module that should be also patched to unlock VXLAN. NB: the module should be inserted in the host, not into the container.

Steps

If your host kernel is 5.8 and below:

  • Fetch OVS from here and switch to tag kilda.v2.15.1.3
  • Follow this guide that explains how to build OVs from source, e.g.:
    • ./boot.sh
    • ./configure --with-linux=/lib/modules/$(uname -r)/build
    • make -j 8
    • sudo make modules_install
  • Execute the following snippet. This will update the depmod.d config with(/etc/depmod.d/openvswitch.conf) and run depmod -a.
config_file="/etc/depmod.d/openvswitch.conf"
for module in datapath/linux/*.ko; do
  modname="$(basename ${module})"
  echo "override ${modname%.ko} * extra" >> "$config_file"
  echo "override ${modname%.ko} * weak-updates" >> "$config_file"
  done
depmod -a
  • Insert them on a host machine using modprobe openvswitch
  • Uncomment the ovs_vxlan: true line in open-kilda/confd/vars/main.yaml and run make build as usual

If your host kernel is newer than 5.8 then you need to patch your kernel instead since all kernel modules are part of Linux kernel, not a part of OVS starting from 5.8:

  • Install all required packets
sudo apt-get install build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev libncurses-dev bison 
sudo apt update
sudo apt install -y dwarves
  • Unpack source code or tar xavf /usr/src/linux-source-5.11.0.tar.bz2 or clone them from github git clone --depth 1 --branch v5.11 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

  • Apply patch

patch -p1 < ../ovs_kernel.diff

  • Copy your local config cat /boot/config-`uname -r` > .config

  • Build deb packages make bindeb-pkg -j 8

  • Install the new kernel

sudo dpkg -i linux-headers-5.11.22_5.11.22-1_amd64.deb 
sudo dpkg -i linux-image-5.11.22_5.11.22-1_amd64.deb
  • Reboot

If all goes well, the patched kernel will allow you to use VXLAN in testing scenarios.