Ubuntu – 2.5G Ethernet LINUX driver r8125 installation guide

driversdual-bootethernetinternetnetworking

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.

Best Answer

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/@PKGNAME@.ko 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.

Related Question