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

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:

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:

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:

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):

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

[…] WARNING: This post is really old and it happens that it doesn’t work with newer Kernels ( >= 4.0). You should check out my new article if you want to install the driver for your RTL8111/RTL8168. You can check out the new article here: Click me (updated guide). […]

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.

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

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.

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 don’t log or keep my console output. A straight apt-get install r8168 did not get the latest version and still gave errors. Version from realtek still had problems dropping connection. The deb I got from http://mirrors.kernel.org/ubuntu/pool/universe/r/r8168 and installed without errors but still drops connection.

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)

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).

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

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 ?

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??

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.

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.

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?

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.

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 😉

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 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?

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.

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

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?

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.

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.

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.

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
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

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)

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

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.

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.