Compiling the Realtek RTL8111 driver on XenServer

I have been using Citrix XenServer for a short while now and it has become my virtual(is/iz)ation solution of choice.
Things were going great until I started to have problems after upgrading… It seems my onboard Realtek network interface (Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)) was not officially supported in XenServers HCL and became subjected to known driver problems.

RX packets:97840 errors:0 dropped:1203654335 overruns:0 frame:0

Although the network interface is still usable, as you can imagine – things are incredibly slow… especially if you rely on Remote Desktops/VNC/Terminal Services etc…
The solution was to use the Citrix XenServer Driver Development Kit (DDK) to compile the kernel module for the network interface card.

First we need to download the DDK VM, burn it to disk and then import it using XenCenter (this may seem an odd way of deploying a virtual machine – and although you could equally add the ISO to a CIFS or NFS ISO Storage Repository, It is always handy to have this ISO on a CD just in case).

Using XenCenter, you then need to import the DDK VM (Templates > Import Template… > Import type: Exported VM). When you browse the DDK CD, you need to select ‘XenServer Virtual Appliance Version 1 (ova.xml)’ and then you can set up a network interface, CPU(s) and memory for the Virtual Machine.

Once the DDK VM is up and running, you can use XenCenter to access its Console.

NOTE: Check the Realtek Drivers page for the latest version before proceeding.

wget ftp://WebUser:2mG8dBW@202.134.71.22/cn/nic/r8168-8.016.00.tar.bz2
tar vjxf r8168-8.016.00.tar.bz2
cd r8168-8.016.00
./autorun.sh

Using the autorun.sh script makes the compiling of the driver nice and easy but it does install the driver into the DDK VM root, so now we simply copy the driver for use in our XenServer installation.

NOTE: The following assumes that the kernel release is the same on both the XenServer and the DDK VM. Please replace ’192.168.1.1′ with your own XenServer IP address.

scp /lib/modules/$(uname -r)/kernel/drivers/net/r8168.ko 192.168.1.1:/lib/modules/$(uname -r)/kernel/drivers/net/

Next we can use XenCenter to access the XenServer Console and prepare the system to use the new driver.

cd /lib/modules/$(uname -r)/kernel/drivers/net/
mv r8169.ko r8169.ko.bak
insmod r8168.ko
depmod -a

Next we can edit /etc/modprobe.conf and change any reference of r8169 to r8168.

alias eth0 r8168

Everything is now ready to go, you need to reboot your XenServer for changes to take effect.

This entry was posted in Networking, System Admin. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

5 Comments

  1. Posted March 5, 2010 at 1:11 am | Permalink

    why did you need to mv the 8169 module?

  2. Posted June 3, 2010 at 5:53 am | Permalink

    Nice post… !!

    What if I have both Realtek 8111c (onboard) and Realtek 8169SC(PCI)??

    If I remove r1869.ko and replace it with r1868.ko, will both of them work?

    Thanks a lot

  3. Posted June 3, 2010 at 6:10 am | Permalink

    They are both very good questions, I removed the 8169 module because it still seemed to pick up 8168 network interfaces.

    I would assume there is some technique of putting some rules into your /etc/modprobe.d/ but I have never tried it.

    As I only have a single 8168 card, it was easier to remove the 8169 module.

    If anyone has more answers, please feel free to leave a comment!

  4. Johan
    Posted August 8, 2010 at 8:47 pm | Permalink

    After upgrading I have a similar problem but unfortunately it is now impossible for me to reach the system. So it’s also impossible to compile the driver with the DDK.
    Can you post/email the binary driver you compiled? (preferably i686 or i386 architecture)

  5. Posted August 13, 2010 at 3:22 pm | Permalink

    My Realtek RTL8111 driver problems are no longer an issue with XenServer 5.6.
    Upgrading was nice and easy and unfortunately, I did not keep any backups after the upgrade was successful.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WP Hashcash

Subscribe without commenting