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

              Symptom Likely Cause Solution MTU resets to 1500 after reboot Systemd service not enabled Check service status Ping fragmentation on large packets Switch ports not configured for MTU 9000 Enable jumbo frames on switch ports iperf3 speed low MTU not properly set at all layers Double-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