[归档]安装r8125驱动

为relteck 8125 2.5G网卡安装驱动

警告

发现更新驱动之后,普通模式下可以正常工作,但一旦开启直通,这个驱动就会无法工作。

而因为 r8139 被加入黑名单,导致没有驱动可用,然后网卡就无法使用。

因为这个网卡是用于管理网络的,所以 pve 也跟着失联了……

因此,放弃更新这个驱动。后续移除了所有的 2.5g 网卡,统一使用 cx3 pro 40g (hp544+)或者 cx4 25g 网卡。

准备工作

apt install -y dkms
apt install -y pve-headers-$(uname -r)
apt install --fix-broken

下载驱动

https://github.com/awesometic/realtek-r8125-dkms/releases

mkdir ~/temp
cd ~/temp
wget https://github.com/awesometic/realtek-r8125-dkms/releases/download/9.010.01-2/realtek-r8125-dkms_9.010.01-2_amd64.deb

通过安装包安装驱动

dpkg -i realtek-r8125-dkms_9.010.01-2_amd64.deb

输出为:

dpkg -i realtek-r8125-dkms_9.010.01-2_amd64.deb
Selecting previously unselected package realtek-r8125-dkms.
(Reading database ... 86910 files and directories currently installed.)
Preparing to unpack realtek-r8125-dkms_9.010.01-2_amd64.deb ...
Unpacking realtek-r8125-dkms (9.010.01-2) ...
Setting up realtek-r8125-dkms (9.010.01-2) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Loading new realtek-r8125-9.010.01 DKMS files...
Deprecated feature: REMAKE_INITRD (/usr/src/realtek-r8125-9.010.01/dkms.conf)
Building for 6.2.16-4-pve
Building for architecture amd64
Building initial module for 6.2.16-4-pve
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/realtek-r8125/9.010.01/source/dkms.conf)
Done.
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/realtek-r8125/9.010.01/source/dkms.conf)
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/realtek-r8125/9.010.01/source/dkms.conf)

r8125.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/6.2.16-4-pve/updates/dkms/
depmod...

这个版本是 9.010。

通过源码安装驱动

发现代码里面有更新到 9.011,只是没有打包发布为 deb 格式。但是可以从源码开始安装。

git clone https://github.com/awesometic/realtek-r8125-dkms.git 
cd realtek-r8125-dkms
./dkms-install.sh

输出为:

./dkms-install.sh 
About to run dkms install steps...
Deprecated feature: REMAKE_INITRD (/usr/src/r8125-9.011.01/dkms.conf)
Creating symlink /var/lib/dkms/r8125/9.011.01/source -> /usr/src/r8125-9.011.01
Sign command: /lib/modules/6.2.16-4-pve/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/r8125/9.011.01/source/dkms.conf)

Building module:
Cleaning build area...
'make' -j16 KVER=6.2.16-4-pve BSRC=/lib/modules/6.2.16-4-pve modules......
Signing module /var/lib/dkms/r8125/9.011.01/build/src/r8125.ko
Cleaning build area...
Deprecated feature: REMAKE_INITRD (/var/lib/dkms/r8125/9.011.01/source/dkms.conf)

r8125.ko:
Running module version sanity check.
 - Original module
 - Installation
   - Installing to /lib/modules/6.2.16-4-pve/updates/dkms/
depmod...
Finished running dkms install steps.

更换驱动

屏蔽 r8169 驱动:

sudo sh -c 'echo blacklist r8169 >> /etc/modprobe.d/blacklist_r8169.conf'

重启机器,检验:

lsmod | grep r81  
r8125                 262144  0
r8169                 114688  0

对比没有更新驱动的输出:

lsmod | grep r81  
r8169                 114688  0

检验

更新之前,客户端和服务器端都使用默认的 r8169 驱动,iperf3 测试速度为 2.35-2.36G。

更新客户端驱动为 r8125 驱动, iperf3 测试速度为 2.35-2.36 G,几乎没有变化。

继续更新服务器端驱动为 r8125 驱动, iperf3 测试速度为 2.35/2.36G,几乎没有变化。

总结:更新驱动未能带来速度方面的直接收益。

参考资料