Open vSwitch (OVS) is an open source, production-quality, multilayer-virtual switch. Open vSwitch is designed for massive network automation through programmatic extension, but still with the support for standard protocols and management interfaces (for example, LACP, NetFlow, sFlow, IPFIX, RSPAN, CLI, and 802.1ag). It is designed to support distribution across multiple physical servers similar to VMware’s vNetwork distributed vswitch or Cisco’s Nexus 1000V.
In this article we explore configurations required to utilize Open vSwitch Bridge in your KVM Virtualization Infrastructure. KVM is a full virtualization solution for Linux on x86 hardware that allows you to run multiple operating systems sharing a single hardware resources. The kernel component of KVM is included in Linux since version 2.6.20.
Most of the operations in this article were performed on an Enterprise Linux Operating system – CentOS 8/7, RHEL 7/8 and Fedora Linux systems. For Debian based systems such as Ubuntu few modifications may be required to use Open vSwitch Bridge on KVM Virtual Machines.
Step 1: Install Open vSwitch on Linux system
The first step is installation of Open vSwitch packages on your Linux system. We have guides written earlier on which can be used for the installation.
Install Open vSwitch on CentOS 8 / RHEL 8
Use the following link to access Open vSwitch installation guide for CentOS 8 / RHEL 8 Linux systems:
Install Open vSwitch on Fedora Linux
For Fedora the Open vSwitch packages are available on the default upstream:
sudo dnf install openvswitch
Start the installation process:
....
Transaction Summary
==================================================================================================================================================================
Install 4 Packages
Total download size: 8.1 M
Installed size: 27 M
Is this ok [y/N]: y
Start and enable the openvswitch service by running below commands in your terminal.
$ sudo systemctl enable --now openvswitch
Created symlink /etc/systemd/system/multi-user.target.wants/openvswitch.service → /usr/lib/systemd/system/openvswitch.service.
Confirm the service is running:
$ systemctl status openvswitch
● openvswitch.service - Open vSwitch
Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; enabled; vendor preset: disabled)
Active: active (exited) since Wed 2021-06-23 11:16:06 UTC; 24s ago
Process: 7517 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 7517 (code=exited, status=0/SUCCESS)
CPU: 1ms
Jun 23 11:16:06 fed systemd[1]: Starting Open vSwitch...
Jun 23 11:16:06 fed systemd[1]: Finished Open vSwitch.
Confirm ovs-vsctl is able to talk to Open vSwitch daemon:
$ ovs-vsctl show
c5ac26b2-0213-4aee-b3d9-d5f23d9306db
ovs_version: "2.15.0"
Install Open vSwitch on Ubuntu
Update package index list:
$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://ubuntu-cloud.archive.canonical.com/ubuntu focal-updates/victoria InRelease
Get:3 http://mirrors.digitalocean.com/ubuntu focal InRelease [265 kB]
Hit:4 http://mirrors.digitalocean.com/ubuntu focal-updates InRelease
Hit:5 http://mirrors.digitalocean.com/ubuntu focal-backports InRelease
Fetched 265 kB in 0s (591 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
70 packages can be upgraded. Run 'apt list --upgradable' to see them.
Search for all packages matching openvswitch:
$ apt search openvswitch
Sorting... Done
Full Text Search... Done
neutron-openvswitch-agent/focal-updates 2:17.1.1-0ubuntu1~cloud0 all
Neutron is a virtual network service for Openstack - Open vSwitch plugin agent
openvswitch-common/focal-updates,now 2.13.3-0ubuntu0.20.04.1 amd64 [installed]
Open vSwitch common components
openvswitch-dbg/focal-updates 2.13.3-0ubuntu0.20.04.1 amd64
Debug symbols for Open vSwitch packages
openvswitch-doc/focal-updates 2.13.3-0ubuntu0.20.04.1 all
Open vSwitch documentation
openvswitch-pki/focal-updates 2.13.3-0ubuntu0.20.04.1 all
Open vSwitch public key infrastructure dependency package
openvswitch-source/focal-updates 2.13.3-0ubuntu0.20.04.1 all
Open vSwitch source code
openvswitch-switch/focal-updates 2.13.3-0ubuntu0.20.04.1 amd64
Open vSwitch switch implementations
openvswitch-switch-dpdk/focal-updates 2.13.3-0ubuntu0.20.04.1 amd64
DPDK enabled Open vSwitch switch implementation
openvswitch-test/focal-updates 2.13.3-0ubuntu0.20.04.1 all
Open vSwitch test package
openvswitch-testcontroller/focal-updates 2.13.3-0ubuntu0.20.04.1 amd64
Simple controller for testing OpenFlow setups
openvswitch-vtep/focal-updates 2.13.3-0ubuntu0.20.04.1 amd64
Open vSwitch VTEP utilities
python3-openvswitch/focal-updates 2.13.3-0ubuntu0.20.04.1 all
Python 3 bindings for Open vSwitch
Then install openvswitch-switch package using the command below:
$ sudo apt install openvswitch-switch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python3-openvswitch python3-sortedcontainers
Suggested packages:
python-sortedcontainers-doc
The following NEW packages will be installed:
openvswitch-switch python3-openvswitch python3-sortedcontainers
0 upgraded, 3 newly installed, 0 to remove and 70 not upgraded.
Need to get 1658 kB of archives.
After this operation, 8423 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.digitalocean.com/ubuntu focal/main amd64 python3-sortedcontainers all 2.1.0-2 [27.3 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu focal-updates/main amd64 python3-openvswitch all 2.13.3-0ubuntu0.20.04.1 [94.8 kB]
Get:3 http://mirrors.digitalocean.com/ubuntu focal-updates/main amd64 openvswitch-switch amd64 2.13.3-0ubuntu0.20.04.1 [1536 kB]
Fetched 1658 kB in 0s (5176 kB/s)
Selecting previously unselected package python3-sortedcontainers.
(Reading database ... 63577 files and directories currently installed.)
Preparing to unpack .../python3-sortedcontainers_2.1.0-2_all.deb ...
Unpacking python3-sortedcontainers (2.1.0-2) ...
Selecting previously unselected package python3-openvswitch.
Preparing to unpack .../python3-openvswitch_2.13.3-0ubuntu0.20.04.1_all.deb ...
Unpacking python3-openvswitch (2.13.3-0ubuntu0.20.04.1) ...
Selecting previously unselected package openvswitch-switch.
Preparing to unpack .../openvswitch-switch_2.13.3-0ubuntu0.20.04.1_amd64.deb ...
Unpacking openvswitch-switch (2.13.3-0ubuntu0.20.04.1) ...
Setting up python3-sortedcontainers (2.1.0-2) ...
Setting up python3-openvswitch (2.13.3-0ubuntu0.20.04.1) ...
Setting up openvswitch-switch (2.13.3-0ubuntu0.20.04.1) ...
update-alternatives: using /usr/lib/openvswitch-switch/ovs-vswitchd to provide /usr/sbin/ovs-vswitchd (ovs-vswitchd) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/openvswitch-switch.service → /lib/systemd/system/openvswitch-switch.service.
Created symlink /etc/systemd/system/openvswitch-switch.service.requires/ovs-record-hostname.service → /lib/systemd/system/ovs-record-hostname.service.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.6) ...
Service is started automatically after installation:
$ systemctl status openvswitch-switch.service
● openvswitch-switch.service - Open vSwitch
Loaded: loaded (/lib/systemd/system/openvswitch-switch.service; enabled; vendor preset: enabled)
Active: active (exited) since Wed 2021-06-23 11:11:31 UTC; 10min ago
Main PID: 14545 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 2344)
Memory: 0B
CGroup: /system.slice/openvswitch-switch.service
Jun 23 11:11:31 ubuntu systemd[1]: Starting Open vSwitch...
Jun 23 11:11:31 ubuntu systemd[1]: Finished Open vSwitch.
Confirm it is working by checking the software version:
$ ovs-vsctl show
30c881f7-1496-440a-93c3-50f530c4d7a7
ovs_version: "2.13.3"
Step 2: Create Open vSwitch Bridge for KVM Virtual Machines
In this section we show examples of Open vSwitch Bridge creation on RHEL based and Debian based systems:
Configuration on RHEL 8 / CentOS 8 / CentOS 7 / Fedora:
Install Network scripts and disable NetworkManager:
sudo dnf -y install network-scripts
sudo systemctl disable --now NetworkManager
sudo systemctl enable network
Create an Open vSwitch Bridge
Backup current interface configurations:
cp /etc/sysconfig/network-scripts/ifcfg-eno1 /root/
Configure primary interface like below while replacing eno1 with the name of your physical interface.
$ sudo vim /etc/sysconfig/network-scripts/ifcfg-eno1
DEVICE=eno1
ONBOOT=yes
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
Create Open vSwitch Bridge configuration file:
$ sudo vim /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
BOOTPROTO=none
ONBOOT=yes
TYPE=OVSBridge
DEVICETYPE=ovs
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
IPADDR=192.168.20.10
NETMASK=255.255.255.0
GATEWAY=192.168.20.1
DNS1=192.168.20.1
DNS2=8.8.8.8
Add the eno1 physical interface to the br-ex bridge in openVswitch
sudo ovs-vsctl add-br br-ex
sudo ovs-vsctl add-port br-ex eno1
Restart Network service after making the changes:
sudo systemctl restart network.service
List available OVS bridges:
$ sudo ovs-vsctl show
325c62c0-dafd-4abc-a949-aa6233000ca4
Bridge br-ex
Port eno1
Interface eno1
Port br-ex
Interface br-ex
type: internal
ovs_version: "2.13.4"
You can also show IP information using the command:
$ ip addr
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master ovs-system state UP group default qlen 1000
link/ether b4:2e:99:c9:b0:72 brd ff:ff:ff:ff:ff:ff
inet6 fe80::b62e:99ff:fec9:b072/64 scope link
valid_lft forever preferred_lft forever
3: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 02:7a:a4:c1:b2:70 brd ff:ff:ff:ff:ff:ff
4: br-ex: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
link/ether b4:2e:99:c9:b0:72 brd ff:ff:ff:ff:ff:ff
inet 192.168.20.10 brd 192.168.20.255 scope global br-ex
valid_lft forever preferred_lft forever
inet 192.168.20.10/24 scope global br-ex
valid_lft forever preferred_lft forever
inet6 fe80::3cbd:feff:fef9:ed42/64 scope link
valid_lft forever preferred_lft forever
We can confirm the bridge is active and ready for use. The same steps can be used to create additional OVS bridges.
Configuration on Debian / Ubuntu
Sample OVS configuration template for Debian based Linux systems:
# All data traffic flows over the br-ex network
auto br-ex
allow-ovs br-ex
# IP configuration of the OVS Bridge
iface br-ex inet static
address 192.168.20.10
netmask 255.255.255.0
gateway 192.168.20.1
dns-nameservers 8.8.8.8
ovs_type OVSBridge
ovs_ports eth1
Add the eth1 physical interface to the br-ex bridge in openVswitch.
sudo ovs-vsctl add-br br-ex
sudo ovs-vsctl add-port br-ex eth1
Step 3: Install KVM packages on your Linux Server
With OVS installed and configured the next step will be installation of KVM packages on our Linux Server. Perform the operation by using the commands shared below.
# Install on CentOS 8 / Stream 8 / Fedora
sudo dnf -y install virt-install libvirt qemu-kvm virt-install virt-top libguestfs-tools
sudo systemctl enable --now libvirtd
# Install on Ubuntu / Debian
sudo apt update
sudo apt -y install qemu-kvm libvirt-daemon-system virt-top libvirt-daemon bridge-utils libosinfo-bin virtinst libguestfs-tools
Confirm that kernel modules are loaded:
$ lsmod | grep kvm
kvm_intel 315392 0
kvm 847872 1 kvm_intel
irqbypass 16384 1 kvm
Confirm service status:
# RHEL based systems
$ systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-06-02 00:09:16 CEST; 5s ago
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 8559 (libvirtd)
Tasks: 19 (limit: 32768)
Memory: 20.9M
CGroup: /system.slice/libvirtd.service
├─5099 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
├─5100 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
└─8559 /usr/sbin/libvirtd --timeout 120
Jun 02 00:09:15 kvm systemd[1]: Starting Virtualization daemon...
Jun 02 00:09:16 kvm systemd[1]: Started Virtualization daemon.
Jun 02 00:09:16 kvm dnsmasq[5099]: read /etc/hosts - 9 addresses
Jun 02 00:09:16 kvm dnsmasq[5099]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Jun 02 00:09:16 kvm dnsmasq-dhcp[5099]: read /var/lib/libvirt/dnsmasq/default.hostsfile
# Debian
$ systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-06-23 12:17:31 UTC; 23s ago
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 12538 (libvirtd)
Tasks: 17 (limit: 32768)
Memory: 13.5M
CGroup: /system.slice/libvirtd.service
└─12538 /usr/sbin/libvirtd
Jun 23 12:17:30 debian10 systemd[1]: Starting Virtualization daemon...
Jun 23 12:17:31 debian10 systemd[1]: Started Virtualization daemon.
# Ubuntu
$ systemctl status libvirtd
● libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-06-23 12:14:33 UTC; 4min 2s ago
TriggeredBy: ● libvirtd-admin.socket
● libvirtd.socket
● libvirtd-ro.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 20076 (libvirtd)
Tasks: 19 (limit: 32768)
Memory: 12.4M
CGroup: /system.slice/libvirtd.service
├─20076 /usr/sbin/libvirtd
├─20217 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
└─20218 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
Jun 23 12:14:34 ubuntu dnsmasq[20217]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth nettlehash DNSSEC loop-de>
Jun 23 12:14:34 ubuntu dnsmasq-dhcp[20217]: DHCP, IP range 192.168.122.2 -- 192.168.122.254, lease time 1h
Jun 23 12:14:34 ubuntu dnsmasq-dhcp[20217]: DHCP, sockets bound exclusively to interface virbr0
Jun 23 12:14:34 ubuntu dnsmasq[20217]: reading /etc/resolv.conf
Jun 23 12:14:34 ubuntu dnsmasq[20217]: using nameserver 127.0.0.53#53
Jun 23 12:14:34 ubuntu dnsmasq[20217]: read /etc/hosts - 8 addresses
Jun 23 12:14:34 ubuntu dnsmasq[20217]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Jun 23 12:14:34 ubuntu dnsmasq-dhcp[20217]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Jun 23 12:14:34 ubuntu dnsmasq[20217]: reading /etc/resolv.conf
Jun 23 12:14:34 ubuntu dnsmasq[20217]: using nameserver 127.0.0.53#53
Enable IP Routing
We need to enable IP routing to direct inbound traffic correctly to the OVS bridge we’ve created.
On the KVM host run the following command to unlock IP routing Kernel feature:
echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter = 2"|sudo tee -a /etc/sysctl.conf
Load the settings:
$ sudo sysctl -p
net.ipv4.ip_forward = 1
Create Virtual Machine on the Bridge
Finally we can create a VM that uses the Bridge we’ve created.
List available builder templates:
$ sudo virt-builder -l
I’ll create an OS disk image of 10GB from centosstream-8 template:
$ sudo virt-builder centosstream-8 --format qcow2 \
--size 10G -o /var/lib/libvirt/images/centosstream-8.qcow2 \
--root-password StrongRootPassword
[ 0.8] Downloading: http://builder.libguestfs.org/centosstream-8.xz
########################################################################################################################################################## 100.0%
[ 10.5] Planning how to build this image
[ 10.5] Uncompressing
[ 13.4] Resizing (using virt-resize) to expand the disk to 10.0G
[ 30.0] Opening the new disk
[ 34.1] Setting a random seed
[ 34.2] Setting passwords
[ 35.0] Finishing off
Output file: /var/lib/libvirt/images/centosstream-8.qcow2
Output size: 10.0G
Output format: qcow2
Total usable space: 9.3G
Free space: 8.0G (85%)
Then create the VM with the image above using virt-install command:
sudo virt-install \
--name centosstream-8 \
--ram 2048 \
--disk path=/var/lib/libvirt/images/centosstream-8.qcow2 \
--vcpus 1 \
--os-type linux \
--os-variant rhel8.0 \
--network=bridge:br-ex,model=virtio,virtualport_type=openvswitch \
--graphics none \
--serial pty \
--console pty \
--boot hd \
--import
Where:
- /var/lib/libvirt/images/centosstream-8.qcow2 is the path to the image created
- br-ex is the name of the OVS bridge to use in the VM
- virtualport_type=openvswitch defines virtualport type used as OVS
Expected output:
....
[ OK ] Started Hardware RNG Entropy Gatherer Wake threshold service.
[ OK ] Started Hardware RNG Entropy Gatherer Daemon.
[ OK ] Started QEMU Guest Agent.
[ 4.649459] lpc_ich 0000:00:1f.0: I/O space for GPIO uninitialized
[ 4.668659] i801_smbus 0000:00:1f.3: SMBus using PCI interrupt
[ 4.669680] input: PC Speaker as /devices/platform/pcspkr/input/input5
[ 4.689814] RAPL PMU: API unit is 2^-32 Joules, 0 fixed counters, 10737418240 ms ovfl timer
[ OK ] Started NTP client/server.
[ OK ] Started OpenSSH ecdsa Server Key Generation.
[ OK ] Started OpenSSH ed25519 Server Key Generation.
[ 4.764387] iTCO_vendor_support: vendor-support=0
[ 4.766207] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.11
[ 4.767124] iTCO_wdt: Found a ICH9 TCO device (Version=2, TCOBASE=0x0660)
[ 4.769471] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
[ OK ] Started Authorization Manager.
Starting firewalld - dynamic firewall daemon...
[ 5.013674] intel_pmc_core intel_pmc_core.0: initialized
[ OK ] Started System Security Services Daemon.
[ OK ] Reached target User and Group Name Lookups.
Starting Login Service...
[ OK ] Started OpenSSH rsa Server Key Generation.
[ OK ] Reached target sshd-keygen.target.
[ OK ] Started Login Service.
[ OK ] Started firewalld - dynamic firewall daemon.
[ OK ] Reached target Network (Pre).
Starting Network Manager...
[ OK ] Started Network Manager.
[ OK ] Reached target Network.
Starting OpenSSH server daemon...
Starting Permit User Sessions...
Starting Dynamic System Tuning Daemon...
Starting Network Manager Wait Online...
Starting Hostname Service...
[ OK ] Started Permit User Sessions.
Starting Hold until boot process finishes up...
Starting Terminate Plymouth Boot Screen...
[ OK ] Started Command Scheduler.
[ OK ] Started OpenSSH server daemon.
[ 6.225202] IPv6: ADDRCONF(NETDEV_UP): enp1s0: link is not ready
localhost login: root
[root@localhost ~]#
Update root password:
[root@localhost ~]# passwd
Changing password for user root.
New password: <enter-new-password>
Retype new password: <confirm-new-password>
passwd: all authentication tokens updated successfully.
Confirm network is connected and UP.
[root@localhost ~]# ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:5e:69:24 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe5e:6924/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Let’s configure VM IP address on the interface mapped to host OVS bridge:
# vim /etc/sysconfig/network-scripts/ifcfg-enp1s0
NAME="enp1s0"
DEVICE="enp1s0"
ONBOOT="yes"
NETBOOT="yes"
BOOTPROTO="none"
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
DEFROUTE="yes"
IPADDR=192.168.20.12
PREFIX=24
GATEWAY=192.168.20.1
DNS1=8.8.8.8
DNS2=8.8.4.4
Run the commands below to restart the interface:
# ifdown enp1s0 && ifup enp1s0
Connection 'enp1s0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)
Check IP address information:
# ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 52:54:00:5e:69:24 brd ff:ff:ff:ff:ff:ff
inet 192.168.20.12/24 brd 192.168.20.255 scope global noprefixroute enp1s0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe5e:6924/64 scope link
valid_lft forever preferred_lft forever
Let’s try ping outside
[root@localhost ~]# ping -c 2 google.com
PING google.com (142.250.185.110) 56(84) bytes of data.
64 bytes from fra16s49-in-f14.1e100.net (142.250.185.110): icmp_seq=1 ttl=118 time=5.06 ms
64 bytes from fra16s49-in-f14.1e100.net (142.250.185.110): icmp_seq=2 ttl=118 time=5.28 ms
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 2ms
rtt min/avg/max/mdev = 5.064/5.173/5.282/0.109 ms
List running VMs:
$ sudo virsh list
To destroy VM we’ll run:
$ sudo virsh destroy centosstream-8
Domain 'centosstream-8' destroyed
$ sudo virsh undefine centosstream-8
Domain 'centosstream-8' has been undefined
$ sudo rm -rf /var/lib/libvirt/images/centosstream-8.qcow2
$ sudo virsh list --all
Id Name State
--------------------
Conclusion
In this guide we’ve been able to install OVS and configure a bridge to be used by KVM virtual machines. We hope this guide was useful. If you encountered any issues while referencing this article in your setup please drop us a comment and we’ll be happy to help where we can.
More guides on KVM: