Enabling e1000 Gigabit device emulation in Citrix XenServer

Unlock gigabit ethernet performance in Citrix XenServer virtual machines. WARNING: This describes modification to critical system software - proceed at your own risk.

The Problem

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 emulated is a Realtek 8139 (RTL8139), which is a 100Mbit/sec Fast Ethernet card. Citrix expects you to install paravirtualised drivers, which works well for supported OS. But for custom non-standard kernels, you'll be stuck with a 100Mbit/sec bottleneck.

The underlying QEMU device emulation can emulate an Intel 1Gbit/sec adapter called "e1000" which also supports jumbo frames. This is available but hidden due to hard-coding of the Realtek driver option.

Enabling e1000 Emulation

Step 1: Backup original file

# mv /usr/lib/xen/bin/qemu-dm /usr/lib/xen/bin/qemu-dm.orig

Step 2: Create replacement script at /usr/lib/xen/bin/qemu-dm:

#!/bin/bash
oldstring=$@
newstring=${oldstring//rtl8139/e1000}
exec /usr/lib/xen/bin/qemu-dm.orig $newstring

Step 3: Set permissions

# chmod 755 /usr/lib/xen/bin/qemu-dm
# chattr +i /usr/lib/xen/bin/qemu-dm

Step 4: Shutdown and restart your VMs. They will have emulated e1000 device instead of RTL8139.

Note: The "chattr" makes the file immutable, preventing loss during updates. This may cause Citrix updates to fail; remove protection with chattr -i before applying updates.