Enabling e1000 Gigabit device emulation in Citrix XenServer

Unlock gigabit ethernet performance in Citrix XenServer virtual machines

⚠️

Important Warning

The following howto describes modification to critical system software. If you choose to follow this guide, you do so at your own risk.

The Problem

🚫Limited Network Emulation

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's Expected Solution

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:

  • • Windows operating systems
  • • Red Hat Enterprise Linux
  • • CentOS
  • • Ubuntu

Under these Linux distributions, your entire kernel must be replaced by a Citrix supplied kernel. The paravirtualised drivers will outperform any emulated device.

The Performance Bottleneck

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.

💡Hidden Feature Discovery

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.

Enabling e1000 Emulation

Prerequisites

You'll need to SSH into your Citrix server and become root. Ensure you have:

  • • SSH access to Citrix XenServer
  • • Root privileges on the server
  • • Ability to shut down VMs temporarily

Step 1: Backup Original File

First, rename /usr/lib/xen/bin/qemu-dm to /usr/lib/xen/bin/qemu-dm.orig:

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

Step 2: Create Replacement Script

Create a new /usr/lib/xen/bin/qemu-dm file with the following content:

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

Step 3: Set Permissions

Make the file executable and protect it from updates:

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

Step 4: Restart VMs

If you now shutdown and restart your Citrix virtual machines, they will have an emulated e1000 device instead of the RTL8139.

Important Considerations

⚠️Update Protection

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.

Removing File Protection

To remove the protection from the file when needed for updates:

# chattr -i /usr/lib/xen/bin/qemu-dm

⚠️ Risk Assessment

  • • This modification affects critical system files
  • • May interfere with Citrix updates and patches
  • • Could potentially cause VM startup issues
  • • Not officially supported by Citrix
  • • Always test in development environment first

e1000 Emulation Benefits

10x Speed Increase

Upgrade from 100Mbit/sec RTL8139 to 1Gbit/sec e1000 emulation for dramatically improved network performance.

📦

Jumbo Frame Support

The e1000 device supports jumbo ethernet frames, enabling even better network efficiency for large data transfers.

🔧

Custom Kernel Compatible

Perfect solution for custom kernels that can't use Citrix paravirtualised drivers without kernel replacement.

Need Help with Citrix XenServer?

Our virtualization experts have extensive experience with Citrix XenServer configurations and can help you optimize your virtual infrastructure safely.

📝 Technical Notes

How it Works:

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.

Compatibility:

This modification works with Citrix XenServer versions that use QEMU device emulation. Most guest operating systems have built-in e1000 drivers.