21 | 11 | 2009
Debian Squeeze - Setup driver for Network interface Realtek RTL8111/8168 on motherboard Intel D945GCLF2 PDF Imprimer Envoyer
Écrit par Nicolas Bernaerts   
Mardi, 12 Mai 2009 00:00

Update : If your kernel is 2.6.30+, you don't need to follow this guide anymore as the kernel includes a proper driver.

If you update your kernel to 2.6.30+ and you had followed this guide before, be careful to remove the blacklist of r8169 module in /etc/modprobe.d/blacklist.conf before reboot, or you won't get any network support ...


Having upgraded a D945GCLF2 motherboard to Debian Squeeze, I started to have lot of troubles & serious problems with the integrated network interface Realtek RTL 8111/8168.

For example, the mt-daapd music server was totally unstable, having difficulty to serve more than one Roku music player. The multicast functionality was totally broken.

After some search, it appears that the driver used by the 2.6.26 kernel for that NIC was the wrong one. Instead of using a proper r8168.ko module, the 2.6.26 kernel was using the r8169.ko module.

The best way to check if this problem occurs for you is to check your NIC & the number of dropped frames on your interface :

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

# ifconfig
...
eth1      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet adr:xxx.xxx.xxx.xxx  Bcast:xxx.xxx.xxx.xxx  Masque:xxx.xxx.xxx.xxx
          adr inet6: xxxx::xxxx:xxxx:xxxx:xxxx/xx Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15637486 errors:0 dropped:592735036 overruns:0 frame:0
          TX packets:28107376 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          RX bytes:3858790706 (3.5 GiB)  TX bytes:1864613642 (1.7 GiB)
          Interruption:220 Adresse de base:0x8000
...

If the dropped frames number is important, it is time to solve the problem.

First thing to do is to download the latest Linux RTL8111 driver version from Realtek. The file should be downloaded in /usr/src.

Drivers are available at http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false

Then, if needed, you have to install the compilation environment :

# aptitude install make gcc
# aptitude install linux-kbuild-2.6.26
# aptitude install linux-headers-2.6.686

Once done, you need to uncompress the downloaded file :

# cd /usr/src
# bunzip2 r8168-8.011.00.tar.bz2
# tar -xvf r8168-8.011.00.tar

Then edit the makefile to adapt it to the debian environment as follow :

/usr/src/r8168-8.011.00/src/Makefile
...
KVER        := $(shell uname -r)
KDIR        := /usr/src/linux-headers-$(KVER)/
KMISC       := /lib/modules/$(KVER)/kernel/drivers/net/
...

Compile and declare the new kernel module r8168 :

# cd /usr/src/r8168-8.011.00
# make clean modules
# make install
# depmod -a
# insmod ./src/r8168.ko
# ifconfig -a

You now need to blacklist the previous 8169 driver for the next reboots.
Edit the /etc/modprobe.d/blacklist.conf and add these lines at the end :

/etc/modprobe.d/blacklist.conf
#replaced by r8168 for the NIC RTL8111
blacklist r8169

Make the change permanent :

# update-initramfs -u

All modifications have been done. You just need to reboot your machine for the new driver to become operational.

# reboot

After reboot, to check that the driver 8168 is used for the RTL8111/8168 interface, just do :

# lspci -v
...
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
        Subsystem: Device 8680:0100
        Flags: bus master, fast devsel, latency 0, IRQ 220
        I/O ports at 1000 [size=256]
        Memory at 88100000 (64-bit, non-prefetchable) [size=4K]
        Memory at 88000000 (64-bit, prefetchable) [size=64K]
        Expansion ROM at 88020000 [disabled] [size=128K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Mask- 64bit+ Count=1/1 Enable+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Mask- TabSize=2
        Capabilities: [d0] Vital Product Data
        Kernel driver in use: r8168
        Kernel modules: r8169, r8168

Done ...

Your network interface is fully operationnal !