Open vSwitch (OVS) is a production-grade virtual switch that brings data center networking features to Linux hypervisors. While the standard Linux bridge handles basic L2 switching, OVS adds VLAN trunking, port mirroring, sFlow/NetFlow monitoring, OpenFlow support, and DPDK acceleration – features that matter when you are running dozens of VMs with complex network requirements. This guide covers installing OVS on Ubuntu 24.04 and RHEL 10, creating bridges and ports, configuring VLANs, integrating with KVM/libvirt, and an overview of OVS-DPDK for high-performance workloads.
What is Open vSwitch
Open vSwitch is a multilayer virtual switch designed to work in virtualized server environments. It supports standard management interfaces like NetFlow, sFlow, IPFIX, RSPAN, CLI, LACP, and 802.1ag. It was built to handle the networking needs of large-scale virtualization deployments where the standard Linux bridge falls short.
Key capabilities that matter for KVM administrators:
- VLAN tagging and trunking – isolate VM traffic without separate physical interfaces
- Port mirroring – capture traffic for monitoring or troubleshooting
- QoS policies – rate limit VM traffic per port
- OpenFlow support – programmable flow rules for SDN integration
- GRE/VXLAN/Geneve tunneling – connect VMs across hosts without L2 adjacency
- DPDK integration – kernel-bypass networking for near-line-rate performance
Prerequisites
- A KVM host running Ubuntu 24.04 or RHEL 10
- Root or sudo access
- At least one physical network interface
- Console access recommended when reconfiguring network interfaces
Installing Open vSwitch on Ubuntu 24.04
OVS is available in the Ubuntu repositories.
sudo apt update
sudo apt install -y openvswitch-switch
Verify the installation and check the service status.
sudo systemctl status openvswitch-switch
ovs-vsctl --version
Expected output will show OVS version 3.x running and active.
Installing Open vSwitch on RHEL 10
On RHEL 10, OVS is available through the standard repositories or the Fast Datapath repository.
sudo dnf install -y openvswitch3.3
Enable and start the service.
sudo systemctl enable --now openvswitch
sudo systemctl status openvswitch
Verify.
ovs-vsctl --version
ovs-vsctl show
Step 1 – Create an OVS Bridge
Create a new OVS bridge that will serve as the virtual switch for your VMs.
sudo ovs-vsctl add-br ovsbr0
Verify the bridge was created.
sudo ovs-vsctl show
You should see the bridge listed with its UUID.
Step 2 – Add Physical Ports to the Bridge
Add your physical network interface to the OVS bridge. This is similar to adding an interface to a Linux bridge, but OVS manages the switching.
sudo ovs-vsctl add-port ovsbr0 enp3s0
After adding the physical interface, move the IP address from the physical interface to the OVS bridge. If you are doing this remotely, script the entire process to avoid losing connectivity.
sudo ip addr flush dev enp3s0
sudo ip addr add 192.168.1.100/24 dev ovsbr0
sudo ip link set ovsbr0 up
sudo ip route add default via 192.168.1.1
Verify the bridge has the IP and the port is attached.
ip addr show ovsbr0
sudo ovs-vsctl show
To make this persist across reboots on Ubuntu 24.04, configure it in Netplan.
# /etc/netplan/01-ovs.yaml
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: false
bridges:
ovsbr0:
openvswitch: {}
interfaces:
- enp3s0
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 8.8.8.8
Apply with sudo netplan apply.
On RHEL 10, use nmcli to manage the OVS bridge persistently.
sudo nmcli connection add type ovs-bridge con-name ovsbr0 conn.interface ovsbr0
sudo nmcli connection add type ovs-port con-name ovs-port-br conn.interface ovsbr0 master ovsbr0
sudo nmcli connection add type ovs-interface con-name ovs-iface-br conn.interface ovsbr0 \
master ovs-port-br ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns "8.8.8.8"
sudo nmcli connection add type ovs-port con-name ovs-port-enp3s0 conn.interface enp3s0 master ovsbr0
sudo nmcli connection add type ethernet con-name ovs-enp3s0 conn.interface enp3s0 master ovs-port-enp3s0
Step 3 – Configure VLANs with OVS
One of the biggest advantages of OVS over a Linux bridge is proper VLAN support. You can assign access VLANs to specific ports so different VMs land on different network segments.
First, make sure the physical uplink port is configured as a trunk that carries all VLANs.
sudo ovs-vsctl set port enp3s0 trunks=100,200,300
To add a VM port with a specific VLAN tag (access port).
sudo ovs-vsctl add-port ovsbr0 vnet0 tag=100
This tags all traffic from vnet0 with VLAN 100. The VM does not need to know about VLANs – the tagging happens at the switch level.
To create a trunk port for a VM that needs access to multiple VLANs (like a router VM).
sudo ovs-vsctl add-port ovsbr0 vnet1 trunks=100,200
Verify VLAN configuration.
sudo ovs-vsctl list port vnet0
sudo ovs-vsctl show
Step 4 – Integrate OVS with KVM/libvirt
To use OVS bridges with libvirt, you need to define a libvirt network that references the OVS bridge. Create an XML definition file.
cat <<EOF > /tmp/ovs-network.xml
<network>
<name>ovs-network</name>
<forward mode='bridge'/>
<bridge name='ovsbr0'/>
<virtualport type='openvswitch'/>
</network>
EOF
Define, start, and auto-start the network.
virsh net-define /tmp/ovs-network.xml
virsh net-start ovs-network
virsh net-autostart ovs-network
Verify the network.
virsh net-list --all
Now create VMs that use the OVS network.
virt-install \
--name ovs-vm \
--ram 2048 \
--vcpus 2 \
--disk size=20 \
--os-variant ubuntu24.04 \
--network network=ovs-network,model=virtio \
--cdrom /var/lib/libvirt/images/ubuntu-24.04.iso
To assign a specific VLAN to a VM through libvirt, edit the VM XML.
virsh edit ovs-vm
Set the interface section with VLAN configuration.
<interface type='network'>
<source network='ovs-network'/>
<virtualport type='openvswitch'/>
<vlan>
<tag id='100'/>
</vlan>
<model type='virtio'/>
</interface>
Step 5 – Useful OVS Management Commands
Here are commands you will use regularly when managing OVS.
Show the full OVS configuration.
sudo ovs-vsctl show
List all bridges.
sudo ovs-vsctl list-br
List ports on a bridge.
sudo ovs-vsctl list-ports ovsbr0
Delete a port from the bridge.
sudo ovs-vsctl del-port ovsbr0 vnet0
Check flow statistics.
sudo ovs-ofctl dump-flows ovsbr0
Show port statistics (packet counts, errors).
sudo ovs-ofctl dump-ports ovsbr0
Set port mirroring to capture all traffic from one port to another.
sudo ovs-vsctl -- set bridge ovsbr0 mirrors=@m \
-- --id=@vnet0 get port vnet0 \
-- --id=@mirror0 get port mirror0 \
-- --id=@m create mirror name=mymirror select-src-port=@vnet0 select-dst-port=@vnet0 output-port=@mirror0
OVS-DPDK for High-Performance Networking
For workloads that demand maximum network throughput – think NFV (Network Function Virtualization), telecom, or high-frequency data processing – OVS-DPDK provides kernel-bypass networking. Instead of packets traversing the kernel network stack, DPDK processes them in userspace with dedicated CPU cores and hugepage memory, achieving near-line-rate performance.
Prerequisites for OVS-DPDK
- A NIC that supports DPDK (Intel X710, Mellanox ConnectX series, etc.)
- Hugepages configured in the kernel
- CPU cores dedicated to DPDK processing
Configure hugepages. Add to the kernel command line or set at runtime.
echo 2048 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
sudo mkdir -p /dev/hugepages
sudo mount -t hugetlbfs none /dev/hugepages
Install OVS with DPDK support.
# Ubuntu
sudo apt install -y openvswitch-switch-dpdk
# RHEL
sudo dnf install -y openvswitch3.3-dpdk
Enable DPDK in OVS.
sudo ovs-vsctl set Open_vSwitch . other_config:dpdk-init=true
sudo ovs-vsctl set Open_vSwitch . other_config:dpdk-socket-mem="1024"
sudo systemctl restart openvswitch-switch
Create a DPDK-enabled bridge and add a DPDK port.
sudo ovs-vsctl add-br dpdk-br -- set bridge dpdk-br datapath_type=netdev
sudo ovs-vsctl add-port dpdk-br dpdk0 -- set interface dpdk0 type=dpdk options:dpdk-devargs=0000:03:00.0
The dpdk-devargs value is the PCI address of your NIC. Find it with dpdk-devbind.py --status.
For VMs to use DPDK-accelerated ports, configure vhost-user ports.
sudo ovs-vsctl add-port dpdk-br vhost-user0 -- set interface vhost-user0 type=dpdkvhostuserclient options:vhost-server-path=/tmp/vhost-user0
OVS-DPDK configuration is significantly more involved than standard OVS and requires careful CPU pinning, NUMA awareness, and memory allocation planning. It is worth the effort for performance-critical workloads, but overkill for general-purpose virtualization.
Summary
Open vSwitch transforms a KVM host’s networking from basic bridge switching to a full-featured virtual network infrastructure. The installation is straightforward on both Ubuntu 24.04 and RHEL 10, and the ovs-vsctl command-line tool gives you complete control over bridges, ports, VLANs, and advanced features. For most deployments, standard OVS with VLAN support and libvirt integration covers everything you need. When you hit the limits of kernel-based switching, OVS-DPDK is there to push performance to the hardware limits. Whether you are running a handful of VMs or building an SDN-driven cloud, Open vSwitch gives you the networking toolkit to match.

































































