Realtek RTL8168
From Gentoo Linux Wiki
Use this driver if you have a Realtek 8168/8169/8101/8111 based PCI-E/PCI ethernet card.
Contents |
[edit] Kernel
| Linux Kernel Configuration: Kernel 2.6 |
Device Drivers --->
Network device suport -->
[*] Network device support
Ethernet (1000 Mbit) --->
<*> Realtek 8169 gigabit ethernet support
|
[edit] 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.
- For 2.4.x kernel choose: Linux driver for kernel 2.4.x (Support x86 and x64) (it's the well-known r1000 driver)
- For 2.6.x kernel choose: Linux driver for kernel 2.6.x (Support x86 and x64) (according to Realtek's release note this driver is modified version of r8169.c from 2.6.18 kernel and supports only RTL8168B/8111B and RTL8168C/8111C)
[edit] 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 -->
[edit] 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.
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
[edit] 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
[edit] Troubleshooting
[edit] 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.
[edit] 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).
