Realtek RTL8111B / RTL8168B NIC
Starting with Centos 5.2, the stock kernel offers support for this chipset via the r8169 driver. If possible please consider using Centos 5.2 instead of any of the methods described below. However apparently the driver only works for revision 01 of the network cards - and even those still can have problems (see below under Problem); the newer cards using revision 02 are identified by the stock kernel driver and can be configured, but they do not work. For the problematic cases one of the methods described below must be used. |
Contents
1. Hardware
Any of the following 10/100/1000M Gigabit Ethernet PCI Express NICs:
- RTL8111/B/C
- RTL8168B/C/CP
A search of an on-line vendor revealed many motherboards using the RTL8111B. A partial list:
- ASRock ALIVENF5-ESATA2
- ASRock ConRoeXFire-eSATA2
ASRock ConRoe1333-DVI/H
- Asus P2-P5945G
- Asus P5B-VM
- Biostar TA690G
- Biostar TF7050-M2
- Biostar TFORCE 7025-M2
- DFI INFINITY 975X
- DFI INFINITY P965-S
- Foxconn P35A
- GIGABYTE GA-G33M-DS2R
- GIGABYTE GA-P35-DS3L
- GIGABYTE GA-P35-DS3P
- GIGABYTE GA-P35-DS3R
- MSI K9A PLATINUM
- MSI K9AG
- MSI P35 Neo2-FR
- MSI P35 Platinum
MSI P35D3 Platinum
- MSI P965 Platinum
1.1. Motherboards known to not work with the stock driver:
Asus M3A78-EMH HDMI was reported to have a "weird behaviour" (quoting from the mailing list: 10Mbps link as shown by ethtool, 100Mbps link as shown by the link-indicator on the switch, ifconfig showed no TX-packets, some RX-packets, /billions/ of dropped packets - increasing by millions every second. The kernel log showed multiple 'Link down' entries.)
1.2. Realtek PCI-Express NIC Described here:
According to the chip manufacturer this driver supports some of the chips which previously required the r1000 driver ( which as of version r1000_v1.06 is only maintained for kernel 2.4 and most important does not always work correctly with the new chipsets. Therefore on the above mentioned hardware if (and only if) the stock kernel driver does not work, please always try to use the newer r8168 driver instead of r1000.
2. Problem
Correct driver is not included with the standard CentOS 4.5, 5.0 and 5.1 distributions. The driver in CentOS 5.2 works for some but not for all of the cards. It has also been reported that under some circumstances, even the cards which seem to function with the driver included in 5.2 (see "rev 01" described below) sometimes still exhibit problems (big latencies, lock-ups).
3. Output of `lspci -v` for a functional card
On an MSI P35 Neo-F (model MS-7360) (note "rev 01" in the first line):
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
Subsystem: Micro-Star International Co., Ltd. Unknown device 360c
Flags: bus master, fast devsel, latency 0, IRQ 17
I/O ports at e800 [size=256]
Memory at febff000 (64-bit, non-prefetchable) [size=4K]
Expansion ROM at febc0000 [disabled] [size=128K]
Capabilities: [40] Power Management version 2
Capabilities: [48] Vital Product Data
Capabilities: [50] Message Signalled Interrupts: Mask- 64bit+ Queue=0/1 Enable-
Capabilities: [60] Express Endpoint IRQ 0
Capabilities: [84] Vendor Specific Information
4. Output of `lspci -v` for a non-functional card
On an Asus P5GC-MX/GBL (note "rev 02" in the first line):
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
Subsystem: ASUSTeK Computer Inc. Unknown device 82c6
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 0, Cache Line Size: 32 bytes
Interrupt: pin A routed to IRQ 177
Region 0: I/O ports at d800 [size=256]
Region 2: Memory at cffff000 (64-bit, non-prefetchable) [size=4K]
Region 4: Memory at efff0000 (64-bit, prefetchable) [size=64K]
Expansion ROM at cffc0000 [disabled] [size=128K]
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] Message Signalled Interrupts: 64bit+ Queue=0/0 Enable-
Address: 0000000000000000 Data: 0000
Capabilities: [70] Express Endpoint IRQ 1
Device: Supported: MaxPayload 256 bytes, PhantFunc 0, ExtTag-
Device: Latency L0s <512ns, L1 <8us
Device: AtnBtn- AtnInd- PwrInd-
Device: Errors: Correctable- Non-Fatal- Fatal- Unsupported-
Device: RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
Device: MaxPayload 128 bytes, MaxReadReq 512 bytes
Link: Supported Speed 2.5Gb/s, Width x1, ASPM L0s L1, Port 0
Link: Latency L0s <512ns, L1 <64us
Link: ASPM Disabled RCB 64 bytes CommClk+ ExtSynch-
Link: Speed 2.5Gb/s, Width x1
Capabilities: [b0] MSI-X: Enable- Mask- TabSize=2
Vector table: BAR=4 offset=00000000
PBA: BAR=4 offset=00000800
Capabilities: [d0] Vital Product Data
5. Solution
There are a few ways to get the driver.
(1) Download and install the r8168 driver from Realtek's website at:
Some direct links (newer versions might be available -- use the Realtek Driver Download link above to check):
Pro:
- Requires only the packages available on the install DVD/Base repository and the source drivers downloaded from Realtek.
Against:
- You must recompile manually the module after each kernel upgrade.
(2) As an alternative method, a dkms-enabled driver package can be downloaded from RPMForge. Please follow the instructions available at http://wiki.centos.org/Repositories/RPMForge to install and activate this repository. After that you can use
- yum install dkms-r8168
to install the driver (and all its dependencies) on your system.
Pro:
- After each kernel upgrade, rebuilding of the module is automatically handled by the dkms-autoinstaller program.
- Does not require downloading the drivers directly from Realtek.
Against:
- Requires the dkms package (available in RPMForge).
6. List of packages needed to install r1000/r8168/r8101
Here is the full list of packages which must be installed in order to compile the driver from source.
Centos 5 |
Centos 4 |
Centos 3 |
Repository |
Observation |
binutils |
binutils |
binutils |
standard |
(1) |
gcc |
gcc |
gcc |
standard |
(1) |
glibc-devel |
glibc-devel |
glibc-devel |
standard |
(1) |
glibc-headers |
glibc-headers |
glibc-headers |
standard |
(1) |
kernel-headers |
glibc-kernheaders |
glibc-kernheaders |
standard |
(1) |
kernel-devel |
kernel-devel |
kernel-source |
standard |
(1) (2) |
make |
make |
make |
standard |
(1) |
dkms |
dkms |
dkms |
RPMForge |
(3) |
(1) standard = Base + Updates repositories.
(2)
- Under all circumstances, the kernel-headers / kernel-devel / kernel-source package must match the version of the kernel for which the driver is compiled (not necessarily the running kernel).
- At boot time, dkms will detect if the existing driver module matches the running kernel and will compile a newer one if needed, provided that kernel-headers / kernel-devel / kernel-source matches the running kernel.
If you are compiling the driver manually, you can compile the driver for another kernel version than the running one by using the procedure described below under Updating the Kernel. This step is mandatory if you are upgrading the kernel via a remote connection and you are not using dkms.
(3) Only needed if installing dkms-r8168. You can check the state of the module any time using the command dkms status. The most interesting states are: added (the module has been successfully registered with the dkms system, but it has not been compiled) and installed (the module has also been successfully compiled).
7. Driver Disks
Driver disks for the following releases have been created and can be used while installing a new system :
- CentOS 4.5 (kernel 2.6.9-55.EL)
- CentOS 5.0 (kernel 2.6.18-8.el5)
- CentOS 5.1 (kernel 2.6.18-53.el5)
These driver disks are for i686 and x86_64 arches only.
8. Notes
The kernel's r8169 driver identifies the same PCI ID as its working hardware. A test with a Fedora 8 Test 1 Live CD showed that that kernel 2.6.23 attempts to load the r8169 driver. However it does not work. The CentOS 5.0 installer does not attempt to load the r8169.
An exchange with Francois Romieu, one of the kernel developers for the r8169 driver, confirmed that the functionality of Realtek's r8168 and r8169 drivers will be incorporated into the kernel's r8169 driver. The kernel changelog shows a merge with Realtek's drivers in July 2007.
This was confirmed November 2007 using the first release of Fedora 8 (kernel 2.6.23.1-42.fc8) on a Gigabyte GA-P35-DS4 and an MSI P35 Neo-F E7360, both with an RTL8111B on-board. The kernel's r8169 driver correctly identified and configured the on-board NIC.
9. Updating the Kernel
When a NIC driver isn't included in the kernel, updating the kernel can be a problem. A few extra steps can make this possible.
Install the new kernel. Either from RPM or compiling a custom kernel. If installing from RPM, the associated kernel-devel package will also need to be installed.
Do not reboot. The NIC driver hasn't been added to the new kernel yet. Rebooting now means an inactive NIC and a visit to the console.
Go to the src directory of the r8168 source. Edit Makefile.
- Change the line
KVER := $(shell uname -r)
to your newly installed kernel version. For example:KVER := 2.6.22.9-MyCustomKernel
- Go back to the top directory of the r8168 source and recompile and install the driver:
make all;
This will overwrite any existing r8168.ko driver. If you want to keep the older driver, rename the existing file before compiling the new driver.
- Confirm that the driver was copied to the right place. For example:
find /lib/modules/2.6.22.9-MyCustomKernel -name r8168.ko
If you have two copies present, use modinfo to identify the older driver and delete or rename it before rebooting.
- Run:
depmod -a 2.6.22.9-MyCustomKernel
Update your bootloader configuration (usually /boot/grub/grub.conf) and reboot.
Note: if you install the above mentioned dkms-r8168 package and leave the dkms-autoinstaller service enabled, steps 3-7 will be performed automatically after you boot with a new kernel, provided you have updated the corresponding kernel-headers (kernel-devel/kernel-source) package. So basically all you would have to do is
- install dkms-r8168
upgrade kernel (and the corrresponding source)
- make sure the dkms-autoinstaller service is active
- reboot
