【超佩服】解决ubuntu系统不能使用技嘉(GA)主板内置网卡(芯片R8168)的问题

本文详细介绍了如何解决Ubuntu 11.04及其以上版本中,由于技嘉主板内建R8168芯片网卡驱动导致的网络问题。提供了解决方案,包括在CentOS上使用kmod-r8168,从OpenSUSE 11.1 NIC驱动库安装r8168-kmp,以及在Debian和Ubuntu上从源代码编译驱动。文章给出了详细的步骤,包括导入密钥、安装驱动、编译和激活新驱动等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

原文参考: http://wiki.hetzner.de/index.php/Installation_of_r8168_network_driver


最近新配了一台服务器,因为用了技嘉主板,安装ubuntu系统之后,发现根本无法使用网络。后经查发现是驱动的问题,必须要更换系统自带的网卡驱动。

ubuntu11.04(其他版本也一样)自带了r8169这个驱动,我们必须把它换成RealTeck官方的网卡驱动。具体操作步骤见下文:

注意:如果里面的驱动源码无法下载,也可以使用这个地址:

ftp://WebUser2:n8W9ErCy@58.211.24.153/cn/nic/r8168-8.024.00.tar.bz2


The Linux driver r8169 for the Realtek network chip in the EQ servers does not work correctly in CentOS 5.x, 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]

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.

Due to the inadvertent application of an erroneous patch upstream, the updating of kmod packages is currently broken for CentOS 5.5 (el5.5).A workaround is explained at http://elrepo.org/tiki/Update

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 /tmp
wget http://download.hetzner.de/drivers/r8168-8.019.00.tar.bz2
tar xjf r8168-8.019.00.tar.bz2

Compiling the driver

cd r8168-8.019.00
make 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/r8168
echo "depmod -a" >> /tmp/r8168
echo "modprobe r8168" >> /tmp/r8168
echo "service network restart" >> /tmp/r8168
echo "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. Note If additional NICs are installed in the server, the module must not be blacklisted.

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

Then we force the kernel to include the driver in the initrd. This also ensures, that the new r8168 module is loaded before the r8169 module.

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.]]



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值