Skip to main content

📚 Making MTU 9000 Persistent on XCP-ng (OVS)

Making MTU 9000 Persistent on XCP-ng (OVS)

📖 Purpose

This guide explains how to correctly configure MTU 9000 on Open vSwitch (OVS) inside XCP-ng to ensure jumbo frames survive across reboots.

📖 Requirements

  • XCP-ng 8.x or newer
  • Open vSwitch in use (default in XCP-ng)
  • SSH access to the hypervisor
  • Root privileges

📖 Background

  • XCP-ng uses Open vSwitch (OVS) to manage VM networking.
  • Setting MTU at the Linux NIC level is not enough; OVS controls the real MTU behavior.
  • XCP-ng resets network bridges at boot, so MTU settings must be reapplied automatically.

📖 Steps

🛠 Step 1: Create the MTU Fix Bash Script

sudo nano /usr/local/bin/fix-ovs-mtu.sh

Paste this:

#!/bin/bash
sleep 20
ovs-vsctl set interface eth4 mtu_request=9000
ovs-vsctl set interface xenbr4 mtu_request=9000
echo "$(date) - MTU 9000 applied to eth4 and xenbr4" >> /var/log/fix-ovs-mtu.log

Make it executable:

sudo chmod +x /usr/local/bin/fix-ovs-mtu.sh

🛠 Step 2: Create the systemd Service

sudo nano /etc/systemd/system/fix-ovs-mtu.service

Paste this:

[Unit]
Description=Fix OVS Interfaces MTU to 9000 After Boot
After=network-online.target openvswitch-switch.service

[Service]
ExecStart=/usr/local/bin/fix-ovs-mtu.sh
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

🛠 Step 3: Enable the Service

sudo systemctl daemon-reload
sudo systemctl enable fix-ovs-mtu.service
sudo systemctl start fix-ovs-mtu.service
sudo systemctl status fix-ovs-mtu.service

🛠 Step 4: Validate

  • Check service status:
sudo systemctl status fix-ovs-mtu.service
  • Check MTU on physical NIC and bridge:
  • Verify inside OVS:
ovs-vsctl list interface eth4 | grep mtu
ovs-vsctl list interface xenbr4 | grep mtu

📖 Expected Results

  • eth4 MTU = 9000
  • xenbr4 MTU = 9000
  • VMs' VIFs inherit MTU 9000
  • Jumbo frames supported end-to-end

📖 Troubleshooting

SymptomLikely CauseSolution
MTU resets to 1500 after rebootSystemd service not enabledCheck service status
Ping fragmentation on large packetsSwitch ports not configured for MTU 9000Enable jumbo frames on switch ports
iperf3 speed lowMTU not properly set at all layersDouble-check NIC, bridge, VM, and switch

📖 Bonus: Quick MTU Validation Script

#!/bin/bash
echo "Checking eth4:"
ip link show eth4 | grep mtu
echo "Checking xenbr4:"
ip link show xenbr4 | grep mtu
echo "Checking VMs VIFs:"
ip link | grep vif | grep mtu

📖 Final Notes

  • Always verify MTU end-to-end: Storage → Switch → Hypervisor → VM.
  • Setting mtu_request in OVS and using a small systemd service guarantees success across reboots.
  • Jumbo frames dramatically improve 10GbE performance, especially with storage traffic like iSCSI and NFS.

🎯 End of Tutorial