How To get your Realtek RTL8111/RTL8168 working (updated guide)

Realtek Logo
Image Source: wikipedia.org

A lot of people will remember my guide how to get a RTL8111/RTL8168 running under your Linux box. This guide is almost 5 years old now and I wanted to make a complete overhaul, because a lot of things has changed since then.

Why do I need this driver anyway?

Some people asked me, “Why do I need this driver anyway? Doesn’t the Linux Kernel ship it?”. This is of course a valid question. As far as I can see this, the RTL8111/RTL8168 is not Open Source and this would be of course the reason why the driver isn’t included into the Linux Kernel. As long as the driver isn’t Open Sourced, we have to build it on our own.

The installation methods

A lot of things have changed since I written the initial article about how to compile the driver under Ubuntu / Debian. Today we can use 2 methods for installing the driver. The following lines describes both of them.

The automatic way

NOTE: Thanks to the user “Liyu” who gave me this hint!
NOTE2: For this way you need a working internet connection. You could use WLAN or a USB ethernet card like this one to get a temporary internet connection. You could also download every needed single package onto USB from another PC and install them in the right order.

As I said ealier, 5 years is a long time. And today Ubuntu and Debian have the driver included in it’s repository. For Debian you have to enable the non-free package sources. For Ubuntu you have to enable the universe package sources. You can easily do this by open your /etc/apt/sources.list as root with your editor of choice and add for each line starting with “deb” non-free or universe at the end. So for example, if you use Debian a line like:

deb http://ftp.de.debian.org/debian/ jessie main contrib

would become to

deb http://ftp.de.debian.org/debian/ jessie main contrib non-free

The same for Ubuntu:

deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted

would become to

deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe

After this you have to do a:

sudo apt-get update

You can of course use graphical ways to enable non-free or universe. After you enabled the missing package repository, you will be ready to install the driver. This can be easily done with the following command:

sudo apt-get install r8168-dkms

The procedure will take some time, depending on your CPU because the driver will be build for your working Kernel. The good side is, that if any Kernel update happens on your machine, the kernel will be rebuild against the new Kernel automatically after the update because of the use of dkms.
After the procedure is finished, you should be able to use your network card instantly. If not, you should consider a reboot of your PC then.

The manual way

Well, the manual way is almost the same as it was before in the initial article. Anyway, I want to rewrite the steps here again. This is also tested against newer Kernels ( >= 4.0) which caused a lot of trouble for some people in the past.

  • 1. Install dependencies: Once more you need a working internet connection for this. You could also use the Debian or Ubuntu DVD which includes the needed packages. To install the dependencies just enter the following command:
    sudo apt-get install build-essential linux-headers-$(uname -r)
  • 2. Download the driver: You can download the driver from the official Realtek homepage. This is the link: click me. From the table, select the “LINUX driver for kernel 3.x and 2.6.x and 2.4.x” for download.
  • 3. Blacklisting the r8169 driver: The r8169 is loaded when the r8168 is not found on your system. This will give you a network and internet connection, but with the r8169 driver your RTL8168 card will be very unstable. This means slow download rates, homepages taking hours to load and so on. To avoid that the r8169 is loaded, we blacklist it. This is be done by entering the following command:
    user@linux:~$ sudo sh -c 'echo blacklist r8169 >> /etc/modprobe.d/blacklist.conf'
  • 4. Untar the archive: After you successfully downloaded the driver, cd into the directory where the driver is downloaded and untar the driver with the following command:
    user@linux:~$ tar xfvj 0005-r8168-8.042.00.tar.bz2

    NOTE: Your tar filename can of course differs if you download a newer version in the future for e.g.

  • 5. Compiling and installing the driver: Now we have to start compiling the driver. For this you cd into the extracted directory:
    user@linux:~$ cd r8168-8.042.00

    NOTE: Don’t forget to change your version number in the future here.
    Now that you are in the right directory, we can start with the real compiling process. For this Realtek brings an easy to use script which is called autorun.sh. So, to start compiling and installing the driver enter:

    user@linux:~/r8168-8.042.000$ sudo ./autorun.sh

    You should see a output which looks like this:

    Check old driver and unload it.
    rmmod r8168
    Build the module and install
    At main.c:222:
    - SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
    - SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178
    sign-file: certs/signing_key.pem: No such file or directory
    Backup r8169.ko
    rename r8169.ko to r8169.bak
    DEPMOD 4.4.0-31-generic
    load module r8168
    Updating initramfs. Please wait.
    update-initramfs: Generating /boot/initrd.img-4.4.0-31-generic
    Completed.

    You can ignore the SSL error for now. The driver should be successfully compiled and installed into your system. The driver is already loaded and should work.

  • 6. Check the driver: As a final step, you could start checking if the driver is really loaded into your Kernel. For this you can use the command lsmod. lsmod lists all drivers, which are usable by your Kernel. So, if everything was successful, you should see an output like this:
    user@linux:~/r8168-8.042.000$ lsmod | grep r8168
    r8168                 491520  0

    You can also check as well your ethernet device directly to see if the correct driver is loaded (special thanks goes to Tim which posted this in the comment section):

    user@linux:~$ sudo ethtool -i enp1s0
    driver: r8168
    version: 8.042.00-NAPI
    firmware-version:
    expansion-rom-version:
    bus-info: 0000:07:00.0
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: yes
    supports-register-dump: yes
    supports-priv-flags: no

    NOTE: You have to the change enp1s0 to the device name of your network card of course. This can be eth0, eth1, enp2s0, and so on.

    If your driver isn’t loaded until now, you should go with a reboot before further investigation.

That’s it

And that’s it. Now you’re ready to use your RTL8168/RTL8111 with the official Realtek drivers. If you have any questions and / or suggestions, please let me know in the comments.

Advertisements

95 thoughts on “How To get your Realtek RTL8111/RTL8168 working (updated guide)

    • Hi there,

      The manual way worked for me. I downloaded the latest driver from Realtek, compiled and as soon as it completed the install my internet connection was established.

      I had an issue with /boot being full so I fixed that and cleaned up my system. Apparently I cleaned it up a little to well. After doing the latest updates on my 16.04 Ubuntu rig, my internet connectivity was gone. I used this post to download the latest drivers for my ancient Ethernet card and now I’m good.

      Thanks for posting this tutorial Peter!

  1. I am still having problems with kernel 4.4.0.34 and r8168. If I go back to 3.19.0-65 and r6169 it seems better but still fails after a while and I have to sudo ifdown eth0; sudo ifup eth0 to get things working again

    • When you connectino is getting slow, grep the output of /var/log/syslog. Evenvtually we will find something here.

      Also, what does “lspci -v” say?

  2. lspci -v
    02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 02)
    Subsystem: Hewlett-Packard Company Device 2a73
    Flags: bus master, fast devsel, latency 0, IRQ 26
    I/O ports at e800 [size=256]
    Memory at febff000 (64-bit, non-prefetchable) [size=4K]
    Memory at fdff0000 (64-bit, prefetchable) [size=64K]
    Expansion ROM at febc0000 [disabled] [size=128K]
    Capabilities:
    Kernel driver in use: r8168

    • Ok, so how do you have installed the driver? With the automated script as shown in this post? Can you post your syslog output while the network connection is getting slower?

  3. If I ping my router or any other local machine I get a Destination Host Unreachable error. I then have to sudo ifdown eth0 and sudo ifup eth0 to get things working again for a short while before it all claggs up again.

    • Hmm … do you have really downloaded the package, transfered it to your machine and installed it by hand? Because this could mean that there are some dependencies missing now. Can you go with the buggy r8169 driver and apt-get here?

      If that isn’t an option, you should try to download the driver source and use the automated script as mentioned in this post to build and install it.

      • apt-get does not get the latest version of the driver.
        I disagree that downloading the deb would mean that dependencies could be missing

  4. The deb was installed with sudo dpkg -i dowload.deb so would have reported any missing dependencies, And I could always have installed them with sudo apt-get install -f but there were no missing dependencies

    • You should be more specific here … what do you mean with “apt-get doesn’t get the latest drivers”? Where did you downloaded the deb file if not from the official Debian repositories? Are you useing a package from testing / unstable under stable?

      As I said before, you could try to go with the drivers from the official Realtek Homepage as well. Eventually they will do the job in your case.

    • I am having the same problem, installing via this link, or apt-get , could not update the version to 8.042….It still shows 8.041 .
      sudo ethtool -i enps0f1
      driver: r8168
      version: 8.041.00-NAPI
      I believe , if somehow I am able to update the version to 8.042 , it would solve the problem, other wise the final option would be going back to to 3.19.0-65 and r6169 , and using sudo eth0 up whenever the connections drops ..(which is not possiblr in ubuntu 16.04)

      Have you found out a solution yet??

  5. Other than the latest deb version that installed okay I would get errors like module version 8.040.00-napi for r8168.ko is not newer than what is already found in kernel 4.4.0-34-generic (8.042.00-napi).

    • Well, I’m sorry but I can’t help you here then. I can just repeat myself: You could always try it with the driver from the official Realtek homepage…

      • Already tried that and installed using autorun.sh did not fix the problem. Version is the same as the deb, but as its not dkms would not update with any new kernel.

  6. M.S.I FM2+ A88XI ACV2 motherboard RTL 8111g LAN Linux Mint 18 KDE no Internet at all.
    By chance used an older LAN cable only 2 pairs connected 1/2 3/6 & Internet sprang to life.
    On Mint 18 KDE all I had to do was enter in Terminal :- sudo apt-get install r8168-dkms.
    Replaced the old 2 pair LAN cable 10/100 with new 4 pair 10/100/1000 cable the default now.
    Now every thing works 100 % on new Media PC, have never had a problem before like this
    Regards Eddy48

  7. To verify the driver version, you can execute: sudo ethtool -i enp7s0

    Example output:

    $ sudo ethtool -i enp7s0
    driver: r8168
    version: 8.042.00-NAPI
    firmware-version:
    expansion-rom-version:
    bus-info: 0000:07:00.0
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: yes
    supports-register-dump: yes
    supports-priv-flags: no

    Note: ‘enp7s0’ might be different for you on your system.

  8. thx for your “howto” but I still get stuck 😥

    dmesg :
    [ 152.258809] r8168: module verification failed: signature and/or required key missing – tainting kernel
    [ 152.259275] r8168 Gigabit Ethernet driver 8.042.00-NAPI loaded
    [ 152.259450] pci 0000:00:1c.2: PCI INT C: failed to register GSI
    [ 152.259454] pci 0000:00:1c.2: Error enabling bridge (-16), continuing
    [ 152.259501] r8168 0000:03:00.0: PCI INT A: failed to register GSI
    [ 152.259503] r8168 0000:03:00.0: enable failure
    [ 152.259510] r8168: probe of 0000:03:00.0 failed with error -16

    uname :
    4.4.0-39-generic #59-Ubuntu SMP on a Dell Latitude 3350

    lspci :
    03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

  9. Finally I landed on your site again and I was really happy to see the update. This problem gets serious in ubuntu 16.04 , the ethernet connection, just comes and goes. Ok so , I followed your 1st step, apt-get one, and somewhat it helped for few days ….but again the ethernet started coming and going off.
    Here is the status , of command sudo ethtool -i enp5s0f1
    driver: r8168
    version: 8.041.00-NAPI
    now as I see the latest version is 8.042.00-NAPI,
    I tried using your 2nd method using autorun script,
    still it wont update the version to 8.042 ,
    and the problem continues, please tell me how can I resolve the issue ?

      • how can I remove the apt package ,,..
        I tried
        sudo apt-get autoremove r8168-dkms
        and then ran autorun.sh script but on checking ethertool -i eth0 i still see the older version .

      • Hi there, thanks for your howto.

        To those who like me first tried the automatic version (and thus got version 8.041.00-NAPI installed), you will indeed need to remove it first (apt-get remove r8168-dkms) before running ./autorun.sh.

        You shoud then get version 8.045.08-NAPI installed.

        I don’t know what happens after a kernel update, though.

      • If you didn’t integrated the driver in DKMS on your own, you have to recompile + install the driver after every kernel update.

    • I had assumed I had installed the 8.042.00-NAPI driver but when I went and checked with ethertool -i eth0 I see I had an older version. So I repeated ( least I assume repeated ) sudo dpkg -i /home/family/Ethernet/r8168-dkms_8.042.00-1_all.deb
      and checked and I now have 8.042. Only thing I can think of was that this time I gave a full path name.

      Will let you know if my system starts behaving itself or I still have problems

      • I tried the same thing , unfortunately the even after uninstalling , it still remains the older version. Do you know how can I uninstall the older version.?
        sudo apt-get remove r8168-dkms wont work
        Another thing thing i wanted to know, does the problem persists after upgrading to 8.042, or it gets resolve??

  10. System seems to be behaving itself after installing 8.042. Not had to recycle ethernet adapter since

    When you do the dpkg command you get lots of messages as it installs for various kernels, perhaps you might find a hint as to where your problem lies with installation

    • Ok its done . I did
      sudo modprobe -r r8168
      this removed the older kernel modules , then , on running autorun.sh it installed the new driver 8.042.

  11. I am using Ubuntu 12.04 in my Laptop for the past couple of years but never accessed the Internet through a LAN cable until yesterday. However, when I plug in a LAN cable, I repeatedly keep getting an error “CABLE UNPLUGGED”. Apparently, this is a known bug because of incorrect driver (R8169 instead of R8168).

    I followed this post to install the actual driver for R8168. However, I am facing a weird problem while making the install (make or make install). There are errors being thrown during make 1, make 2 , make 3… While I do not exactly remember the error at this point in time but it has got something with the modules in the SRC directory ( error with r8168.NO and a few others ). The build doesnt get completed successfully and r8168.ko is not generated.

    What possibly could be the issue and what is the solution?

    Many Thanks in Advance.

    • Can you post the output? If it’s too long you can go to pastebin and post the link here. It’s a little bit hard to say what’s going wrong without the output.
      You could also try to upgrade your Ubuntu to the latest LTS version (14.04). This includes the r8168-dkms package in the repository which makes the installation of the driver rather easy.

  12. For those like me, that updated Debian 7 (Wheezy)’s Kernel with 3.16 using the backports repo. First edit your repo and add non-free in front of it, mine looks like this:

    # cat /etc/apt/sources.list.d/wheezy-backports.list
    deb http://ftp.us.debian.org/debian wheezy-backports main contrib non-free

    then you can install/update the firmware package from it using:
    # apt-get -t wheezy-backports install firmware-realtek

    This updated my firmware to the backports one and solved my problem.

  13. I’m using LinuxMint 18 and I’m trying to installl the driver for Realtek r8168 network card.

    I have put these commands in console:
    sudo apt-get install –reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms
    wget http://de.archive.ubuntu.com/ubuntu/pool/universe/r/r8168/r8168-dkms_8.043.02-1_all.deb
    sudo dpkg -i r8168-dkms_8.043.02-1_all.deb
    echo “blacklist r8169” | sudo tee -a /etc/modprobe.d/blacklist.conf

    and I have restarted the pc.
    The output of sudo dpkg -i r8168-dkms_8.043.02-1_all.deb is:
    http://pastebin.com/8eXinkNW

    It seems the installation is right, but it doesn’t work.
    The output of lspci -v is:
    00:19.0 Ethernet controller: Intel Corporation Ethernet Connection (2) I218-V (rev 05)
    DeviceName: Onboard LAN
    Subsystem: ASUSTeK Computer Inc. Ethernet Connection (2) I218-V
    Flags: bus master, fast devsel, latency 0, IRQ 31
    Memory at f7d00000 (32-bit, non-prefetchable) [size=128K]
    Memory at f7d3d000 (32-bit, non-prefetchable) [size=4K]
    I/O ports at f080 [size=32]
    Capabilities: [c8] Power Management version 2
    Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Capabilities: [e0] PCI Advanced Features
    Kernel driver in use: e1000e
    Kernel modules: e1000e

    The output of ethtool -i eno1 is:
    driver: e1000e
    version: 3.3.4-NAPI
    firmware-version: 0.1-4
    expansion-rom-version:
    bus-info: 0000:00:19.0
    supports-statistics: yes
    supports-test: yes
    supports-eeprom-access: yes
    supports-register-dump: yes
    supports-priv-flags: no

    It is still using the e1000e driver.

    Help, please.

    • Are you sure that you have a Realtek ethernet card installed? It looks like that you’re using a onbaord intel solution. Does your network connection actually have issues?

      • > It looks like that you’re using a onbaord intel solution

        Yes, the ethernet card is onboard, I think it is Realtek r8168.

        00:19.0 Ethernet controller: Intel Corporation Ethernet Connection (2) I218-V (rev 05)
        DeviceName: Onboard LAN

        I try to use these drivers:
        https://r8168dl.appspot.com/

        The mainboard is ASUS H81M-P PLUS:
        https://www.asus.com/Motherboards/H81MP_PLUS/

        Specifications:
        https://www.asus.com/es/Motherboards/H81MPLUS/specifications/
        Network: Realtek® 8111G, 1 x Controladora de red Gigabit

        The problem is I’m using the driver for Intel, e1000e, instead of r8168 driver, and I not have connection to the network.

        If I use an usb connector (https://www.pccomponentes.com/adaptador-usb-a-ethernet-rj45), it works perfectly

        Thanks

      • The link you posted says that you’re not using a Realtek onboard network device. So the driver e1000e which is loaded by the kernel (which you mentioned) is totally fine.
        You said that you have no connection to the network … so you get no network at all with your Intel onboard network? No ip address, gateway and so on?

      • This is the network hardware in Windows in the same pc:
        https://imagebin.ca/v/33ytBhwF1H7y

        I think the onboard network device is Intel and I don’t have to use the Realtek driver.
        The driver used in Linux is e1000e and it doesn’t work, the pc doesn’t receive the network parameters from the DHCP server placed in the router.
        I probed to use manual configuration of the network and neither works.

        If I use the usb connector, it receives all the network parameters (ip address, mask, gateway and dns) and I have connection to Internet.

        Thanks

  14. I have installed a new version of Intel driver:
    https://downloadcenter.intel.com/download/15817/Intel-Network-Adapter-Driver-for-PCI-E-Gigabit-Network-Connections-under-Linux-?product=71305

    but it neither works.

    Installation of driver version 3.3.4:

    # make install
    make -C /lib/modules/4.4.0-21-generic/build SUBDIRS=/home/usuario/Descargas/e1000e/src modules
    make[1]: Entering directory ‘/usr/src/linux-headers-4.4.0-21-generic’
    Building modules, stage 2.
    MODPOST 1 modules
    make[1]: Leaving directory ‘/usr/src/linux-headers-4.4.0-21-generic’
    # remove all old versions of the driver
    find /lib/modules/4.4.0-21-generic -name e1000e.ko -exec rm -f {} \; || true
    find /lib/modules/4.4.0-21-generic -name e1000e.ko.gz -exec rm -f {} \; || true
    install -D -m 644 e1000e.ko /lib/modules/4.4.0-21-generic/updates/drivers/net/ethernet/intel/e1000e/e1000e.ko
    /sbin/depmod -a 4.4.0-21-generic || true
    install -D -m 644 e1000e.7.gz /usr/share/man/man7/e1000e.7.gz
    man -c -P’cat > /dev/null’ e1000e || true
    e1000e.

    # modprobe -v e1000e
    insmod /lib/modules/4.4.0-21-generic/updates/drivers/net/ethernet/intel/e1000e/e1000e.ko

    # lspci -v
    00:19.0 Ethernet controller: Intel Corporation Ethernet Connection (2) I218-V (rev 05)
    DeviceName: Onboard LAN
    Subsystem: ASUSTeK Computer Inc. Ethernet Connection (2) I218-V
    Flags: bus master, fast devsel, latency 0, IRQ 34
    Memory at f7d00000 (32-bit, non-prefetchable) [size=128K]
    Memory at f7d3d000 (32-bit, non-prefetchable) [size=4K]
    I/O ports at f080 [size=32]
    Capabilities: [c8] Power Management version 2
    Capabilities: [d0] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Capabilities: [e0] PCI Advanced Features
    Kernel driver in use: e1000e
    Kernel modules: e1000e

  15. # dmesg | grep -e eth -e e1000
    [ 8.019593] e1000e: module verification failed: signature and/or required key missing – tainting kernel
    [ 8.019963] e1000e: Intel(R) PRO/1000 Network Driver – 3.3.4-NAPI
    [ 8.019965] e1000e: Copyright(c) 1999 – 2016 Intel Corporation.
    [ 8.020106] e1000e 0000:00:19.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
    [ 8.180362] e1000e 0000:00:19.0 eth0: registered PHC clock
    [ 8.180365] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) f8:32:e4:9e:ef:4e
    [ 8.180366] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection
    [ 8.180390] e1000e 0000:00:19.0 eth0: MAC: 11, PHY: 12, PBA No: FFFFFF-0FF
    [ 8.682210] e1000e 0000:00:19.0 eno1: renamed from eth0
    [ 8.781879] dm9601 5-1:1.0 eth0: register ‘dm9601’ at usb-0000:03:00.0-1, Davicom DM96xx USB 10/100 Ethernet, 00:e0:4c:53:44:58
    [ 9.096235] dm9601 5-1:1.0 enx00e04c534458: renamed from eth0
    [ 19.132871] e1000e: eno1 NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx/Tx
    [ 19.132874] e1000e 0000:00:19.0 eno1: 10/100 speed: disabling TSO
    [ 195.813049] e1000e 0000:00:19.0 eno1: removed PHC
    [ 195.913947] e1000e: eno1 NIC Link is Down
    [ 276.071077] e1000e: Intel(R) PRO/1000 Network Driver – 3.3.4-NAPI
    [ 276.071086] e1000e: Copyright(c) 1999 – 2016 Intel Corporation.
    [ 276.071535] e1000e 0000:00:19.0: Interrupt Throttling Rate (ints/sec) set to dynamic conservative mode
    [ 276.254381] e1000e 0000:00:19.0 eth0: registered PHC clock
    [ 276.254396] e1000e 0000:00:19.0 eth0: (PCI Express:2.5GT/s:Width x1) f8:32:e4:9e:ef:4e
    [ 276.254404] e1000e 0000:00:19.0 eth0: Intel(R) PRO/1000 Network Connection
    [ 276.254445] e1000e 0000:00:19.0 eth0: MAC: 11, PHY: 12, PBA No: FFFFFF-0FF
    [ 276.258504] e1000e 0000:00:19.0 eno1: renamed from eth0
    [ 278.067838] e1000e: eno1 NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx/Tx
    [ 278.067842] e1000e 0000:00:19.0 eno1: 10/100 speed: disabling TSO
    [ 484.126860] e1000e: eno1 NIC Link is Down
    [ 910.268374] e1000e: eno1 NIC Link is Up 100 Mbps Full Duplex, Flow Control: Rx/Tx
    [ 910.268385] e1000e 0000:00:19.0 eno1: 10/100 speed: disabling TSO

    • Perhaps the driver is going to work if you try a newer kernel version? You can download nightly builds for your Ubuntu from here: http://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D

      I have seen plenty of problems like Display Port not working over the time, but a newer kernel always fixed this for me. If you install a nightly kernel and you want to go back to Ubuntu default kernel you can select the default kernel from the GRUB boot menu. So there is no risk for you and this means it’s worth a try 😉

  16. Hello,

    Congrats’ on the article. 🙂

    Unfortunately this doesn’t work for me and I’ve tried it both ways.
    The connection still doesn’t detect the cable and it’s disconnected although the module is loaded.

    Dmesg output:

    [ 1.025457] r8168 0000:08:00.0 enp8s0: renamed from eth0
    [ 5.920988] IPv6: ADDRCONF(NETDEV_UP): enp8s0: link is not ready
    [ 5.921122] enp8s0: 0xffffc900018f6000, 30:65:ec:8d:cb:e7, IRQ 124
    [ 5.987726] IPv6: ADDRCONF(NETDEV_UP): enp8s0: link is not ready
    [ 117.006424] r8168: enp8s0: link up
    [ 117.006487] IPv6: ADDRCONF(NETDEV_CHANGE): enp8s0: link becomes ready
    [ 118.005925] r8168: enp8s0: link down

    Lspci :
    08:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
    Subsystem: Acer Incorporated [ALI] RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
    Flags: bus master, fast devsel, latency 0, IRQ 124
    I/O ports at 3000 [size=256]
    Memory at 84204000 (64-bit, non-prefetchable) [size=4K]
    Memory at 84200000 (64-bit, non-prefetchable) [size=16K]
    Capabilities:
    Kernel driver in use: r8168
    Kernel modules: r8168
    uname -r -> 4.4.0-45-generic

    lsmod | grep r8:
    r8168 495616 0

    Any ideas what I should do?

    Thank you,
    Stefan

    • Sorry for the late response. I was really busy the last days.

      Well, are you sure it’s not related to the cable? (I know, supid question…)
      Because so far your output of lspci and so on looks fine …

      • No worries.

        Yes, it was actually the cable – it seems that for some reason it doesn’t detect it, although it has signal and the internet connection was also upgraded.
        Now I have to remove it from the wall and replace it. 🙂

        Now the only problem I have with the laptop is getting the NVIDIA drivers to switch – because the Intel ones are horribly lagging. Nvidia Prime doesn’t do anything . Any ideas here also ? 😀

      • I’m glad that it is now working for you 🙂

        I’m useing a nVidia Prime Notebook as well. Right now I’m on openSUSE Tumbleweed but I also have a Ubuntu installation on the HDD for testing purposes. Everytime I boot into Ubuntu and switch the graphic card to nVidia with the nVidia tool, everything is going fine (you have to log off and log in again after every graphic card switch).
        For openSUSE I have to use the bumblebee software. This solution is also working fine and it has the plus that I don’t have to relog everytime I want to switch between Intel and nVidia. But on the other hand my HDMI is unuseable because it is fixed to the nVidia card 😦 (this varies between the notebook manufacturer).

        Do you know which implementation you’re actually useing (nvidia-prime or bumblebee)? And can you post or describe the problem a little bit more?

      • Sure thing – well the main idea is that the GUI doesn’t change anything – it tells me to re login, but it doesn’t do anything – not quick switch or selecting nVidia.

        What output is relevant for diagnostic?

        I haven’t used bumblebee – only nvidia 367.57 on Ubuntu proprietary drivers
        Thanks.

    • Well, the “idiot-proof way” you called it is simply to buy a USB to Ethernet adapter which works under your Linux box. I linked a working one in this blog post.

  17. Hey, I’m following your instructions for manual instalation, but at point 5 I get this output:

    Check old driver and unload it.
    Build the module and install
    At main.c:222:
    – SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:169
    – SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:172
    sign-file: certs/signing_key.pem: No such file or directory
    DEPMOD 4.4.0-57-generic
    load module r8168
    modprobe: ERROR: could not insert ‘r8168’: Exec format error
    Updating initramfs. Please wait.
    update-initramfs: Generating /boot/initrd.img-4.4.0-57-generic
    Completed.

    Anyone with the same problem?

    • This seems like you compiled this on another PC with another architecture. For example you compiled it under PC B with an x86 (32-Bit) Linux Installation and you want to install this under a x86-64 (64-Bit) Linux.
      The Error “Exec format error” normally means exactly this.

  18. So, since I ran into the following message after accidentally removing the r8168-dkms package from my debian box (I swear it’s my cats fault after walking around on my keyboard hitting apt-get remove gcc -y ….) I struggled installing the package again as I got the following error:
    cat@tree:~# apt-get install r8168-dkms
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package r8168-dkms is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘r8168-dkms’ has no installation candidate

    I could install it again after adding sid to the source.list file.

    > deb http://ftp.de.debian.org/debian sid main non-free

    I hope this helps. Ben

  19. Hi, thanks to this post I have finally installed this card. But now my HW adess is 00:00:00:00:00:00. I have both windows and linux installed on the computer and in windows the adress is 00:00:00:00:00:00 too. Any help?

  20. I don’t get it. If the source code is available to compile an own driver…doesn’t that make him open source?

    • The source code is freely available for download, that’s right. However, the licence of the source code says it’s not Open Source. Any Linux Distribution which just include the driver, can be sued by Realtek.

  21. After installing them driver on Ubuntu 16.10 i get a weird bug: My mouse cursor disappears whenever I move it into the bottom half of my desktop. I’m still able to click on stuff but i can’t see it anymore until i move it back to the upper half.

    • Are you sure that this has to do with the driver?

      I’ve experienced this as well on another machine which does use the newest Intel HD graphics chip (and a Intel ethernet solution instead of a Realtek).

  22. both the apt and manual method completed success, mii-tool will show you it’s “1000baseT-FD”.
    BUT when you copy some files from network, the r8168-dkms only get 11.x MB/s and latest driver(currently 8.044) only get 9.x MB/s….. it’s 100mbps actually. sucks.

    SO if you have r8169 nic, and need 1000mbps … go get a USB 1000baseT nic, and remember avoid chosing sh*t realtek chip based products.

    ps. my os is elementary 0.4, base on ubuntu 16.04.
    ps2.the default driver from OS works (only 100mbps 😦 ) either, so installing new driver did not help.
    ps3. thanks for your post.

  23. update: after reboot, the propertied driver (8.044) made the nic unusable, it can NOT get ip address from dhcp server now. luckly it’s a test device.

  24. Hello, I am new in Ubuntu. I compiled the driver by hand. I got the following:

    ~$ sudo ethtool -i enp2s0
    driver: r8168
    version: 8.044.02-NAPI
    firmware-version:
    expansion-rom-version:
    bus-info: 0000:02:00.0
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: no ************** Is it the problem?
    supports-register-dump: yes
    supports-priv-flags: no

    After rebooting, my computer still does not see Wi-Fi networks. What should I do?

    Thanks.

  25. Should “sudo apt-get install build-essentials” really be “sudo apt-get install build-essential”?

    When I try it with the “s” on the end I get E: Unable to locate package build-essentials

    When I try it without the s I can get the package. That being said I still don’t have it workiing.

  26. Please edit lines:
    1. Install dependencies:

    sudo apt-get install build-essential linux-headers-$(uname -r)

    Thanks to Slys!

  27. Can i translate this article to Korean on my blog? this is very useful. 🙂
    This works on my linux box with elementary OS 0.4.1 Loki which is Linux kernel 4.8

  28. I’m having problems install this driver with Debian Stretch, I followed the manual way sucessfully, but I can’t even ping my gateway, I already test the cable with another PC and the cable works. But in the laptop I always getting Destination Host Unreachable. Can you help me?

    • Hi there,

      can you post a output of the commands “lspci -v” and “ip a”? Please use a service like pastebin. These outputs are going to be very long so they don’t fit into a wordpress comment.

      Best regards

  29. hi
    I have opensuse 12.1 and switch to the mainboard gigabyte h81, and download the driver 8168-8.044.02 but compiling the autorun.sh gives me the following message:
    ‘/lib/modules/3.1.10-1.13-desktop/kernel/drivers/net/ethernet’: No such file or directory
    Check old driver and unload it.
    Build the module and install
    ./autorun.sh line 30: make: not found found

    Try copying the r8168.ko from src but it does not exist.

    Thank you for your support.

  30. thank you for this information.
    My installation (temporarily) doesn’t work any more. I’m working with Linux Mint 18.2. Which solution (debian or Ubuntu) shall I have to use?
    best regards and Thanks
    ringreg (DAU)

    • Sorry for the late response.

      Did you have done an kernel update on your machine? If so it’s very likely that you just have to compile and install the driver again.

      Best regards

  31. I stumbled across this tutorial/post after hours of trying to fix the same issue. After downloading the drivers released last week on the realtek site, I followed your direction and it solved the issue. Thanks Again

  32. Hi,

    Latest version for package r8168-dkms by Ubuntu release
    trusty (14.04LTS) (kernel): dkms source for the r8168 network driver [universe]
    8.037.00-1: all
    xenial (16.04LTS) (kernel): dkms source for the r8168 network driver [universe]
    8.041.00-1: all
    zesty (kernel): dkms source for the r8168 network driver [universe]
    8.043.02-1: all
    artful (kernel): dkms source for the r8168 network driver [universe]
    8.044.02-2: all
    source: https://packages.ubuntu.com/search?keywords=r8168-dkms
    and package change log: http://changelogs.ubuntu.com/changelogs/pool/multiverse/r/r8168/r8168_8.044.02-2/changelog

    Carlos

      • Hi,

        Information for driver version for each ubuntu release, for example for 16.04 latest version is 8.041.00-1, if you install by option 1 (automatic) this is the version installed not the 8.042.00 as you have on option 2 (manual) .

      • Ok, thanks. However, if you install the package r8168-dkms, your distribution installs the version which it has access to. But yes, it’s right that the driver which is gonna be installed depends on the distribution version you use. If you choose the manual way however, it’s up to you which version you’re going to use. Mostly you will use the newest one which is right now: 8.045. This version supports kernels up to version 4.7.

  33. Detection just worked for me when using a properly wired gigabit Ethernet cable, disregarding if I was connecting on a 100/fastethernet or 1000/gigabit switch.

  34. My Realtek NIC was recognized but unstable under high load (reading large files from NFS shares would just hang, and networking would go completely unresponsive.) The solutions here unfortunately did not help me — however, reinstalling with Ubuntu 17.10 instead of 16.04 has completely mitigated my issues, using the stock driver+kernel combination.

  35. The kernel timer api has changed in 4.15-rc1. DKMS driver does not compile anymore:
    /var/lib/dkms/r8168/8.045.08/build/r8168_n.c:22967:9: error: implicit declaration of function ‘setup_timer’; did you mean ‘sk_stop_timer’? [-Werror=implicit-function-declaration]
    setup_timer(timer, rtl8168_esd_timer, (unsigned long)dev);
    ^~~~~~~~~~~
    sk_stop_timer
    cc1: some warnings being treated as errors

    • Thanks for you comment.

      Ok, that’s bad. Seems like we have to wait until Realtek changes their driver. For now everyone should go with an LTS Kernel…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s