How to Guide - Realtek RTL8111/8168B

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

How to Guide - Realtek RTL8111/8168B

Postby rarsa on Mon Sep 05, 2011 12:29 am

NOTE: I created this instructions under Linux Mint Debian Edition (LMDE) updated as of September 5, 2011. This instructions should work for other editions but I haven't tested them.

If you have a Realtek RTL8111/8168B, you may notice that the network connectivity is choppy.

This instructions are derived from the following post
http://www.foxhop.net/realtek-dropping- ... and-fedora
The Realtek r8168B network card does not work out of the box in Redhat, Centos, Fedora, or Ubuntu: instead of loading the r8168 driver, modprobe loads the r8169 driver, which is broken as can be seen with ifconfig which shows large amounts of dropped packets.


Here are the instructions to replace the driver in a nutshell
    - Download the file from the oficial realtek site
    - Open a terminal
    - Change directories to where the downloaded file is
    - Extract it
    - Change directories to the extracted directory
    - Execute autorun.sh
    - If you are using kernel 3.x: Copy the r8168.ko file to the right place and load the module

Here are the detailed instructions:

- Download the file from the official site
http://www.realtek.com.tw/Downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false#2

The rest of the steps depend on the filename and location of the downloaded file. Please adapt as required:

For example, if you download the file to your Downloads folder and the file is called r8168-8.025.00.tar.gz, the steps are the following

Code: Select all
cd ~/Downloads
tar vjxf r8168-8.025.00.tar.gz
cd r8168-8.025.00
sudo ./autorun.sh


If you are using kernel 2.x then you should be OK.

This script unloads and renames the r8169 driver so it does not cause any more trouble. There is no need to blacklist it but you can blacklist it if you want.
Code: Select all
echo "blacklist r8169" >> /etc/modprobe.d/blacklist.conf


If you are using kernel 3.0 you'll notice that the /src/Makefile has a bug that causes it to install the r8168.o file instead of the r8168.ko file

The solution is simple:

After the autorun.sh finishes, just do the following:
Code: Select all
sudo cp src/r8168.ko   /lib/modules/3.0.0-1-amd64/kernel/drivers/net/
sudo depmod
sudo modprobe r8168


And that's that.

In case you are curious about what the bug is:

Line 36 of the src/Make file is
Code: Select all
KEXT      := $(shell echo $(KVER) | sed -ne 's/^2\.[567]\..*/k/p')o


Which sets the KEXT to "ko" for kernels 2.5, 2.6 and 2.7. It sets KEXT to "o" for anything else. This was OK at the time as kernel 3.0 is quite recent.

The fix is to also include kernel 3.0 in that instruction
Code: Select all
KEXT      := $(shell echo $(KVER) | sed -ne 's/^2\.[567]\..*/k/p;s/^3\.0\..*/k/p')o



I hope this helps
Last edited by Oscar799 on Mon Dec 12, 2011 8:43 am, edited 1 time in total.
Reason: Title edited to make clear that it is a How To guide
rarsa
Level 1
Level 1
 
Posts: 8
Joined: Sun Jun 13, 2010 5:51 pm

Linux Mint is funded by ads and donations.
 

Re: Realtek RTL8111/8168B [HOW-TO]

Postby -Snowrider- on Sat Sep 10, 2011 7:11 pm

*NVM Got it working* Don't try editing the makefile just copy the file like it says.

Have you actually tested this with kernel 3. I followed you instructions and even edited the make file. I can't seem to get it to work.
-Snowrider-
Level 1
Level 1
 
Posts: 8
Joined: Tue Dec 28, 2010 11:00 pm

Re: Realtek RTL8111/8168B [HOW-TO]

Postby wernher on Sun Nov 06, 2011 5:31 pm

This helped me!
First I tried skipping the Linux 3.x part since they had changed the makefile, but it is still needed.
Thanks a lot!
wernher
Level 1
Level 1
 
Posts: 1
Joined: Sun Nov 06, 2011 5:02 pm

Re: Realtek RTL8111/8168B [HOW-TO]

Postby gct on Sun Dec 11, 2011 1:18 pm

Hi! I created an account just to reply and tell you this post saved my life. I had the exact same problem and these steps fixed it perfectly. I went from being able to pull ~1MB/s off my NAS to > 20MB/sec with this fix!
gct
Level 1
Level 1
 
Posts: 1
Joined: Sun Dec 11, 2011 1:16 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby Oscar799 on Mon Dec 12, 2011 8:45 am

Moved here by moderator
Image
"Don't fix it if it ain't broken,don't break it if you can't fix it" Husse
Registered Linux User #511789
User avatar
Oscar799
Level 18
Level 18
 
Posts: 8941
Joined: Tue Aug 11, 2009 9:21 am
Location: United Kingdom

Re: How to Guide - Realtek RTL8111/8168B

Postby scharkalvin on Tue Dec 13, 2011 11:12 am

Why hasn't the r8168 driver been added to the kernel? Can it be added to LMDE?
I will need to try this fix for my new installation of LMDE Xfce on a GB GA970 motherboard which has the rt8111 chip.
In my case the ethernet does work but very slowly do to dropped packets. I was averaging 100kbs downloads during the initial system update and web pages were as slow to load as if on a old style 56kb modem (instead of 6mbs DSL). The interface works fine on Windows 7. I was about to try an old 3Comm PCI card from the junk box to fix the problem (bet there is no driver for it on Windows 7 64 bit!).
User avatar
scharkalvin
Level 2
Level 2
 
Posts: 55
Joined: Sun Jun 06, 2010 6:46 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby rezsbc on Thu Dec 29, 2011 8:06 am

Thank you for this!

I was at my wits end with my NIC only working at 100Mb speed for ages (since Kernel 2.6 or so, I'm using Ubuntu amd64 here).

Followed your instructions and they worked to a tee. The Realtek driver I used is "r8168-8.027.00" so slightly newer than the 8.025 version that was current at the time of the post. I didn't notice any error when running the autorun script, nor could I find the offending line in the Makefile however just to be sure (as I'm on kernel 3.0.14) I copied the .ko file and loaded it as you suggested. (Into /lib/modules/3.0.0-14-generic/kernel/drivers/net on ubuntu).

All working fine now! NIC autonegotiates to 1000Mb/sec, I was just transfering files to a windows laptop at 108MBytes/sec!!! Wow! Didn't stay at that speed for long, hard drives presumably can't keep up but this is a major improvement can't thank you enough!!!
rezsbc
Level 1
Level 1
 
Posts: 1
Joined: Thu Dec 29, 2011 8:00 am

Re: How to Guide - Realtek RTL8111/8168B

Postby jinkaz on Sun Jan 08, 2012 10:20 pm

rarsa Thank You so much this worked like a charm! I tried everything from disabling ipv6 to making changes in the local.rc file however nothing worked till i tried this. the file I downloaded from the realtek site was r8168-8.027.00,unzipped and installed properly; no need to rename the ko file.
Thanks again rarsa!!!!!!!!!!!!!!!!!!!! :D
jinkaz
Level 1
Level 1
 
Posts: 1
Joined: Sun Jan 08, 2012 10:11 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby AlbertP on Mon Jan 09, 2012 10:21 am

Can anyone tell me if this is still needed on modern 3.1 or 3.2 kernels? I don 't own 8111/8168 hardware myself, my Realtek is (EDIT) 8101E.
Last edited by AlbertP on Thu Jun 28, 2012 4:14 am, edited 1 time in total.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
AlbertP
Level 16
Level 16
 
Posts: 6522
Joined: Sun Jan 30, 2011 12:38 pm
Location: The Netherlands

Re: How to Guide - Realtek RTL8111/8168B

Postby wizonesolutions on Sat Feb 18, 2012 3:53 pm

This helped me somewhat, but I still encounter long page load times at times, and I'm not sure if I have a different issue. What tools can I use that would enable me to provide more information?

What basically happens is that the loading animation for a page spins for quite a while - sometimes 2-10x longer than it does on my Windows 7 machine. Both are using the same Internet connection and using wired Internet.

So r8168 definitely improved things, but there's still something (not sure what) happening that makes pages take a while to load. speedtest.net does show that I'm getting the speed I should be...technically. But even that site takes longer to load than it perhaps should. It seems the external elements on the pages themselves are taking a while. This happens in both Firefox and Chrome.

I'm not showing any dropped packets.

Is 1500 the right MTU for cable?

(P.S. Please redirect me to the right thread if I've misplaced this.)
wizonesolutions
Level 1
Level 1
 
Posts: 5
Joined: Thu Dec 01, 2011 6:54 am

Re: How to Guide - Realtek RTL8111/8168B

Postby Bruce0 on Sun Apr 22, 2012 4:01 am

Update:
The current version 8.029.00 does copy r8168.ko correctly on 3.0.0.17 Ubuntu 11.10 server, the make file seems (rather elaborately) fixed.

And Thanks... you fixed my problem, which was a reliable crash when running Mac TimeMachine backups to an afpd server backup disk, using LACP 802.3ad bonding. Would crash right away for me whenever a backup started (but not other copies oddly).

Anyway thank you.
Bruce0
Level 1
Level 1
 
Posts: 1
Joined: Sun Apr 22, 2012 3:51 am

Re: How to Guide - Realtek RTL8111/8168B

Postby yakupm on Tue May 01, 2012 7:04 pm

Thanks for the excellent howto. Somethings to note:
    Have to do this whenever kernel upgraded.
    Don't have spaces in any directory/file name that is part of the path to the Realtek driver. I found this out when I upgraded to 8.029.00 - 2012/3/29.
    "If you are using kernel 3.0 you'll notice that the /src/Makefile has a bug that causes it to install the r8168.o file instead of the r8168.ko file" - this bug is fixed (I did not have to do this).

yakupm
yakupm
Level 1
Level 1
 
Posts: 1
Joined: Tue May 01, 2012 6:55 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby AlbertP on Tue May 08, 2012 4:13 pm

Linux 3.2 fixed most bugs, so you may not need this tutorial anymore in Mint 13 which will be released anywhere soon.
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
AlbertP
Level 16
Level 16
 
Posts: 6522
Joined: Sun Jan 30, 2011 12:38 pm
Location: The Netherlands

Re: How to Guide - Realtek RTL8111/8168B

Postby nounours18200 on Sat Mar 09, 2013 4:13 pm

Why hasn't the r8168 driver been added to the kernel?


This is also my question ! it is not an exotic chip, so it should have been included in the Kernel ! stupid...

Linux 3.2 fixed most bugs, so you may not need this tutorial anymore in Mint 13 which will be released anywhere soon.


I run Linux Mint-14 KDE, and it is impossible for me to connect my NAS directly to my PC (I am not an expert so maybe it is another pb) : so I have been obliged to connect it to my internet box, and it appears automaticcaly in Mint 14...
nounours18200
Level 1
Level 1
 
Posts: 40
Joined: Wed Nov 30, 2011 4:12 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby AlbertP on Sun Mar 10, 2013 8:29 am

Why hasn't the r8168 driver been added to the kernel?

The kernel has the r8169 driver which is supposed to support this device. r8168 was only used because the in-kernel driver did not work properly in the past (Mint 12 and before).
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
AlbertP
Level 16
Level 16
 
Posts: 6522
Joined: Sun Jan 30, 2011 12:38 pm
Location: The Netherlands

Re: How to Guide - Realtek RTL8111/8168B

Postby nounours18200 on Sat Mar 16, 2013 7:02 am

The kernel has the r8169 driver which is supposed to support this device. r8168 was only used because the in-kernel driver did not work properly in the past (Mint 12 and before).


I am not an expert, but I run LM-14 , so a version later than LM-13, and the Realtek chipset is still not recognized...

I have followed the recommandation given above by rarsa, so I have downloaded and extract the Realtek 8111 driver from the Realtek website, but I have the following error with the ./ command:

elodie@elodie /media/elodie/SATA_06/SOURCES_L/Driver_Realtek_8111_Ethernet/r8168-8.035.00 $ sudo ./autorun.sh
[sudo] password for elodie:
sudo: ./autorun.sh: command not found


what is the pb with ./ command ???

Thanks
nounours18200
Level 1
Level 1
 
Posts: 40
Joined: Wed Nov 30, 2011 4:12 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby AlbertP on Sat Mar 16, 2013 9:33 am

Could you post the output these commands:
Code: Select all
inxi -N
dmesg | grep r8169


If it is an RTL8111/8168 yet not driven by r8169, it may be a new revision of the hardware. r8168 does not support those either since it is a much older driver (it does not seem to be still in development; Realtek is now actively maintaining r8169 instead).
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
AlbertP
Level 16
Level 16
 
Posts: 6522
Joined: Sun Jan 30, 2011 12:38 pm
Location: The Netherlands

Re: How to Guide - Realtek RTL8111/8168B

Postby nounours18200 on Sat Mar 16, 2013 3:36 pm

Here is the result:
elodie@elodie ~ $ inxi -N
Network: Card-1: Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller driver: r8169
Card-2: Atheros AR5418 Wireless Network Adapter [AR5008E 802.11(a)bgn] (PCI-Express) driver: ath9k
elodie@elodie ~ $ dmesg | grep r8169
[ 1.677059] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[ 1.677150] r8169 0000:0b:00.0: >irq 83 for MSI/MSI-X
[ 1.677314] r8169 0000:0b:00.0: >eth0: RTL8168c/8111c at 0xf841a000, 00:24:8c:09:b7:a6, XID 1c4000c0 IRQ 83
[ 1.677316] r8169 0000:0b:00.0: >eth0: jumbo features [frames: 6128 bytes, tx checksumming: ko]
[ 22.721610] r8169 0000:0b:00.0: >eth0: link down
[ 22.721628] r8169 0000:0b:00.0: >eth0: link down
[ 25.013245] r8169 0000:0b:00.0: >eth0: link up
[ 30.835648] r8169 0000:0b:00.0: >eth0: link down
[ 35.246868] r8169 0000:0b:00.0: >eth0: link up
elodie@elodie ~ $



If it is an RTL8111/8168 yet not driven by r8169, it may be a new revision of the hardware


I would be surprised because my mother board is more than 3 years old, it is an ASUS P6T: so it is not a very new one...
The command you asked me seems to show that the Ethernet chipset is a r8169.

Thanks for your help
nounours18200
Level 1
Level 1
 
Posts: 40
Joined: Wed Nov 30, 2011 4:12 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby nounours18200 on Sat Mar 16, 2013 6:37 pm

I finally succeeded in running the autorun.sh:

elodie@elodie /media/elodie/SATA_06/SOURCES_L/Driver_Realtek_8111_Ethernet/r8168-8.035.00 $ sudo bash autorun.sh
[sudo] password for elodie:

Check old driver and unload it.
rmmod r8169
Build the module and install
Backup r8169.ko
rename r8169.ko to r8169.bak
DEPMOD 3.5.0-17-generic
load module r8168
Updating initramfs. Please wait.
update-initramfs: Generating /boot/initrd.img-3.5.0-17-generic
Warning: No support for locale: fr_FR.utf8
Completed.


But the next command suggested at the very beginning of this post does not run:
elodie@elodie /media/elodie/SATA_06/SOURCES_L/Driver_Realtek_8111_Ethernet/r8168-8.035.00 $ sudo cp src/r8168.ko /lib/modules/3.0.0-1-amd64/kernel/drivers/net/
cp: impossible de créer le fichier standard «/lib/modules/3.0.0-1-amd64/kernel/drivers/net/»: Aucun fichier ou dossier de ce type

the system says that there is no file or folder of this type...

Any advices ?
nounours18200
Level 1
Level 1
 
Posts: 40
Joined: Wed Nov 30, 2011 4:12 pm

Re: How to Guide - Realtek RTL8111/8168B

Postby AlbertP on Sun Mar 17, 2013 8:10 am

Ok, it's indeed not a new device revision; but it appears r8169 is already working at you. Note that this is your wired ethernet. Your wireless has nothing to do with r8169 vs r8168.

Also you can just run "sudo make install", I think, instead of that command. (With that cp command you need to replace 3.0.0-1 with your kernel version, which you can see with uname -r in terminal. But you do not need to do that if you can use sudo make install)
Registered Linux User #528502
Image
Feel free to correct me if I'm trying to write in Spanish, French or German.
AlbertP
Level 16
Level 16
 
Posts: 6522
Joined: Sun Jan 30, 2011 12:38 pm
Location: The Netherlands

Linux Mint is funded by ads and donations.
 
Next

Return to Tutorials

Who is online

Users browsing this forum: Mindaugas1975 and 15 guests