2.5G Ethernet LINUX driver r8125 installation guide

I have purchased a new desktop and I am trying to run Ubuntu in dual boot with windows 10. I have disabled secure boot and windows fast boot. When I log in to Ubuntu it does not connect to internet via ethernet cable.

sudo lshw -C network Shows realtek driver is unclaimed.

The solution I have searched is to install r8125 driver but I just cannot get the steps accurately. Request to let me know what are the installation steps of installing r8125 driver and run the internet from ethernet cable.


Solution 1:

To avoid having to reinstall the driver after every kernel update, create a file called dkms.conf in the NIC's source directory with these lines:

PACKAGE_NAME="r8125"
PACKAGE_VERSION="9.003.05"
BUILT_MODULE_NAME[0]="$PACKAGE_NAME"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="YES"
REMAKE_INITRD="YES"
CLEAN="rm src/@[email protected] src/*.o || true"

Modify 9.003.05 to the version number that you have the source code for. To install the driver for the first time:

sudo cp -R /path.to/source/ /usr/src/r8125-9.003.05
sudo dkms add -m r8125 -v 9.003.05
sudo dkms build -m r8125 -v 9.003.05
sudo dkms install -m r8125 -v 9.003.05

To update the version, remove the current one first, remembering to change to the correct version number:

sudo dkms remove r8125/9.002.02 --all
sudo rm -rf /usr/src/r81259.002.02/
sudo dkms status

After the first install, dkms will automatically build and install the driver for you. You will, of course, need dkms installed first.

Solution 2:

Somehow stuff breaks if I use the config from @nospam. The following config works for the newest versions, I added the kernelver to the build

$ cat dkms.conf
PACKAGE_NAME="realtek-r8125"
PACKAGE_VERSION="9.005.01"
BUILT_MODULE_NAME[0]="r8125"
DEST_MODULE_LOCATION[0]="/updates"
BUILT_MODULE_LOCATION[0]="src"
MAKE="'make' KVER=${kernelver} BSRC=/lib/modules/${kernelver} all"
AUTOINSTALL="yes"
REMAKE_INITRD="yes"
CLEAN="rm src/@[email protected] src/*.o || true"

Solution 3:

  • Obtain file from Realtek here (They make it very complicated :-( )
  • Unzip
  • In terminal, change into directory and run sudo ./autorun.sh