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 most of the Realtek ethernet cards are working out of the box on a Linux machine. But some of them, for e. g. the RTL8111/RTL8168, making some troubles.
In the last three Ubuntu Versions (11.10, 11.04 and 10.10) and the latest Debian testing, you will have the problem, that the noticed ethernet card above will only work with round about 200kb/s and after a while the whole network connection will break down for more than a minute and than you will be back with your 200kb/s again.
So, this is really annoying and it’s nearly impossible to work with your machine. To solve this problem you have to use the official Realtek (r8168) driver instead of the r8169 driver, which is included in the Linux Kernel.
This tutorial will show you in a few steps, how you can build the official Realtek driver for the RTL8111/RTL8168 ethernet card for Ubuntu or Debian:
1. Get root privileges
Get root privileges, while typing “su” or (when you use Ubuntu) “sudo -s” in a terminal.
2. Get the requirements
To build and install the driver, we need the kernel headers and the build tools like gcc. To get them, just easily type in a terminal:
apt-get install build-essential
3. Get the driver
Now, go to the official download page from Realtek for the Linux/UNIX Driver for the RTL8111/RTL8168 ethernet card and download the latest driver version.
Link: Realtek Download Page
4. Untar the archive
The driver is compressed to an archive. So uncompress it with the following command:
tar xfvj r8168-8.025.00.tar.bz2
NOTE: Please do not forget to replace the “r8168-8.025.00.tar.bz2” with the driver version which you have downloaded!
5. Blacklist old driver
We have to blacklist the old driver (r8169) to prevent the system to load it. To do this, easily set a new entry in “/etc/modprobe.d/blacklist.conf” which is called:
or just enter in the terminal again
echo “blacklist r8169” >> /etc/modprobe.d/blacklist.conf
to do this in only one command.
6. Build and install the new driver
Now, the whole requirements to install the new driver are done. Let us now change in the driver directory, which we have uncompressed in a few steps before:
NOTE: Again, please do not forget, to change “r8168-8.025.00” to the version which you have downloaded.
The only think we have to do now is, to build the driver and install it. To build it, just type:
make clean modules
after a few secondes (depending on your CPU), the driver is build and you can install it with:
7. Welcome r8168
One of our last steps is, to let the system know about the r8168 driver. With the command
you rebuild the kernel module dependencies and with an
you insert the new kernel module (the driver) into the kernel.
8. Make it available for boot
To always use the new module, you have to make a new initrd boot file. Just do
mkinitramfs -o /boot/initrd.img-`uname -r` `uname -r`
in a terminal. Here we make the initrd file with the help of the “uname -r” command, which allows us to get the version of the actually running kernel.
At least, you have to add in the “/etc/modules” file a new entry, which is called “r8168”, to get the driver automatically loaded after boot. As an alternative you can do the last step again with only one command:
echo “r8168” >> /etc/modules
That’s it! After a reboot you should have the best possible performance with the RTL8111/RTL8168 and additionally no other network problems should be available anymore (no break down).
After the reboot you can check if the right driver is loaded with this command:
with this command you should find your RTL8111/RTL8168 network card in a list and the additional command “Kernel driver in use: r8168”.