Enabling full potential of USB (Realtek) Nic 2.5Gbe on debian

Let's allow debian to maximize Realtek's R8152's performance.

Enabling full potential of USB (Realtek) Nic 2.5Gbe on debian
Photo by Sander Weeteling / Unsplash

I am a big fan of Linux (especially Debian-based distros), and I am also passionate about maximizing network speeds.Even after upgrading my network to 2.5Gbit (and my backbone to 10Gbit), my Linux Hypervisor (running Proxmox - more on that later) failed to run full duplex from one of its USB ports.

At first, you check if the driver is correcty loaded anyhow:

dmesg | grep enx

When the driver isn't correctly loaded, the output will be something like:

cdc_ncm 5-2:2.0 enxXXXXXXXX: renamed from eth0

cdc_ncm indicates that the realtek drivers (in my case r8152) are not loaded, affecting network properties (running in half-duplex mode, for example) and resulting in subpar performance.

The solution

The solution is actually very straightforward; you just need to tell your system to load these drivers by default by creating a .rules file in udev. Be sure to place the contents of https://github.com/bb-qq/r8152/blob/master/50-usb-realtek-net.rules  in /etc/udev/rules.d/50-usb-realtek-net.rules.

Easy way of getting the file content on your disk is by executing the two lines below as follows:

wget https://raw.githubusercontent.com/bb-qq/r8152/master/50-usb-realtek-net.rules
mv 50-usb-realtek-net.rules /etc/udev/rules.d/50-usb-realtek-net.rules

Give the system a reboot and then you start over again by dmesg | grep enx, and check the output. If it shows something like:

r8152 6-2:1.0 enxXXXXXXXX: renamed from eth0

then it means you are good to go - the drivers are correctly loaded, allowing full usage of the 2.5GBit nic.