Search:  
Gentoo Wiki

RTL8168

Use this driver if you have a Realtek 8168/8169/8101/8111 based PCI-E/PCI ethernet card.

Contents

Kernel

Linux Kernel Configuration: Kernel 2.6
 Device Drivers  --->
     Network device suport -->
        [*] Network device support
        Ethernet (1000 Mbit)  ---> 
           <*> Realtek 8169 gigabit ethernet support

Alternative installation

Another way to support this card is to use the driver supplied from Realtek using this link.

As of 2007/5/25 Realtek has split the driver for 2.4.x and 2.6.x kernels.

Preparing to Install

Most likely, the fact that the RTL8168 isn't supported by the kernel is discovered during the Gentoo installation. In which case, the card needs to be working to continue with the installation. This means that one must download the driver on another computer or the same computer if dual-booting, unzip the driver, and put it on a disk so that it can be used for the Gentoo installation.

The Gentoo installation is done following the Handbook but skip the networking part and use the stages, snapshots, and distfiles on the Gentoo CD. Also, when chosing the kernel options; don't enable support for other Realtek network cards because they are not needed. When in the chrooted environment after compiling the kernel, do not install the driver yet. If one does, the driver will not work. When the handbook tells you to reboot the computer, do so. When the computer is booted up again, it is time to install the driver.

[comment by Cheoppy 09:09, 23 September 2007 (UTC)] Using the install-x86-minimal-2007.0-r1.iso InstallCD I had network connection (and internet access as well) using a RTL8111/8168B network controller (integrated in an MSI S262 laptop), and it seems that the 2.6.22-gentoo-r5 kernel does support this card. It works perfectly with 100Mbit router and ethtool reports that it is a gigabit NIC (although I couldn't test it yet if it can use a gigabit connection). I would recommend to try booting with the latest InstallCD and check if your rtl8168 card works.
Here's my lspci | grep Realtek output:
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)

<-- TODO: Add a compatibility list here -->

Installing the Driver

Copy the driver folder r1000 and its contents onto the hard disk. Enter into the driver folder and type the following commands.

Code:
make clean modules
make install
depmod -a

Now you need to edit /etc/modules.autoload.d/kernel-<your kernel version> and add the line below to insert the kernel module on boot:

File: /etc/modules.autoload.d/kernel-<your kernel version>
r1000

Remember to modprobe r1000 and run the network card's init script (most likely /etc/init.d/net.eth0 start) to use the network card before rebooting.

Warning: Kernel 2.6.24
For Kernel 2.6.24-gentoo-r8 I needed to apply the patch from
https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/141343/comments/21:

  cd r8168-8.006.00/src
  wget http://launchpadlibrarian.net/14011806/r8168-8.005.00.hardy.diff.txt
  patch < r8168-8.005.00.hardy.diff.txt
  cd ..
  make clean modules install

An Important Note on Recompiling The Kernel

Every time the kernel is recompiled, one must enter the r1000 folder and run the commands below again. This is due to the command make install_modules removing all the modules of the previous kernel.

make clean modules
make install
depmod -a

Troubleshooting

RTL8111/8168B (rev 02) using Gentoo-sources-2.6.26-r1

Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

remove "Use Rx Polling (NAPI)" under Realtek 8169 gigabit ethernet support from kernel

else it will produce wrong (rev ff) and wont work.

Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev ff)

by default, booting from gentoo livecd 2008.0 the nic reports the wrong rev. neither does installing the driver provided by realtek 8.008.00. Sabayon 3.5 live dvd can correctly detect and use this card by default.

Multiple Cards (rev ff)

If you have more than one card (some current boards do include two adapters) the driver seems to be broken. You should check if one of the cards has a (rev ff) in the lspci output. In that case you should disable one of the cards in the BIOS. The single card then should work properly.

Problems with disabled NIC

As of 27 May 2007, in kernel 2.6.21.3, you may experience the issues with the r8169 driver if you dual boot Windows on some systems. Windows by defaults disables the NIC at Windows shutdown time in order to disable Wake-On-Lan, and this NIC will remain disabled until the next time Windows turns it on. The r8169 driver in the kernel does not know how to turn the NIC on from this disabled state; therefore, the device will not respond, even if the driver loads and reports that the device is up. To work around this problem, simply enable the feature "Wake-on-lan after shutdown." You can set this options through Windows' device manager.

Edit: Problem with dual-booting with Windows exist also in 2.6.19.5 and 2.6.20.8 kernel, so it is safe to assume that it will concern all 2.6 kernels until the kernel developers update the drivers for RTL8168 to the version that will be able to turn on the NIC from disabled state. (Corey)

Second edit: Powering off and unplugging the machine for a few seconds (around 10 usually does it) seems to reset the card, so it will work in Linux again until you boot Windows again.

Third edit: 2.6.22.4 still cannot power up the NIC.

Fourth edit: Some BIOSes also disable the NIC when resuming, independent of whether Windows is installed or not (Fujitsu-Siemens Amilo Xi 2428).

See also

Retrieved from "http://www.gentoo-wiki.info/RTL8168"

Last modified: Sat, 11 Oct 2008 00:32:00 +0000 Hits: 35,639