I've been trying (unsuccessfully) for the last few days to make my Realtek ethernet card to work. I have no problems with my wireless connection: only the ethernet connection doesn't work.

I have Ubuntu 16.10 on a Dell Inspiron, with a RTL8101/2/6E PCI Express card. The card used the r8169 driver, which seems to be buggy and unreliable (as in here). Since the solution seems to be to use the r8168 driver, I:

  • installed the package r8168-dkms via apt-get,
  • blacklisted the r8169 module in /etc/modprobe.d/
  • rebooted.

It didn't work, as lsmod still listed the module as in use, and lspci -v still told me that the card was using the r8169 driver and module.

I finally managed to blacklist the module passing the option to grub, by adding modprobe.blacklist=r8169 to the default command line in /etc/default/grub.

The problem is that the r8168 module loads fine (I see it in lsmod), but it's not associated with the card so it doesn't show up in ifconfig (exactly as it happened to lumi in Make Linux load specific driver for given device (Realtek NIC)).

This is the relevant portion of my lshw -C network:

*-network UNCLAIMED
   description: Ethernet controller
   product: RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
   vendor: Realtek Semiconductor Co., Ltd.
   physical id: 0
   bus info: pci@0000:01:00.0
   version: 07
   width: 64 bits
   clock: 33MHz
   capabilities: pm msi pciexpress msix vpd bus_master cap_list
   configuration: latency=0
   resources: ioport:3000(size=256) memory:b0600000-b0600fff memory:b0400000-b0403fff

My device:

> lspci -v -s 01:00
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller (rev 07)
Subsystem: Dell RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
Flags: bus master, fast devsel, latency 0, IRQ 11
I/O ports at 3000 [size=256]
Memory at b0600000 (64-bit, non-prefetchable) [size=4K]
Memory at b0400000 (64-bit, prefetchable) [size=16K]
Capabilities: <access denied>

Please note that in the output above lspci does not show any drivers nor kernel modules in use.

Finally, I tried to make my NIC to use the r8168 driver (as explained in this answer), to no avail:

% sudo echo 10ec 8168 > /sys/bus/pci/drivers/r8168/new_id
/sys/bus/pci/drivers/r8168/new_id: File exists.

% sudo echo "0000:01:00.0" > /sys/bus/pci/drivers/r8168/bind
/sys/bus/pci/drivers/r8168/bind: File exists.

What am I missing? Is there another way to tell a device to use a driver? Any links, clues or indications about what to read next would be helpful and very much appreciated.


You can do this, but obviously be warned that the driver may not be fully compatible with your device!

It also involves recompiling the kernel module, so if that worries you, then I'd advise caution. Especially as most NICs require a bespoke binary firmware blob to be loaded that may break your hardware - so please be warned, and do a little bit of homework to locate a compatible firmware blob.

Happy to continue? Good :)

First, you'll need to locate the driver source for your running kernel - I assume, as you are using dkms then this is already on your system somewhere. Once you have this, find the place where the MODULE_DEVICE_TABLE is registered. From a quick online search, as an example, the file r8169.c has this section in it:

static const struct pci_device_id rtl8169_pci_tbl[] = {                                                                                                       
    { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 },                                                                                           
    { PCI_VENDOR_ID_DLINK,          0x4300,                                                                                                                   
        PCI_VENDOR_ID_DLINK, 0x4b10,         0, 0, RTL_CFG_1 },                                                                                               
    { PCI_DEVICE(PCI_VENDOR_ID_DLINK,   0x4300), 0, 0, RTL_CFG_0 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_DLINK,   0x4302), 0, 0, RTL_CFG_0 },                                                                                           
    { PCI_DEVICE(PCI_VENDOR_ID_AT,      0xc107), 0, 0, RTL_CFG_0 },                                                                                           
    { PCI_DEVICE(0x16ec,            0x0116), 0, 0, RTL_CFG_0 },                                                                                               
    { PCI_VENDOR_ID_LINKSYS,        0x1032,                                                                                                                   
        PCI_ANY_ID, 0x0024, 0, 0, RTL_CFG_0 },                                                                                                                
    { 0x0001,               0x8168,                                                                                                                           
        PCI_ANY_ID, 0x2410, 0, 0, RTL_CFG_2 },                                                                                                                

MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl); 

So this is where the kernel is told that if a device with any of the listed PCI IDs are found, then use this driver. You'll need to add an extra line to this struct, containing the PCI device ID of your NIC, recompile (hopefully just by using dkms) and restart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.