Thursday, August 11, 2011

ubuntu network with p8p67 motherboard (rtl8111e LAN)

Got new motherboard: asus p8p67 with realtek 8111e Gigabit LAN controller. On ubuntu the network works ugly - sometimes it doesn't connect to google and some other sites.

The problem is that ubuntu loads wrong driver for the network - r8169 instead of r8168. The solution is to download correct driver from realtek website and use it.


  1. Check to see if the r8169 module is loaded
    lsmod | grep r816
    r8168 41104 0 
    -> lspci -v
    01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)
    Subsystem: ASRock Incorporation Device 8168
    Kernel driver in use: r8169
    Kernel modules: r8169
    
  2. Download the official Realtek driver
    Realtek RTL8111/RTL8168
  3. Remove the r8169 module
    -> rmmod r8169
    -> mv /lib/modules/`uname -r`/kernel/drivers/net/r8169.ko ~/r8169.ko.backup
    
    ( the ` is a backtick, it is not an apostrophe or single quote )
  4. Build the new r8168 module for the kernel
    -> bzip2 -d r8168-8.009.00.tar.bz2
    -> tar -xf r8168-8.009.00.tar
    -> cd r8168-8.009.00
    -> make clean modules
    -> make install
    
  5. Rebuild the kernel module dependencies
    -> depmod -a
    -> insmod ./src/r8168.ko
    
  6. Remove the r8169 module from initrd
    -> mv /initrd.img ~/initrd.img.backup
    -> mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
    
  7. Add r8168 module to /etc/modules
    -> echo "r8168" >> /etc/modules
    

    Reboot, You are done!
  8. Examine that ONLY the r8168 module is loaded for the interface
    -> lspci -v
    01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03)
    Subsystem: ASRock Incorporation Device 8168
    Kernel driver in use: r8168
    Kernel modules: r8168
    


Links:
  1. http://ubuntuforums.org/showthread.php?t=1022411&highlight=8168
  2. http://aplawrence.com/Linux/rtl811.html

3 comments :

  1. Penkov thanks a lot!
    I new there was something wrong because the same thing happened to me in Windows with p8p67 latest drivers. Had to reset to cd ones.
    Now on ubuntu you saved me a lot of trouble!
    For people like you is that the web is so rich and linux so good! Thanks again!

    ReplyDelete
  2. Thank you very much!
    This works like a charm!

    ReplyDelete
  3. Thank you very much, my first time compiling the kernel, excellent.

    ReplyDelete