How to compile r8168 and r8101 modules for Realtek ethernet adapters

r8169 module has a lot of bugs and it doesn’t work well with a large number of Realtek’s adapters, so, a few days ago, I posted a patch for the Realtek r8101 module, which supports kernel 2.6.23 but not the 2.6.24, newest kernel in Ubuntu 8.04 «Hardy Heron».

This howto could be a solution for a large number of ethernet adapters issues.

The first step is downloading the right driver (r8101 or r8168) for the adapter:

  • r8168 supports RTL8111B, RTL8168B, RTL8111, RTL8168 and RTL8111C;
  • r8102 supports RTL8100E, RTL8101E and RTL8102E-GR.

Don’t try to compile the module now, it will not work, we need to apply a patch in order to make it working with Hardy’s kernel

Dowload in Home dir the patch for r8168 module or that for r8101, open a terminal and type these instructions to extract the tarball (I think it’s unnecessary, but filenames and paths could change, in according with the driver version):

cd ~/
tar -xvf r8101-1.007.00.tar.bz2
cd r8101-1.007.00/src

Now apply the patch to the r8168 sources dir:

patch < ~/r8168-8.005.00.hardy.diff.txt

Or, if you need r8101 driver, type this:

patch < ~/r8101-1.007.00.hardy.diff.txt

Finally, compile and install the module:

cd ..
make clean modules
sudo make install
sudo depmod -a

To avoiding r8169‘s loading at boot, create and open a new file, /etc/modprobe.d/blacklist-network:

sudo nano /etc/modprobe.d/blacklist-network

And add this line:

blacklist r8169

Finally, update the initial ramdisk:

sudo update-initramfs -u

At the next boot, your ethernet adapter will work really fine 😉

13 thoughts on “How to compile r8168 and r8101 modules for Realtek ethernet adapters

  1. Herman Bos

    I suggest not buying or using realtek cards at all. Avoid like the plague.

    Amazing what random behavior they can produce.

    We normally stick with intel nics, something we do not regret. they most costs 40 euro more but thats definitely worth it.

  2. Ste

    I found it also useful to preserve the environment variables by using

    sudo -E make

    and yes realtek is a plague. It took me 3 weeks to figure out that the standard Linux driver could not resume the power status correctly.

  3. Pingback: Alessio Treglia: Realtek’s modules, new version has been released | Christian eBuddy Blog

  4. Pingback: Alessio Treglia » Realtek’s modules, new version has been released

  5. Constantine Tsardounis

    It gives me this error.. what should i do?

    c@a:~/r8101-1.007.00/src$ patch < ~/r8168-8.005.00.hardy.diff.txt
    can’t find file to patch at input line 4
    Perhaps you should have used the -p or –strip option?
    The text leading up to this was:
    |diff -c ./r8168.h ../../
    |*** ./r8168.h 2008-01-09 05:27:22.000000000 -0800
    |— ../../ 2008-04-14 15:20:55.000000000 -0700
    File to patch:

  6. Brian Wilson

    Using the latest 8101 driver from Realtek (1.010) with Ubuntu 8.10 (kernel 2.4.27-generic) did not require your patch. The rest of your instructions are still accurate. Thanks for providing this information.

  7. Frode

    sudo: make: command not found

    How can I then install the driver? I (naturally) offline, so ‘sudo apt-get install make’ does not work, of course. I can’t find any information on how to install this offline…


    I love linux, every f**king time I try to use it (read install it), the network card is never recognized, and I have to spend X hours to get it work. The last 4 of 5 times… I know at least why I prefer windows…

  8. Csaba

    When I install Ubuntu 8.10 my driver Realtek 8102 works like a charm. Until I run all the first initial 250 some updates. Then my NIC is no longer working. Something is being overwritten and changed to being able to connect.
    Anybody knows which patch overwrites the Realtek driver and causes it to stop working ?

  9. Pingback: My Tiny New Home Server! » - Web Playground of Christoph Hack

  10. Pingback: install best ethernet driver for Realtek RTL8101E/8102E » Philipp Klaus's Computing Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.