Configuring Open vSwitch on Proxmox VE: Bridges, Bonds, and GRE Tunnels

Virtualization tutorial - IT technology blog
Virtualization tutorial - IT technology blog

At 2 AM, the Zabbix monitoring system fired off critical alerts: a cluster of 16 VMs on a Proxmox node lost connectivity following a kernel patch. Checking dmesg in the console revealed that the Linux Bridge was dropping packets as VLAN trunking traffic exceeded 4 Gbps. The LACP bond was also flapping and dropping links. To permanently eliminate this bottleneck, migrating the entire virtual networking infrastructure to Open vSwitch (OVS) is the cleanest solution.

In my homelab, I maintain two Proxmox VE nodes running 12 VMs and containers in parallel for load testing, backed by Proxmox VE replication with ZFS for high availability. Every recovery scenario below is drawn from real-world debugging sessions before being rolled out to production.

Quick start: Dựng OVS Bridge cứu mạng trong 5 phút

When the virtual switch fails, don’t waste time clicking around the web GUI. Open an iLO/IPMI console, connect via a serial console lifeline if SSH drops, or SSH directly into the Proxmox node to install the OVS packages:

apt-get update
apt-get install -y openvswitch-switch
systemctl enable --now openvswitch-switch

Verify that the OVS daemon is running:

ovs-vsctl show

Hot-create the virtual switch vmbr1 and attach the physical port eth0 to the bridge. These commands take effect immediately without rebooting the host:

ovs-vsctl add-br vmbr1
ovs-vsctl add-port vmbr1 eth0

To ensure the configuration persists across reboots, add the definition to /etc/network/interfaces:

auto vmbr1
iface vmbr1 inet manual
	ovs_type OVSBridge
	ovs_ports eth0
	ovs_extra set bridge vmbr1 stp_enable=true

iface eth0 inet manual
	ovs_type OVSPort
	ovs_bridge vmbr1

Reload the network configuration using ifupdown2:

ifreload -a

All set. Just reassign your VM network interfaces to vmbr1, and traffic will flow smoothly again.

Technical Underpinnings: Linux Bridge vs. Open vSwitch

Traditional Linux Bridges often struggle as infrastructure scales up. Why is that?

1. Packet Flow Processing Architecture

Linux Bridge operates as an unmanaged L2 switch inside the Linux kernel. It is simple, lightweight, and adequate for basic use cases. However, it lacks support for OpenFlow and dynamic flow control. When throughput exceeds 5–7 Gbps across dozens of distinct VLAN tags, kernel CPU softirqs spike, causing severe packet loss.

In contrast, Open vSwitch operates as a true SDN switch. OVS processes flows directly within the kernel datapath using a dedicated cache table. As a result, throughput remains stable even when enforcing hundreds of QoS rules or running NetFlow and sFlow for traffic monitoring.

2. Port Management and VLAN Filtering

With Linux Bridge, each VLAN typically requires a dedicated sub-interface such as eth0.10 or eth0.20. This quickly becomes unwieldy when managing dozens of VMs. Meanwhile, an OVS Bridge manages all physical and virtual interfaces (tap/veth) as unified OVS Ports, with VLAN filtering built in. Whether trunking or assigning VLAN tag 20 to a VM, you only need to configure a single tag parameter in Proxmox without touching host-level interfaces.

Advanced: OVS LACP Bonding and Cross-Node GRE Tunnels

Losing a single network cable should never take down your services. Combining OVS Bond with GRE Tunnels provides both link redundancy and seamless cross-subnet connectivity.

1. Aggregating 10GbE Interfaces with OVS Bond (LACP)

Suppose your server has two 10GbE ports, enp3s0f0 and enp3s0f1, connected to a Top of Rack (ToR) switch. We will aggregate these two ports into bond0 using 802.3ad LACP.

Configure /etc/network/interfaces as follows:

auto bond0
iface bond0 inet manual
	ovs_bridge vmbr0
	ovs_type OVSBond
	ovs_bonds enp3s0f0 enp3s0f1
	ovs_options bond_mode=balance-tcp lacp=active other_config:lacp-time=fast

auto vmbr0
iface vmbr0 inet static
	address 192.168.1.50/24
	gateway 192.168.1.1
	ovs_type OVSBridge
	ovs_ports bond0

After running ifreload -a, verify the LACP negotiation status:

ovs-appctl bond/show bond0
ovs-appctl lacp/show bond0

If the output shows actor state: negotiated and partner state: negotiated, both physical ports have successfully negotiated with the switch.

2. Building a GRE Tunnel to Bridge VMs Across Different IP Subnets

Real-world scenario: Node A has IP 10.10.1.10 and Node B has IP 10.10.2.10, separated by an L3 router. You need VMs across both nodes to communicate directly at Layer 2 (within the same 172.16.100.0/24 subnet) without asking the network team to configure VXLAN or trunk physical VLANs.

An OVS GRE Tunnel solves this in just two commands.

Initialize on Node A (10.10.1.10):

ovs-vsctl add-br vmbr-internal
ovs-vsctl add-port vmbr-internal gre0 -- set interface gre0 type=gre options:remote_ip=10.10.2.10

Initialize on Node B (10.10.2.10):

ovs-vsctl add-br vmbr-internal
ovs-vsctl add-port vmbr-internal gre0 -- set interface gre0 type=gre options:remote_ip=10.10.1.10

Next, attach the VM virtual interfaces to the vmbr-internal bridge. VMs on both nodes can now communicate seamlessly, as if plugged into the exact same physical switch. This setup is particularly effective for establishing isolated Layer 2 paths for zero-downtime live migration between clusters separated by routers.

Production Tips and Operational Insights for OVS

  • Avoid reckless network restarts: Never run systemctl restart networking over SSH. If there is a syntax error in your configuration, you will be locked out immediately. Use ifreload -a from the ifupdown2 package instead; it halts safely and reports detailed syntax errors if anything is wrong.
  • The GRE Tunnel MTU trap: The GRE encapsulation header adds 24 bytes of overhead (20 bytes IPv4 + 4 bytes GRE). If the physical NIC has an MTU of 1500, 1500-byte packets from VMs will fragment. This can cause iperf3 throughput to plummet from 9.4 Gbps to under 1.5 Gbps. Workaround: lower the VM NIC MTU to 1476 (or 1450), or raise the host physical NIC MTU to 1600 (Jumbo Frames).
  • Debug packets with Flow Dumps: When a VM fails to obtain an IP via DHCP, verify whether packets are traversing the bridge using:
ovs-dpctl dump-flows vmbr1
# Or inspect detailed OpenFlow rules:
ovs-ofctl dump-flows vmbr1

Mastering OVS Bridges, Bonds, and GRE Tunnels gives you full control over traffic on Proxmox VE, allowing you to resolve network bottlenecks quickly without relying entirely on external hardware. For larger infrastructures spanning multiple locations, pairing this networking foundation with centralized management via Proxmox Datacenter Manager (PDM) ensures consistent policies across all your hosts.

Share: