Openvswitch is a virtual switch production level software, that can be used in virtual switch in VM environments like kvm, virtualbox etc.
In case of vm’s network connection to outer world is established by NAT or Bridge (Layer2 device), this model is good for single server vm guests, openvswitch is suited for multiserver vm guests connection.
Installing openvswitch on fedora:
dnf install openvswitch -y
systemctl enable openvswitch.service
systemctl start openvswitch.service
systemctl status openvswitch.service
Add an ovs bridge and add a bridge to it:
ovs-vsctl add-br ovsbr0
ovs-vsctl show
Adding a virtual interface to ovs bridge:
ip link add name veth0 type veth peer name veth1
Associating virtual interface veth0 to bridge br0:
brctl addif br0 veth0
brctl show
Adding virtual interface veth1 to ovs bridge:
sudo ovs-vsctl add-port ovsbr0 veth1
sudo ovs-vsctl show
Edit the xml config file of kvm guest and add the appropriate interface line.
Related Articles
How We Set Up Our KVM Hypervisor: From Bare Metal to Production-Ready VM Host
Detailed walkthrough of building a dedicated KVM/libvirt hypervisor with XFS tuning, hugepages, 10GbE tuning, and automation.
Installing eve-ng on ubuntu 24.04 LTS
Step-by-step guide to installing EVE-NG on Ubuntu 24.04 LTS bare metal server for running network labs.
Setting default gateway from virsh-net command line
Generally when a network is configured from virsh-define for a particular range say 192.168.4.0 it gateway will be automatically assigned to 192.168.4.1.