XenServer 5.6: Network problems with r8169 kernel module

Update 2010-10-21: Even with the new kernel module (r8168) the Hetzner monitoring reported short offline times now and then (about one ping failure every day). Compared to the old module (r8169) the problems occurred much less often. To examine the problem, I set up a cronjob to report the network status on the host system with a small script:

echo -n $(date +%Y%m%d-%H%M)
echo -n "   `/sbin/ethtool eth0 | grep "Link detected"`"
if ! ping -c 1 -q google.de >/dev/null
        echo "   google ping: FAIL"
        echo "   google ping: OK"

Surprisingly, this script did not report any network errors and since then also the Hetzner monitoring stopped reporting errors. In result my solution till this day is to use the module r8168 and to run my “network keep alive” script periodically (every minute).


Recently, I noticed some network problems (package losts) with an almost fresh XenServer 5.6 installation on a Hetzner EQ root server running a (SSH sessions disconnects, host and client system are not pingable for some minutes). After some research I found some resources that point out problems with the r8169 kernel module:

Summarized the resources suggested to replace the driver r8169 with the r8168 driver to eliminate the network problems. Of course, the driver has to be replaced only in the host.

lspci and lsmod show that the root server has a Realtek network card and that the problematic r8169 driver is used:

# lspci
06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
# lsmod | grep r81
r8169                  29108  0
mii                     5040  1 r8169

Replace r8169 module with r8168

As suggested, I replaced the r8169 driver with a new r8168 one. Unfortunately, there is no pre-compiled module for the XenServer 5.6. Here is a step-by-step introduction how to manually build the r8169 module and replace the r8168 module in the host system:

  1. Download XenServer’s DDK (Driver Development Kit) virtual machine from
    https://www.citrix.com/English/ss/downloads/details.asp?downloadId=2301285&productId=683148 (Additional Components -> XenServer Support Components)
  2. Copy the downloaded ISO to XenServer.
  3. Mount the ISO:
    # mount -o loop /PATH/TO/ISO/XenServer-5.6.0-DDK.iso /mnt/PATH
  4. Import the DDK virtual machine:
    # xe vm-import filename=/mnt/PATH/ddk/ova.xml
  5. Wait some seconds/minutes for the import job to be finished.
  6. In XenCenter add a network device to the newly created DDK virtual machine, start the machine and enter a new root password.
  7. Configure the network in the DDK VM; for a Hetzner EQ server this the typical settings are:
    • /etc/sysconfig/network-scripts/ifcfg-eth0
    • /etc/sysconfig/network-scripts/route-eth0
      IP-ADRESS-OF-HOST-SYSTEM dev eth0 scope link
      default via IP-ADRESS-OF-HOST-SYSTEM
    • /etc/resolv.conf
  8. Download the newest r8168 sources from ftp://WebUser:2mG8dBW@ I used the file r8168-8.018.00.tar.bz2 (49 KB 01.04.2010 09:59:00) (Download link: ftp://WebUser:2mG8dBW@
  9. Unpack the sources and build the module (this creates the file r8168-8.018.00/src/r8168.ko):
    # tar vjxf r8168-8.018.00.tar.bz2
    # cd r8168-8.018.00/
    # make all
  10. Copy the created r8168.ko to /lib/modules/ in the host system and set permissions to 0744.
  11. Rename the old r8169 module to prevent loading:
    # mv /lib/modules/ /lib/modules/
  12. Edit /etc/modprobe.conf:
    alias eth0 r8168
    alias r8169 off
  13. Unload the old module, load the new one and reboot the system (use one line for all commands, because rmmod will disconnect the server from the network):
    # rmmod r8169 && depmod -a && modprobe r8168 && reboot

After the system is again up and running again, lsmod should no longer list the r8169 module:

#  lsmod | grep r81
r8168                  95780  0

Additional information