KVM-QEMU

Performing virtualization in Linux requires three components:

  • KVM works exclusively with QEMU and performs hardware acceleration for x86 VMs with Intel and AMD CPUs. KVM and QEMU are hypervisors that emulate the VMs; the pair is often called KVM-QEMU or just KVM.
  • QEMU is a machine emulator that can allow the host machine to emulate the CPU architecture of the guest machine. Because QEMU does not provide hardware acceleration, it works well with KVM.
  • libvirt provides an abstraction language to define and launch VMs, but is normally used just to launch single VMs. It uses XML to represent and define the VM.

This section describes how to install and set up Cumulus VX with KVM/QEMU and Libvirt on a Linux server to create the two leaf and one spine topology shown below.

In the topology, leaf01 and leaf02 are the access layer switches on the network. leaf01 and leaf02 connect to spine01, which is the aggregation layer switch on the network. To facilitate additional configuration after the initial setup descibed in this guide, leaf01 and leaf02 also have two connections to each other.

Follow the steps below to:

  • Create three VMs (leaf01, leaf02, and spine01) and the network connections between them
  • Log into the switches
  • Perform basic switch configuration
  • Verify configuration

These steps were tested with Cumulus VX 4.2, KVM/QEMU version 1:4.2-3ubuntu6.3, and Libvirt version 6.0.0 on Ubuntu Linux version 20.04.

Create and Configure the VMs

The following procedure creates leaf01, leaf02, and spine01 and the network connections between them. This section assumes you have Linux and KVM experience.

Download and Install the Software

  1. Download the Cumulus VX Qcow2 image for KVM.

  2. Run the following commands to install KVM, QEMU and Libvirt:

    local@host:~$ sudo apt update -y
    local@host:~$ sudo apt install -qy qemu ebtables dnsmasq-base qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager python3-pip
    local@host:~$ sudo apt install -qy libxslt-dev libxml2-dev libvirt-dev zlib1g-dev
    
  3. Confirm that your Linux kernel and BIOS settings permit the use of KVM hardware acceleration:

    local@host:~$ kvm-ok
    INFO: /dev/kvm exists
    KVM acceleration can be used
    

Create the VMs and Network Connections

  1. Copy the qcow2 image onto a Linux server three times to create the three VMs. Name them as follows:

    • leaf01.qcow2
    • leaf02.qcow2
    • spine01.qcow2
  2. Run the following commands to configure each VM. Make sure you specify the location of the VM at the end of the command. In the example commands below, the VMs are installed in /var/lib/libvirt/images/.

The following commands define the CPU, memory, and disk requirements for Cumulus VX, which requires at least 768MB of RAM and 6GB of disk space.

local@host:~$ sudo /usr/bin/kvm -curses -vga virtio -name leaf01 -pidfile leaf01.pid -smp 1 -m 768 -net nic,macaddr=00:01:00:00:01:00,model=virtio -net user,net=192.168.0.0/24,hostfwd=tcp::1401-:22 -netdev socket,udp=127.0.0.1:1602,localaddr=127.0.0.1:1601,id=dev0 -device virtio-net-pci,mac=00:02:00:00:00:01,addr=6.0,multifunction=on,netdev=dev0,id=swp1 -netdev socket,udp=127.0.0.1:1606,localaddr=127.0.0.1:1605,id=dev1 -device virtio-net-pci,mac=00:02:00:00:00:02,addr=6.1,multifunction=off,netdev=dev1,id=swp2 -netdev socket,udp=127.0.0.1:1610,localaddr=127.0.0.1:1609,id=dev2 -device virtio-net-pci,mac=00:02:00:00:00:09,addr=6.2,multifunction=off,netdev=dev2,id=swp3 /var/lib/libvirt/images/leaf01.qcow2
local@host:~$ sudo /usr/bin/kvm -curses -vga virtio -name leaf02 -pidfile leaf02.pid -smp 1 -m 768 -net nic,macaddr=00:01:00:00:02:00,model=virtio -net user,net=192.168.0.0/24,hostfwd=tcp::1402-:22 -netdev socket,udp=127.0.0.1:1604,localaddr=127.0.0.1:1603,id=dev0 -device virtio-net-pci,mac=00:02:00:00:00:03,addr=6.0,multifunction=on,netdev=dev0,id=swp1 -netdev socket,udp=127.0.0.1:1605,localaddr=127.0.0.1:1606,id=dev1 -device virtio-net-pci,mac=00:02:00:00:00:04,addr=6.1,multifunction=off,netdev=dev1,id=swp2 -netdev socket,udp=127.0.0.1:1609,localaddr=127.0.0.1:1610,id=dev2 -device virtio-net-pci,mac=00:02:00:00:00:10,addr=6.2,multifunction=off,netdev=dev2,id=swp3 /var/lib/libvirt/images/leaf02.qcow2
local@host:~$ sudo /usr/bin/kvm -curses -vga virtio -name spine01 -pidfile spine01.pid -smp 1 -m 768 -net nic,macaddr=00:01:00:00:03:00,model=virtio -net user,net=192.168.0.0/24,hostfwd=tcp::1403-:22 -netdev socket,udp=127.0.0.1:1601,localaddr=127.0.0.1:1602,id=dev0 -device virtio-net-pci,mac=00:02:00:00:00:05,addr=6.0,multifunction=on,netdev=dev0,id=swp1 -netdev socket,udp=127.0.0.1:1603,localaddr=127.0.0.1:1604,id=dev1 -device virtio-net-pci,mac=00:02:00:00:00:06,addr=6.1,multifunction=off,netdev=dev1,id=swp2 -netdev socket,udp=127.0.0.1:1609,localaddr=127.0.0.1:1610,id=dev2 -device virtio-net-pci,mac=00:02:00:00:00:11,addr=6.2,multifunction=off,netdev=dev2,id=swp3 /var/lib/libvirt/images/spine01.qcow2

Log into the Switches

Log into each switch with the cumulus account and default password cumulus. When you log in for the first time, you are prompted to change the default password.

If you are using Cumulus VX 4.1.1 or earlier, the default password is CumulusLinux!. You are not prompted to change the default password.

For more information on the required password change, see the Cumulus Linux documentation.

Basic Switch Configuration

Run these commands on each switch to change the hostname and bring up the interfaces. Exit the switch, then log back in to see the new hostname at the prompt.

cumulus@cumulus:mgmt:~$ net add hostname leaf01
cumulus@cumulus:mgmt:~$ net add interface swp1,swp2,swp3
cumulus@cumulus:mgmt:~$ net commit
cumulus@cumulus:mgmt:~$ exit
cumulus@cumulus:mgmt:~$ net add hostname leaf02
cumulus@cumulus:mgmt:~$ net add interface swp1,swp2,swp3
cumulus@cumulus:mgmt:~$ net commit
cumulus@cumulus:mgmt:~$ exit
cumulus@cumulus:mgmt:~$ net add hostname spine01
cumulus@cumulus:mgmt:~$ net add interface swp1,swp2
cumulus@cumulus:mgmt:~$ net commit
cumulus@cumulus:mgmt:~$ exit

Verify Configuration

Run the following commands on each switch to verify the configuration:

It might take a few minutes for the LLDP information to update. If your command output is different from the output shown below, wait a few minutes, then run the command again.

cumulus@leaf01:mgmt:~$ net show lldp
LocalPort    Speed    Mode          RemoteHost     RemotePort
-----------  -------  ------------  ------------   ------------
swp1         1G       Default       spine01        swp1
swp2         1G       Default       leaf02         swp2
swp3         1G       Default       leaf02         swp3
cumulus@leaf02:mgmt:~$ net show lldp
LocalPort    Speed    Mode          RemoteHost     RemotePort
-----------  -------  ------------  ------------   ------------
swp1         1G       Default       spine01        swp2
swp2         1G       Default       leaf01         swp2
swp3         1G       Default       leaf01         swp3
cumulus@spine01:mgmt:~$ net show lldp
LocalPort    Speed    Mode          RemoteHost     RemotePort
-----------  -------  ------------  ------------   ------------
swp1         1G       Default       leaf01         swp1
swp2         1G       Default       leaf02         swp1

Run the following commands on each switch to show system information:

cumulus@leaf01:mgmt:~$ net show system
Hostname..............leaf01
Build.................Cumulus Linux 4.2.0
Uptime................0.00.23.740000
Model.................Cumulus VX
Memory................768MB
Disk..................6GB
Vendor Name...........Cumulus Networks
Part Number...........4.2.0
Base MAC Address......4:00:27:39:B1:12
Serial Number.........4:00:27:39:B1:12
Product Name..........VX

Next Steps

  • Read the Cumulus Linux User Guide to learn about using Cumulus Linux and test out features on your switches.
  • Visit the NVIDIA Cumulus web site, which offers many resources to help you understand Cumulus Linux.
  • Try some of the advanced configuration. You can update your virtual environment to be able to use the Cumulus Linux on demand self-paced labs (a quick and easy way to learn the fundamentals). You can also run the topology converter to simulate a custom network topology with VirtualBox and Vagrant, or KVM-QEMU and Vagrant.
  • Try Cumulus in the Cloud, which is a free, personal, virtual data center network that provides a low-effort way to see Cumulus Networks technology in action. This is a good way to try out Cumulus Linux if you have platform or disk limitations.