Unlock gigabit ethernet performance in Citrix XenServer virtual machines
The following howto describes modification to critical system software. If you choose to follow this guide, you do so at your own risk.
The commercial version of Citrix XenServer does not allow you to choose the type of ethernet adapter to emulate within your VM. The standard device that is emulated is a Realtek 8139 (RTL8139), which is a 100Mbit/sec Fast Ethernet card.
Citrix themselves do not view this as a major issue, as they expect you to install paravirtualised drivers within your guest operating system. This works well for:
Under these Linux distributions, your entire kernel must be replaced by a Citrix supplied kernel. The paravirtualised drivers will outperform any emulated device.
However, if you're running a system with a customised non-standard kernel that doesn't support Citrix Xen paravirtualisation, you'll be stuck with a 100Mbit/sec bottleneck in your network. Sure, you can rebuild your kernel with the right paravirtualised drivers, but that's not always an option.
Those familiar with the open source version of Xen will know that the underlying QEMU device emulation can emulate an Intel 1Gbit/sec adapter, called "e1000". Apart from the additional speed, this device also supports jumbo ethernet frames. This emulation mode is available under Citrix XenServer, but is a hidden feature due to hard-coding of the Realtek driver option.
You'll need to SSH into your Citrix server and become root. Ensure you have:
First, rename /usr/lib/xen/bin/qemu-dm to /usr/lib/xen/bin/qemu-dm.orig:
Create a new /usr/lib/xen/bin/qemu-dm file with the following content:
Make the file executable and protect it from updates:
If you now shutdown and restart your Citrix virtual machines, they will have an emulated e1000 device instead of the RTL8139.
The "chattr" line above makes the replacement file "immutable". This means that the file cannot be overwritten, preventing the loss of this modification in the event of a system update.
However, this may cause updates provided by Citrix to fail at the point of installation. An alternative approach would be to leave the file unprotected, and re-apply this modification after Citrix-supplied updates have been applied.
To remove the protection from the file when needed for updates:
Upgrade from 100Mbit/sec RTL8139 to 1Gbit/sec e1000 emulation for dramatically improved network performance.
The e1000 device supports jumbo ethernet frames, enabling even better network efficiency for large data transfers.
Perfect solution for custom kernels that can't use Citrix paravirtualised drivers without kernel replacement.
Our virtualization experts have extensive experience with Citrix XenServer configurations and can help you optimize your virtual infrastructure safely.
The script intercepts all parameters passed to qemu-dm and replaces any occurrence of "rtl8139" with "e1000", then passes the modified parameters to the original qemu-dm binary.
This modification works with Citrix XenServer versions that use QEMU device emulation. Most guest operating systems have built-in e1000 drivers.