Installation of r8168 network driver

来源:互联网 发布:mac windows编程区别 编辑:程序博客网 时间:2024/05/16 07:19

http://wiki.hetzner.de/index.php/Installation_of_r8168_network_driver

 

The Linux driver r8169 for the Realtek network chip in the EQ servers does not work correctly in CentOS 5.4, Ubuntu 9.04, OpenSUSE 11.1 and Debian Lenny. Timeouts and state changes to link down may occur. The solution is to use the official Realtek r8168 driver. Unfortunately this driver is not yet included in any distribution. For CentOS it can be installed from 3rd party repositories. For Debian and Ubuntu it must be compiled by the user.

This article describes how to setup the network driver.

Inhaltsverzeichnis

[Verbergen]
  • 1 Using kmod-r8168 from elrepo.org on CentOS
  • 2 Using r8168-kmp from the OpenSUSE 11.1 NIC drivers repo
  • 3 Installation from source
    • 3.1 Prerequisites
      • 3.1.1 CentOS
      • 3.1.2 Debian/Ubuntu
    • 3.2 Getting the sources
    • 3.3 Compiling the driver
    • 3.4 Activating the new driver
      • 3.4.1 CentOS
      • 3.4.2 Debian Lenny / Ubuntu 9.04

Using kmod-r8168 from elrepo.org on CentOS

ELRepo is a RPM repository for Enterprise Linux packages. ELRepo supports Red Hat Enterprise Linux and its derivatives (CentOS, Scientific Linux and others). It is the easiest way to get the r8168 driver for the standard upstream kernels.

NOTE: If you are using a special kernel like Virtuozzo, OpenVZ or something similar. You MUST compile the module yourself!

To install ELRepo for RHEL5, CentOS-5 or SL5:

rpm -Uvh http://elrepo.org/elrepo-release-0.1-1.el5.elrepo.noarch.rpm

Import the public key:

rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org

To install kmod-r8168 Realtek r8168 driver:

yum --enablerepo=elrepo install kmod-r8168

After reboot the new driver is used. It stays active even after kernel upgrades.

Using r8168-kmp from the OpenSUSE 11.1 NIC drivers repo

OpenSUSE offers prebuilt Kernel module packages (kmp). You just have to add the repository to zypper and install the matching package. In the example the -default kernel is assumed

 cd /etc/zypp/repos.d wget http://download.opensuse.org/repositories/drivers:/nic/openSUSE_11.1/drivers:nic.repo zypper install r8168-kmp-default

Before rebooting, the r8169 must be blacklisted.

echo "blacklist r8169" >> /etc/modprobe.d/blacklist

After the reboot only the r8168 module should show up in 'lsmod'

Installation from source

Prerequisites

Please make sure you are running the latest kernel available with yum or apt-get.

CentOS

On CentOS the packages 'kernel-devel' and 'kernel-headers' will install headers only for the newest kernel. The following packages need to be installed via the package manager:

yum install gcc gcc-c++ kernel-devel kernel-headers

Debian/Ubuntu

On Ubuntu the name of the header package depends on the selected kernel. It can be for example 'linux-headers-generic' or 'linux-headers-server'. Both will install headers only for the newest kernel. The following package will install everything required for compilation (as root):

aptitude install build-essential linux-headers-`uname -r`

Getting the sources

cd /tmpwget http://download.hetzner.de/drivers/r8168-8.015.00.tar.bz2tar xjf r8168-8.015.00.tar.bz2

Compiling the driver

cd r8168-8.015.00make all

Activating the new driver

CentOS

The file /etc/modprobe.conf needs to be edited. Change the line

alias eth0 r8169

to

alias eth0 r8168

To activate the new driver, we create a simple shell script that does the necessary steps.

echo "rmmod r8169" > /tmp/r8168echo "depmod -a" >> /tmp/r8168echo "modprobe r8168" >> /tmp/r8168echo "service network restart" >> /tmp/r8168echo "service ipaliases restart" >> /tmp/r8168

Execute that script:

sh /tmp/r8168

After several seconds the server should be back online using the new network driver. Our working directory can now be removed:

rm -rf /root/r8168

Debian Lenny / Ubuntu 9.04

After installing the driver, update the module dependencies.

depmod -a

First the r8169 network driver needs to be blacklisted in order to prevent the kernel from loading it.

Ubuntu:echo "blacklist r8169" >> /etc/modprobe.d/blacklist.confDebian:echo "blacklist r8169" >> /etc/modprobe.d/blacklist

Then we force the kernel to include the driver in the initrd.

echo "r8168" >> /etc/initramfs-tools/modules

And rebuild the initrd

update-initramfs -v -u -k `uname -r`

Now you can reboot to activate the driver.

After a kernel update the driver might need to be recompiled.

[[Kategorie:]]