RTL8153 is a popular USB 3.0 to Gigabit ethernet converter chip, used by many prominent hardware manufatures like NVIDIA, Lenovo, TP-Link.
It's well supported by the Linux kernel, but the default r8152 module is rarely used, the generic cdc_ether
driver is loaded instead. There's another problem, sometimes the r8152 module shipped with kernel can't even detect newer varients of the RTL8153 chip.
So, here's how to install the latest driver for RTL8153 based USB Ethernet adapter.
This tutorial uses command line tools to compile and install the drivers, assuming you've some experience with the basic linux commands.
Contents
Get the driver source code
The first step is to download the latest rtl8153 linux driver source code from Realtek's website. Here's the link. In case the link is not working, just search the driver.
Note: Always use the latest driver, older drivers may not work with the latest linux kernel, even after successfully compiling.
The driver is a tar.bz2 archive, let's unpack the driver, assuming it's downloaded under the ~/Downloads
directory.
cd ~/Downloads/ tar xf 0008-r8152.53-2.09.0.tar.bz2 cd r8152-2.09.0/
Here's 0008-r8152.53-2.09.0.tar.bz2 is the driver archives name, your's could be different. In this tutorial, I'm using the driver version is 2.0.9.0
, works fine with linux kernel 4.14.10.
Install necessary compiler tools
As I'm using Ubuntu currently, so the steps below is only for Ubuntu or other Debian based distributions.
First update the software repository and all the packages to avoid any package conflict.
sudo apt-get update && sudo apt-get upgrade
Now install the required packages.
sudo apt-get install libelf-dev build-essential linux-headers-`uname -r`
You can also install DKMS tools to automatically compile and install the driver module after any kernel update, but now I'm not going that way.
Compile the rtl8153 driver
First go to the driver source code directory, and run the make
command.
cd ~/Downloads/r8152-2.09.0/ # being sure
make -j2
If there's no error message, then the driver compilation is successful. There should be a loadable kernel module r8152.ko, you can check it with modinfo ./r8152.ko
.
Now install the kernel module and run depmod
.
sudo make install sudo depmod -a
Add a kernel module rule
To use the r8152 driver, you've to add a proper kernel module rule, which overrides the default wildcard entry in the cdc_ether
driver.
So, first you've to find out the ethernet adapters Vendor ID and Product ID, use the lsusb
command for that.
Unfortunately lsusb failed to show the device name I'm using, but I know it's 2357:0601, the vID and pID respectively.
After knowing the proper vendor ID and Product ID, create a file rtl_usb.conf under the/etc/modprobe.d/
directory.
sudo nano /etc/modprobe.d/rtl_usb.conf # create the file
Then add a proper configuration text, something like below.
alias usb:v2357p0601d*dc*dsc*dp*ic*isc*ip*in* r8152
Note: You must change the vID and pID according to your USB NIC, for me it's 2357 and 0601 for this particular adapter, highlighted in blue.
Finally run sudo depmod -a
command again to update the kernel module dependency file.
That should be enough to use the r8152 driver whenever any RTL8153 based USB to Ethernet device is plugged in.
Conclusion
Most of the RTL8153 chip based adapter are quite good, regardless of their manufacturer. And the best part is they works quite well on Linux, including single board computers like Raspberry Pi.
I've tested two of them, both reaches near the gigabit speed when connected to a USB 3.0 port. I used Iperf and SAMBA share to measure the speed, with Iperf the speed is around 920 to 940 Mbps. While file transfer speed over SAMBA easily gets over 80MB/s to 100MB/s, of course highly dependent on cable length.
So, that's all you need to do, should be pretty quick if you know what you're doing.
Tomas says
Worked for me on Ubuntu 24.04.1 with 6.8.0 kernel as well.
Realtek download link moved again to https://www.realtek.com/Download/List?cate_id=585
Jay Herman says
Worked great on Ubuntu 20.04.1 with 5.4 kernel!
Realtek download link moved to https://www.realtek.com/zh-tw/directly-download?downloadid=ef16f91b5d0550168dc7f4aff261ac1f
The download includes a .rules file that should be copied into /etc/udev/rules.d/ to configure the Realtek device when added.
Wayno Guerrini says
I compiled and installed the driver without incident. However I still get error messages in the log:
Bus 001 Device 002: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
[67467.202930] r8152 1-8:1.0 enp2s0f0u8: Tx timeout
[67467.202939] xhci_hcd 0000:02:00.0: xHCI host controller not responding, assume dead
[67467.202947] xhci_hcd 0000:02:00.0: HC died; cleaning up
[67467.202963] r8152 1-8:1.0 enp2s0f0u8: Tx status -108
[67467.202964] r8152 1-8:1.0 enp2s0f0u8: Tx status -108
[67467.202965] r8152 1-8:1.0 enp2s0f0u8: Tx status -108
[67467.202966] r8152 1-8:1.0 enp2s0f0u8: Tx status -108
[67467.203016] usb 1-8: USB disconnect, device number 2
[67467.204896] r8152 1-8:1.0 enp2s0f0u8: Get ether addr fail
It's dead Jim. Unfortunately, this solved nothing.
Wayno says
Well. I was able to compile and install this into Ubuntu 20.04 without incidence. We'll have to wait to see if this works. Thank you for the Write up.
Wayno
John McGehee says
After this procedure I had to restart Network Manager:
sudo systemctl restart network-manager.service
Or if you are using netplan (Ubuntu server edition), something like:
sudo netplan apply # Untested
Gregor says
This does NOT WORK and an article is misleading since it looks that they delete comments of people that have problems with implementing this.
Arnab Satapathi says
Which comment?
Clear the browser cache, it's set to cache aggressively for a month.
Gregor says
does not work! Ubuntu 18.04
After installing I get an error message:
[11949.619504] r8152 4-1.1:1.0 enx00e04c680090: renamed from eth0
[11949.649572] IPv6: ADDRCONF(NETDEV_UP): enx00e04c680090: link is not ready
dmsg returns those lines:
[ 6.156342] usbcore: registered new interface driver r8152
[ 6.924620] r8152 3-3:1.0 (unnamed net_device) (uninitialized): Get ether addr fail
[ 6.924848] r8152 3-3:1.0 eth0: v2.11.0 (2018/12/21)
[ 6.924850] r8152 3-3:1.0 eth0: This product is covered by one or more of the following patents:
[ 1306.865612] r8152 3-3:1.0 (unnamed net_device) (uninitialized): Get ether addr fail
Luiz Otavio de Lima Rodrigues says
I got the new driver r8152-2.10.0 but was getting an error trying to compile on Ubuntu 16.04.5 LTS:
/home/****/r8152-2.10.0/r8152.c:5634:11: error: 'BMCR_SPEED10' undeclared (first use in this function)
bmcr = BMCR_SPEED10;
Edited the file and added:
root@******:/home/****# diff r8152-2.10.0/r8152.c r8152-2.10.0-edited/r8152.c
31a32,36
> // missing in mii.h
> #if !defined BMCR_SPEED10
> #define BMCR_SPEED10 0x0000 /* Select 10Mbps */
> #endif
>
Then everything worked as expected.
Andrew Z says
Luiz,
Can you please help me getting this to work in XenServer? Your edit helped the make command work.
Mike says
Thanks for the article. To sign the kernel module, the steps below worked for me:
mkdir ~/opensslkeys
cd ~/opensslkeys
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=YOURUSERNAME/"
sudo apt install mokutil
sudo mokutil --import MOK.der
Reboot and follow prompts int enroll certificate (before GRUB loads). Follow steps in this article and then:
kmodsign sha512 ~/opensslkeys/MOK.priv ~/opensslkeys/MOK.der r8152.ko
sudo make install
sudo depmod -a
Rick says
It's an unbranded adapter off ebay. Worked well when it worked. There was normal dmesg output when it worked. Strangely, it would sometimes be recognized in one USB port but not in another.
I read somewhere that kernels from 4.13 on have the correct driver built in.
Just to confirm, following your instructions above, there's no need for a reboot is there? The kernel module should load dynamically?
Arnab Satapathi says
Thanks for the feedback again.
Yes, there's no need of reboot. And in this case, once the r85152 module is loaded, it's not unloaded automatically when the adapter is unplugged. It could be unloaded with a udev rule, though there's no need.
Rick says
Hi,
Yes, should have mentioned- that was using the default driver in Debian stretch with kernel 4.9.0.6-amd64 (~4.9.83). I followed your instructions and the driver installed correctly, and running lsmod showed the r8152 driver present. Unfortunately the adapter doesn't work. I wasn't sure if possibly a reboot was required, but after a reboot it doesn't work either, and the driver was no longer listed in the lsmod output. The device isn't showing up at all in lsusb output.
Hmm, not sure what to try next; already at the outer limits of my knowledge of kernel device drivers here.
Arnab Satapathi says
Is it present in the dmesg output? Or working on another PC or OS?
May be a hardware issue. What's the manufacturer and model no? Though not relevant, asking you as I'm planning to buy few more, different types.
Rick says
Thanks for your write-up.
The problem here is that the adapter works well when initially plugged in, but if unplugged and plugged in again it is not recognized. Is that a problem you also experienced?
$ lsusb #shows idVendor=0bda, idProduct=8153
That is another of the devices listed on the linux kernel driver database, along with yours:
https://cateee.net/lkddb/web-lkddb/USB_RTL8152.html
Arnab Satapathi says
Fortunately mine works fine after repeatedly being plugged and unplugged. Tested it 6 times just before writing this reply, both on USB 3 and USB 2 ports.
Seems like the manufacturer didn't bothered to change the default vID and pID.
BTW, which driver you're using?
Karnik says
Thank you for your post. I get the following error when I run sudo make install
-----------------------
rmmod r8152
make -C /lib/modules/4.13.0-32-generic/build SUBDIRS=/home/karnik/Tools/r8152-2.09.0 INSTALL_MOD_DIR=kernel/drivers/net/usb modules_install
make[1]: Entering directory '/usr/src/linux-headers-4.13.0-32-generic'
INSTALL /home/karnik/Tools/r8152-2.09.0/r8152.ko
At main.c:160:
- SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178
sign-file: certs/signing_key.pem: No such file or directory
DEPMOD 4.13.0-32-generic
make[1]: Leaving directory '/usr/src/linux-headers-4.13.0-32-generic'
modprobe r8152
--------------------------
Any idea?
Arnab Satapathi says
Most probably the kernel is preventing to load and install any unsigned kernel module.
As I'm using a custom kernel, not signed, so didn't faced such issue.
Ubunu's new kernels are able to boot in UEFI secure boot mode, hence signed. You can disable it with mockutil,
sudo mokutil --disable-validation
, then reboot.Even better, sign the module before installation, https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-signing-kernel-modules-for-secure-boot
Mariana says
Hi,
I get the same error when running
sudo make install
I have tried running:
sudo mokutil --disable-validation
and then rebooting and running again
sudo make install
but I still get the same problem...
Any ideas?
Peter says
I followed this article exactly to its detail and had the same errors. I simply ignored those SSL errors and continued with the sudo depmod -a. On a reboot this driver is working well. My old desktop has no UEFI capability so I guess I need not concern myself with secure Linux headers settings etc.
I had a problem with an earlier Tecknet USB 3.0 4+1 Port Hub problem whereby USB stick were not being 'seen'. Yet a USB keyboard, a Samsung 1TB USB external drive, an old Trust USB card-reader and a Logitech USB webcam all worked fine. This hub works without problem under Windows 10 and even XP. Thus I sought a Linux driver.
Tecknet provides a Linux driver for download. The file's naming convention made it unrecognisable so I didn't know what to do with it. Anyway, this excellent article links to a later driver which I have now used.