Ubuntu22.04下安装RealtekRTL8125网卡驱动(亲测有效)

最近工作电脑老是出现网络问题,可能是之前安装了防火墙,把网卡驱动搞崩了,我一直不解为嘛时好时不好,后面查资料发现有人跟我一样,于是就开始了换显卡驱动之路:

参考链接1:https://blog.youkuaiyun.com/weixin_43932656/article/details/118007962

参考链接2:[ubuntu22.04]ubuntu22.04编译r8152驱动出现 the compiler differs from the one used to build the kernel_warning: the compiler differs from the one used to-优快云博客

一、卸载原有驱动r8169

1、查看网卡型号

lspci | grep net

2、查看网卡驱动

lspci -k

我的网卡是:RTL8125,官网下载路径:RTL8125显卡驱动下载


网卡驱动是r8169

3、卸载网卡驱动
找出位置,然后删除

modinfo r8169 | grep filename
rm path/r8169.ko


4卸载驱动

rmmod r8169


查看是否卸载成功

lsmod | grep r8169


二、安装驱动
1、在官网找到相应的驱动,这里我找的是driver r8125的9.014.01版本。下载好后,解压:

sudo tar xvf r8125-9.014.01.tar.bz2  -C /usr/src


2、在/usr/src/r8125-9.014.01中创建dkms.conf,内容为:

PACKAGE_NAME=Realtek_r8125
PACKAGE_VERSION=9.014.01

DEST_MODULE_LOCATION=/updates/dkms
BUILT_MODULE_NAME=r8125
BUILT_MODULE_LOCATION=src/

MAKE="'make' -C src/ all"
CLEAN="'make' -C src/ clean"
AUTOINSTALL="yes"

3、安装dkms

sudo apt-get install dkms


4、编译DKMS并且挂载驱动

sudo dkms add -m r8125 -v 9.014.01
sudo dkms build -m r8125 -v 9.014.01
sudo dkms install -m r8125 -v 9.014.01
sudo depmod -a
sudo modprobe r8125

5、执行sudo dkms build -m r8125 -v 9.014.01时出现问题:

warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           
  CC [M]  /var/lib/dkms/r8125/9.014.01/build/src/r8125_n.o
/bin/sh: 1: gcc-12: not found
make[3]: *** [scripts/Makefile.build:251:/var/lib/dkms/r8125/9.014.01/build/src/r8125_n.o] 错误 127
make[2]: *** [/usr/src/linux-headers-6.5.0-28-generic/Makefile:2039:/var/lib/dkms/r8125/9.014.01/build/src] 错误 2
make[1]: *** [Makefile:234:__sub-make] 错误 2

解决办法:

sudo apt install gcc-12

PS:如果r8125的驱动仍然不可用,由于ubuntu内核版本不一致,可尝试使用下面的文献进行修复,参考下面的连接,可成功解决问题:

  Ubuntu安装网卡驱动-优快云博客

### ESXi RTL8125 Driver Compatibility and Installation Guide For VMware ESXi versions prior to 7.0U2, native support for the Realtek RTL8125 network adapter is not included by default[^1]. This means that additional steps are required to ensure proper functionality of this hardware component within an ESXi environment. To address compatibility issues with the RTL8125 under ESXi: #### Confirming Hardware Support Ensure the server's motherboard or add-in card containing the RTL8125 chipset meets any prerequisites set forth by both VMware and Realtek documentation regarding supported platforms and operating environments. #### Obtaining Necessary Drivers Download appropriate drivers from official sources such as Realtek’s website or through validated third-party repositories known for providing compatible packages specifically tailored towards ESXi installations. #### Preparing a Custom ISO Image (if necessary) If direct injection into existing media isn't feasible due to version constraints, consider preparing a customized bootable image incorporating these drivers using tools like VIB Author or other similar utilities designed for modifying ESXi installers without violating licensing agreements. #### Installing via Offline Bundle Alternatively, obtain precompiled offline bundle files (.vib format), which can be directly uploaded onto your running ESXi host system either manually during initial setup procedures or post-installation when connected to vSphere Client interface. #### Verifying Post-Installation Functionality After completing driver deployment according to chosen method above, verify correct operation of newly installed components including checking device status messages at startup/shutdown sequences along with confirming expected performance metrics once fully operational within virtualized workloads hosted on affected systems. ```bash esxcli software vib list | grep realtek ``` --related questions-- 1. What specific challenges might one encounter while integrating non-native NICs into ESXi? 2. How does creating a custom ESXi installer impact warranty terms provided by original equipment manufacturers? 3. Are there alternative methods besides utilizing rc.local scripts for configuring persistent routes in ESXi setups lacking built-in support for certain networking devices? 4. Can you provide guidance on troubleshooting common problems associated with unsupported Ethernet controllers after attempting manual driver addition processes outlined here? 5. Is it advisable to seek out community-driven solutions versus waiting for official updates concerning peripheral compatibility concerns impacting enterprise-grade hypervisors like ESXi?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回顶部