Adding an e1000 NIC in XenServer 7

*Note: This is not officially supported – do this at your own risk.*

Sometimes, virtual appliances or other random VMs in your lab need a simple, widely supported NIC and just wont boot (or install) without one. XenServer uses a Realtek RTL8139 10/100 card when you don’t have integration services installed. This is usually not an issue…but it certainly can be.

In older versions of XenServer, there was a patch available as mentioned in this thread that allowed you to use a custom field to apply the e1000 NIC to individual VMs rather than every single VM – the patch is available here. (read the thread first for instructions)

Now that XenServer 7 is publicly available, the patch above no longer works and throws the following error:

So, it looks like it can’t find the qemu-dm-wrapper file – because it is in a different location in XS7. That being said, I have not re-written the patch to look in the correct location (my python-fu is not what it should be) but I will tell you how to get it working, and you will still need the code from the patch.

We are going to manually modify the qemu-dm-wrapper file – if you don’t feel comfortable doing that, DON’T. I’m not responsible for you hosing up your Dom0…you’ve been warned. 🙂

in XS7, the file is located here:


So SSH into your XenServer and fire up your favorite text editor on the above file. We need to add two things:

  1. The e1000_enabled_os function
  2. The if statement in the main function

You can type these in by hand, but you will be using the source from the original patch – you should end up with this:


Then you will need to add the ‘NicEmulation’ custom field into the VMs and populate it with the string ‘e1000’ to get an e1000 NIC on your virtual machine.


Original Patch Code (Thanks to WANSec)


--- /opt/xensource/libexec/qemu-dm-wrapper-orig 2014-01-08 00:39:55.000000000 -0600
+++ /opt/xensource/libexec/qemu-dm-wrapper      2014-01-08 00:41:59.000000000 -0600
@@ -75,9 +75,31 @@
        setrlimit(RLIMIT_CORE, (limit, oldlimits[1]))
        return limit

+def e1000_enabled_os(argv):
+        import re
+        import os
+        res ='((?:[A-Fa-f\d]{1,2}(?:[-:])?){6})', ' '.join(argv))
+        my_mac =
+        #print 'vif_uuid = xe vif-list MAC=' + my_mac + ' --minimal'
+        vif_uuid = os.popen('xe vif-list MAC=' + my_mac + ' --minimal').read().rstrip()
+        #print 'vm_uuid = xe vif-param-get uuid=' + vif_uuid + ' param-name=vm-uuid'
+        vm_uuid = os.popen('xe vif-param-get uuid=' + vif_uuid + ' param-name=vm-uuid').read().rstrip()
+        #print 'result = xe vm-param-get param-name=other-config param-key=XenCenter.CustomFields.NicEmulation uuid=' + vm_uuid
+        result = os.popen('xe vm-param-get param-name=other-config param-key=XenCenter.CustomFields.NicEmulation uuid=' + vm_uuid).read().rstrip()
+        if (result == 'e1000'):
+                return True
+        return False
 def main(argv):
        import os

+       if e1000_enabled_os(argv):
+               argv = [arg.replace('rtl8139','e1000') for arg in argv]
        qemu_env = os.environ
        qemu_dm = '/usr/lib/xen/bin/qemu-dm'
        domid = int(argv[1])


Once you have patched the file in Dom0, you need to add a Custom Field to the VM and enter the string ‘e1000’ to emulate an e1000 NIC, otherwise the Realtek NIC will be used.



13 thoughts on “Adding an e1000 NIC in XenServer 7

  1. Hi I did what you described but I can’t boot the vm anymore. I receive an error “An Emulator required to run this VM failed to start”. Any idea how to fix?

    • Han,

      I can’t say I’ve run into that before – have done this successfully numerous times. The only thing I can think of is to not copy directly from webpage to put into text editor as Unicode != ASCII, etc. Or if hand typed, make 100% sure it is correct.

  2. I have ran through the tutorial and have come up with a strange issue. I was able to get the hack to work with great success, but the problem is I am unable to migrate VMs between systems or move storage between local and NFS I receive Storage_interface.Does_not_exist(_). Tried lots of things like restarting the toolstack, rebooting the system, nothing helps. The only thing that works is when I change qemu-dm-wrapper back, I am then able to migrate machines. Any ideas?

    • I cannot say that I have run into this issue and really wouldn’t know how to address it. That said, the hack is not supported nor should it be used in production environments.

  3. Hi Jake, Great article. I understand why this hack isn’t supported in a production environment but do you know why Citrix is so loathed not to include “NIC choice” in Xenserver? I realise you can’t answer for Citrix (or would want to), I am just curious about this and the possible reasons, as “Xen Tools” is not always an option (as seen by demand for this fix). A lot of us want to also virtualise “closed boxes” like firewall appliances and without being able to choose the hardware presented to the VM, we’ll need to continue to look at other Hypervisors, which is a shame. Thanks for your time, regards, Darrin.

  4. Hi Jacob,

    thanks for the fix and excellent post, I’ve tried this on XenServer 7.1 and it works.

    using vi editor as mentioned in the post. copy paste into vi editor and save your changes, dont use winscp or notepad to edit where I was seeing the same errors as above

  5. Got this working for 7.1 ***BUT*** the switch using NicEmulation didn’t work, so just I just added one line to qemu-wrapper-dm:

    def main(argv):
    import os
    import sys

    argv = [arg.replace(‘rtl8139′,’e1000’) for arg in argv]

    qemu_env = os.environ
    qemu_dm_list =[]
    loc1 = ‘/usr/lib/xen/bin/qemu-dm’
    loc2 = ‘/usr/lib64/xen/bin/qemu-dm’
    loc3 = ‘/usr/lib/xen-4.1/bin/qemu-dm’
    loc4 = ‘/usr/lib/xen-4.2/bin/qemu-dm’
    loc5 = ‘/usr/lib/xen-4.4/bin/qemu-dm’

    It means you always get e1000, but for my case I’m not too worried.

Leave a Reply