How to Get Gigabit Speeds from RTL8111/8168B PCI Express Gigabit Ethernet controller on Ubuntu Linux

November 26th, 2010 by rvdavid Leave a reply »

Do a quick lspci. Now do you see: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02) for your Ethernet controller?

If so and your network connection information is reporting that your speed is 100 Mb/s rather than 1000 Mb/s, then you MIGHT be using the r8619 driver rather than the CORRECT r8168!

This is what I experienced when I had recently hooked my network up at home. I bought a ReadyNas Duo and updated my network switches to gigabit speeds with two D-Link Gigabit switches.

The expected Gigabit speeds 30 – 40 MB/s did not come. Instead I was getting sh*tty performance of 8 MB/s. So I tweaked a bunch of times then discovered the the bottleneck of the whole system was my NIC which when using the r8169 driver reports that 1000M mode is not advertised when probed by ethtool.

# ethtool eth0

This is because you are using the incorrect driver. Ubuntu linux by default somehow matches this particular NIC with the r8169 driver. You can fix this by downloading the correct r8168 driver, unpacking the downloaded driver archive and installing the driver following a quick step by step how-to in the r8168 driver’s readme file.

This is how you fix it.

  • Download the official realtek driver from here
  • First, remove the r8169 module from the linux kernel.

# rmmod r8169

  • Unpack the download and install the driver as per the readme instructions included with the driver. Here’s the relevant part of the readme file; well, the “Quick Install” anyway:

<Quick install with proper kernel settings>

Unpack the tarball :
# tar vjxf r8168-8.aaa.bb.tar.bz2
Change to the directory:
# cd r8168-8.aaa.bb
If you are running the target kernel, then you should be able to do :
# ./autorun.sh (as root or with sudo)
You can check whether the driver is loaded by using following commands.
# lsmod | grep r8168
# ifconfig -a
If there is a device name, ethX, shown on the monitor, the linux
driver is loaded. Then, you can use the following command to activate
the ethX.
# ifconfig ethX up
  • Finally, blacklist the r8169 driver add the following to /etc/modprobe.d/blacklist.conf:
#blacklist r8169 driver
blacklist r8169

Driver downloaded, Driver Installed and Blacklisted the r8169 driver – all done!

If your kernel’s settings are “proper” (apparently mine is because the above worked for me), you should now have 1000MB/s availble.  This is because you are now using the correct driver for your Network Card or NIC.

I hope this helps someone, because it took me a while to dig for this on the internet and realtek’s site looking for solutions on how to fix the r8169 driver misidentification issue I was having with my network card and the Ubuntu OS.
So in the end, the problem with me not being able to get gigabit speeds with my realtek gigabit network card or to be more specific, my  RTL8111/8168B PCI Express Gigabit Ethernet Controller using the r8169 driver,  is because it should never have been using that driver. Ubuntu should have identified your NIC correctly and used the r8168 driver instead. It’s a hard issue to figure out, and I’m not going to pretend it was easy either – for a relative newcomer like myself, I facepalmed in fear knowing that I had to install the driver manually on linux. As it turns out, it was pretty easy.
if you enjoyed this post, make sure you subscribe to my RSS feed!
You can also follow me on Twitter here.

Related posts:

  1. Linux RT818X driver crashes 2.6.20.x kernel
  2. Trying out some of The best 100 Linux Software from Ubuntu Repos
  3. Disabling the Laptop TouchPad in Ubuntu Linux
  4. Ubuntu Linux: Tweak your network connectivity and/or performance by disabling IPV6
  5. Linux Finally! I’m all Penguined up!
Advertisement

60 comments

  1. Stefan says:

    Hi there,

    I found your post while searching for a solution to my problem, which seems to be the same as yours.

    The new driver works but for some reason the blacklisting does not, seems my entry in /etc/modprobe.d/blacklist.conf is somehow ignored and r8169 is still loaded on reboot. I use Ubuntu 10.10 64bit.

    Any ideas ?

    • rvdavid says:

      Hmmm have you tried doing an rmmod on r8169?

      ———————————————-

      # rmmod r8169

      ———————————————-

      I might append this to the post.

      • Rob says:

        rmmod r8169 gives operation not permitted

        Also blacklist.conf is read only and can’t be edited … noob is weeping!

        • Rob says:

          Also ifconfig eth0 up give permissions denied

          • Rob says:

            Not to mention the lights on the ehternet port are off! This happens all the time under win7 as the driver is set to disable and one has to go into the driver details to turn back to powersave/AC/Batt … how to reach those driver settings with ubuntu?

          • rvdavid says:

            Hi Rob,

            The examples that are noted with # in front of them indicates that you need to be root to execute this command as only root or super users are able to perform this. While the examples with $ in front of them are normal user commands that do not need super user or root permissions to do them.

            issue the following command:
            sudo -i

            This should put you into super user mode.
            Then follow the instructions above as noted.

            HTH.

        • Florin says:

          Type “sudo su” (without the quotes) to become root. Then you will be able to do edit the file and use ifconfig.

    • Jeff says:

      The following should force the r8168 to load properly:

      Create an /etc/modprobe.d/r8168.conf file.

      Add the following line to the file:

      alias eth0 r8168

  2. gRandonkz says:

    nice post….i like ubuntu,,but i don’t not know to use it?

  3. nicam says:

    thanks for this post, was very helpfull on lenovo edge 13, now I get 37 mb/s instead of 15 mb/s

  4. Daniele Dellafiore says:

    procedure works, but in the end I got mod r8168 loaded but still 100Mbps in connection info. Worst, after rebook, the loaded modules is r8169 yet, despite blacklisted.
    lspci says:
    RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

  5. JW says:

    Thank you! (For investing the time to lighten someone else’s load)

  6. Patrick says:

    Thanks a lot ! It worked like a charm.

  7. Florin says:

    I had an issue that my network card suddenly stopped working. The lights turned off while Ubuntu was loading. Running some system commands gave different results: sometimes r8168 and sometimes r8169. Following this guide fixed the issue.

    More info about my system here: http://pastebin.com/BjBcYWNw

  8. UnderK says:

    (Almost one year later..)
    Hey, just wanted to thank you for this nice post!
    It tooks hours to find a solution and you were right, I just needed to install the official driver.
    I got the rev 06 one and it worked flawlessly.

    So for other people with this card, if you’ve tried disabling ipv6, changing your DNS config and nothing has changed, just install this driver (these manipulations took like 5 mins). Worth the try.

  9. rez says:

    Thank you so much for posting this! Great help!

  10. roy.nico says:

    Hej ,

    thanks for the post.

    I have a Laptop HP Touchsmart tm2 2105eg.
    I installed the 8168 driver. It is correctly loaded, and the Connection info indicates 1000Mbps…
    … but a simple Download test with another PC (under windows) shows a rate of 100Mbps.
    The same test, but under windows on the laptop shows app. 500Mbps.
    what can i do !?
    thanks

    nicolas

  11. Bheeshmar says:

    Thanks very much for doing this legwork! I was just about to get very frustrated with my wife’s new PC. :)

    Worked like a charm on 11.04.

    • nicolas roy says:

      Hello. When you say “it works”, what does it mean excatly ? Did you perform a speed test (wit a download from another PC for example) ?

  12. Artur says:

    thank you very much, it works :)

  13. Martin says:

    Fantastic, thank you!

  14. Rob says:

    Ok, thanks for the great info!

    When I tried it, the autorun got to the point where it tries ‘modprobe’ and I got “Fatal error: file not found” (I’m paraphrasing here)

    I googled around and tried ‘depmod -a’ which seemed to fix it, cuz I did the modprobe manually.

    Sadly though, even though it now says I’m using the right driver, it still shows the speed at 100MBit/s :(

    Not sure what else to try… cable is cat5e and switch is gigabit- other ports are showing GB lights, except this one

    Thanks in advance if you have any other suggestions!

    Rob

  15. Nejra says:

    Thank you so much for this!

    I had to use my new system for work in a hurry, but the network problem made it unworkable. Now it works like a charm :)

  16. knorosow says:

    Same nic, Ubuntu 10.04: greater network operations like importing 1000s of pictures off a nfs network share, stopped the nic to work after some time. Reboot required. Now with the r8268 driver you mentioned, it works smoothly, and even faster. Though it showed the GBit before anyway.
    Many thanks for your time, David!

  17. r9s says:

    You should first write “Download the official realtek driver from here” and then
    # rmmod r8169
    because when you rmmod then you lost your connection and you can’t download driver. By this I had screwed.

    • rvdavid says:

      Hey thanks for the feedback – point taken and I’ve updated the post.

      Hopefully, you found out that rmmod was not permanent and that it would have come back after reboot or you could have used modprobe to bring it back.

      Hope it worked out in the end for you.

  18. Raash says:

    Thanks man! Worked like a charm! Speed went from 8 Mbps back to 30 mpbs! No wonder my speeds were crappy.

  19. michal says:

    worked like a charm, thanks a lot

  20. lmy says:

    err… still having this issue 25-jan-2012

    it’s been more than a year

    any chance this module will get fixed?

    • rvdavid says:

      I don’t have my ears to the ground regarding module development, so I don’t know if this module has been, or will be fixed.

      What issues are you having exactly lmy?

  21. ah, finally an useful thing! I was looking for this for days…

  22. Giovanni says:

    Thanks for the info. Just to tell you that from http://askubuntu.com/questions/46942/how-do-i-stop-my-ethernet-network-connection-from-dropping there is another link to download the driver (is actally the same) but there you can check the SHA1 checksum. By the way, the new driver, 8.028 already works with the 3.0 kernel.

    However, with my RTL8111/8168B (rev 3), when I use #ethtool eth0 it reports that my speed is 100Mb/s. Perhaps is my modem? How can I know?

    • rvdavid says:

      Hey thanks for providing a link.

      Getting the card to advertise gigabit transfer rates is just a piece of the puzzle.
      All networking components you are will also need to support gigabit transfers.

      For example, I have a switch and modem that supports gigabit transfers also.
      As your connection will only ever be as fast as the component which has the slowest transfer rate.

      If you have GB transfer capable switch and NIC, but your modem only supports 100MB, your transfers will be 100MB.
      Same if the switch is 100MB and your modem and NIC are capable of GB transfer rates.

      HTH.

      • jong says:

        Another way to say the same thing:

        A Gbit-capable ethernet port is a rare feature on a Modem.

        Gbit-capable Routers, typically offer a 4-port 1000/100/10bTx switch, and a 100bTx uplink. You may not be paying any extra for WiFi in these units, anymore, but you do still have to pay extra for the Gbit4port feature.
        (security?wi-fi can be disabled)

        GbitSwitches are almost as cheap as slower units, but old&slow 10/100 ethernet devices are still most common.

        Use certain-colour cable (or tag both ends with black electrician’s VinylTape) for all links out of a slow device. That may help you visualise who’s the slowpoke.

  23. Uniuser says:

    I’d just like to thank you for providing this information- it has been very helpful. 6 times faster internet!

  24. Char says:

    Thanks for putting this up! My machine was having big troubles connecting to a switch after having no issues at all connected to my router at home – I came here, I read, I conquered!! :-)

    Cheers rvdavid, you are the man!

  25. darkfur93 says:

    Thank you. This worked for me. I’m using the Asus M5A97 Motherboard on Ubuntu 10.10.

  26. taypen says:

    hey!
    you wrote “The expected Gigabit speeds 30 – 40 MB/s did not come.”

    shouldn’t it be 60MB/s speed i had once(linux server)
    or 90MB/s – 100MB/s (speed i get on windows serfer)?

  27. Dingo_aus says:

    This really helped me out. Cheers!

  28. abysheque says:

    The solution helps perfectly. We were facing the issue on RHEL 6. Downloaded the driver, installed it, blacklisted old driver. Wokring perfectly. Thanks a lot!

    Wondering why this faulty driver was part of Linux installation CD. Anybody can put some light on it.

  29. hawaiiman says:

    The autorun.sh from realtek hangs at second step. I had to rmmod r8169 by itself. I am running 12.04.I have onboard 8111b which was fine with 8169, but needed 2nd eth as this will be a server. Out of desperation added a second 8111c card and rmmod the r8169 hoping the autorun.sh would complete, but nope. I wish I had more experience. BTW when you say “you can always use modprobe to get it back” that assumes a noob like me knows how to use modprobe. not

  30. Aaron Middleton says:

    For those of you still struggling, I have had this same issue. Everything looked fine on inspection, telling me that it was running at Gigabit speeds, however, it turns out i had installed the card on a x1 speed PCI-e slot. This limits the bandwidth to 250Mb/sec and will slow down your link.
    Hope this helps

  31. Phil says:

    Hi,

    I had suddenly a very slow Internet connection with ubuntu. In widows was no problem at all, so I suspected a driver problem. Your post solved the issue immediately.
    Thank you so much for taking the time and posting the solution!

    Phil

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.