Ubuntu 22.04下Realtek R8125网卡驱动安装避坑指南(附DKMS自动编译配置)

Ubuntu下安装RealtekRTL8125网卡驱动 emmm 前几天捣鼓软件,卸载时不小心把网卡驱动给整残缺了,然后又重装了一次驱动,记录下过程; 流程 使用ifconfig查看驱动是否正常: (原先的驱动消失了) 查看网卡驱动型号lspci或者lspci | grep -i ethernet 我的网卡为Realtek RTL8125; 去官网找网卡驱动:https://www.realtek.com/zh-tw/component/zoo/category/network-interface-controllers-10-100-1000m 阅读详情

Ubuntu 22.04下Realtek R8125网卡驱动安装避坑指南(附DKMS自动编译配置)

最近给家里的主力台式机升级了主板,顺手换上了支持2.5G的Realtek RTL8125网卡。本以为在Ubuntu 22.04 LTS这种成熟的发行版上,驱动应该不是问题,结果却踩了一连串的坑。从系统安装后网卡直接“消失”,到手动编译驱动后重启失效,再到内核升级后驱动“罢工”,整个过程简直像在玩扫雷。如果你也遇到了类似的问题,别担心,这篇文章就是为你准备的。我会从一个实际踩坑者的角度,分享如何一劳永逸地解决R8125网卡在Ubuntu下的驱动问题,特别是利用DKMS(Dynamic Kernel Module Support)实现驱动的持久化,让你再也不用担心内核更新。

这篇文章主要面向有一定Linux使用经验,追求系统稳定性和长期维护便利性的中高级用户。我们不会止步于“能用就行”的临时方案,而是深入探讨如何构建一个健壮的、能伴随系统内核自动更新的驱动环境。除了标准的DKMS配置,我还会分享几个实战中总结出来的技巧,比如如何检测和解决驱动冲突,以及如何设置黑名单来确保系统加载正确的模块。

1. 问题诊断与驱动冲突分析

在开始动手安装任何驱动之前,花几分钟时间搞清楚现状是至关重要的。很多朋友一上来就照着教程敲命令,结果发现网卡还是没反应,或者出现了更奇怪的问题,根本原因就在于没有做好前期诊断。RTL8125网卡在较新的Linux内核中,常常会被一个名为r8169的通用驱动错误地“劫持”。这个驱动虽然名字看起来和r8125很像,但它实际上是针对Realtek另一系列老款千兆网卡的,用在2.5G的R8125上会导致网卡无法正常工作,或者性能极不稳定。

首先,让我们确认一下你的网卡型号。打开终端,输入以下命令:

lspci -nnk | grep -A3 -i ethernet

你应该会看到类似这样的输出:

04:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 04)
        Subsystem: ASUSTeK Computer Inc. Device [1043:87d0]
        Kernel driver in use: r8169
        Kernel modules: r8169

关键信息解读:

  • [10ec:8125]:这是网卡的PCI厂商ID和设备ID,明确无误地指向Realtek RTL8125。
  • Kernel driver in use: r8169:问题所在! 系统当前正在使用错误的r8169驱动。
  • Kernel modules: r8169:系统内核模块列表里也只有r8169,没有我们需要的r8125。

这个状态解释了为什么你的有线网络无法连接。r8169驱动无法正确初始化R8125硬件的2.5G功能,导致设备处于“未激活”或“不稳定”状态。你可以再用ip link命令查看,很可能根本看不到对应的以太网接口(如enp4s0),或者看到了但状态是DOWN。

注意:有些情况下,r8169驱动可能勉强能让网卡工作,但你会遇到网络时断时续、速度远低于2.5G、甚至系统休眠唤醒后网络丢失等问题。这些都是驱动不匹配的典型症状。

所以,我们安装新驱动的第一步,其实包含了两个任务:1. 安装正确的r8125驱动;2. 确保系统在启动时不再加载r8169驱动。很多教程只做了第一步,忽略了第二步,这就是为什么很多人安装后重启或升级内核又失效了。

2. 驱动安装前的环境准备与方案选择

在下载和编译驱动之前,我们需要确保系统具备编译内核模块所需的环境。同时,面对网络上众多的安装方法,选择一个适合长期维护的方案至关重要。<

Ubuntu安装 Realtek R8125 驱动 之前因为网卡比较新,没有linux版本的驱动,就用的无线网卡。 在官网上下载好对应的驱动,注意我用的是2.5G Ethernet LINUX driver r8125 for kernel up to 5.6的版本。 下载好之后,当前版本是r8125-9.003.05.tar.bz2。里面有README文件,如果按照README安装,当时能够使用,但是重启或者升级内核版本之后,就失效了。所以还需要手动处理下。 准备编译环境 sudo apt-get install --reinstall linux-hea 阅读详情

相关推荐

Ubuntu系统下Realtek RTL8125-CG 2.5G网卡驱动安装与持久化配置指南

本文详细介绍了在Ubuntu系统下安装和持久化配置Realtek RTL8125-CG 2.5G网卡驱动的完整指南。从网卡型号确认、驱动下载与临时安装,到使用DKMS实现持久化配置,再到网络设置与常见故障排查,提供了全面的解决方案。适用于需要稳定使用2.5G以太网连接的用户,特别是使用较新硬件的Ubuntu系统用户。

weixin_42685438的博客 508

保姆级教程:在Ubuntu 22.04上手动编译安装Realtek 8125B 2.5G网卡驱动(含内核版本适配避坑指南)

本文提供在Ubuntu 22.04上手动编译安装Realtek 8125B 2.5G网卡驱动的详细教程,涵盖驱动初始化、内核版本适配及性能优化。通过步骤详解和常见问题解决方案,帮助用户解决网卡识别和性能问题,显著提升网络吞吐量和降低CPU占用。

weixin_30336061的博客 612

Ubuntu 22.04 安装 Realtek R8125 2.5G 网卡驱动:DKMS 配置全记录

在 Linux 系统中,网卡驱动的安装与内核模块的兼容性常常是影响网络稳定性的关键因素。特别是对于采用 Realtek R8125 芯片的 2.5G 以太网卡,Ubuntu 默认内核自带的 r8169 驱动往往存在识别不稳定、协商速率掉速等问题,导致用户无法发挥硬件全部性能。DKMS(Dynamic Kernel Module Support)机制为解决此类问题提供了高效方案,它能够在每次内核升级后自动重新编译并安装第三方驱动模块,避免了手动重复编译的繁琐流程,是保障长期稳定运行的重要技术手段。本文基于 U

weixin_34226182的博客 271

5分钟搞定Realtek R8125驱动!GitHub一键安装脚本实测(支持Ubuntu 20.04-24.04)

本文实测了GitHub上一键安装脚本,帮助用户在Ubuntu 20.04-24.04系统上快速部署Realtek R8125网卡驱动。通过DKMS框架自动编译并持久化安装专用驱动,解决了内核通用驱动r8169不兼容导致网卡无法识别的问题,整个过程仅需约5分钟,极大提升了效率。

weixin_29234509的博客 408

Ubuntu 22.04/24.04新内核不认网卡?Realtek RTL8125-CG驱动编译与DKMS防丢失指南

本文详细介绍了在Ubuntu 22.04/24.04系统中解决Realtek RTL8125-CG网卡驱动不兼容问题的方法。通过驱动编译、DKMS配置和自动恢复方案,确保内核更新后网卡驱动不丢失,适用于以太网连接不稳定的用户。

weixin_30576827的博客 541

Ubuntu下Realtek R8125驱动安装与DKMS持久化配置指南

本文详细介绍了在Ubuntu系统下安装Realtek R8125网卡驱动并配置DKMS实现持久化的完整指南。针对系统自带驱动性能不足的问题,提供了从驱动下载、编译安装到DKMS配置的全流程解决方案,确保内核升级后驱动自动重建,稳定发挥2.5G网卡性能。

weixin_30369041的博客 94

Ubuntu 22.04下RTL8125网卡驱动安装指南:华硕B460M有线网卡修复

在Linux系统中,板载网卡驱动兼容性常成为影响网络稳定性的关键因素。Realtek RTL8125作为2.5Gbps以太网控制器,在Ubuntu 22.04默认内核5.15下,自带的r8169驱动可能因寄存器映射与电源管理差异而无法正确识别接口,导致`ip addr`中看不到有线网络,看似硬件故障实则驱动问题。通过获取芯片厂商官方驱动源码,进行编译、安装并注册DKMS,即可实现模块自动更新与稳定链路协商,让有线网络恢复至满速2.5Gbps。该方案适用于华硕TUF B460M等采用RTL8125B的主板,也

weixin_29587015的博客 267

保姆级教程:在Ubuntu 22.04上手动编译安装Realtek RTL8125 2.5G网卡驱动(含中断配置与性能调优)

本文提供在Ubuntu 22.04上手动编译安装Realtek RTL8125 2.5G网卡驱动的详细教程,包括驱动编译、安装、中断绑定与性能调优的全过程。通过优化硬件中断处理和性能参数,帮助用户充分发挥2.5G网卡的潜力,提升网络性能。

weixin_30530939的博客 458

r8125-9.004.01.tar.bz2

Realtek8125网卡Linux驱动源码,下载自官方,Ubuntu18.04亲测有效,记录此版本文件 9.004.01,编译、安装步骤参考博客:https://shaoguang.blog.csdn.net/article/details/109199093。

realtek-r8125-dkms:易于使用Realtek r8125驱动程序的DKMS软件包,支持2.5 GbE

瑞昱R8125 DKMS 这以DKMS方式提供Realtek r8125驱动程序,以便即使在内核升级后也可以保留最新的驱动程序。 安装 有3种方法来安装此DKMS模块。 选择1作为您的口味。 那些不会互相干扰。 因此,您可以执行所有3种方法,但不需要这样做。 为了获得更新的驱动程序,建议使用Debian软件包进行安装。 Debian软件包 发行包文件 从Github存储库的Release选项卡下载最新的Debian软件包。 然后输入以下命令。 sudo dpkg -i realtek-r8125-dkms_9.005.01-1_amd64.deb 如果发生依赖关系错误,请尝试使用apt命令修复该错误。 sudo apt install --fix-broken 启动板PPA(推荐) 添加启动板PPA。 sudo add-apt-repository ppa:hardker

飞塔防火墙认证绕过漏洞(CVE-2022-40684)深度剖析与实战复现

本文深度剖析了Fortinet飞塔防火墙高危认证绕过漏洞CVE-2022-40684的原理与影响。该漏洞允许攻击者通过构造包含特定Forwarded头和User-Agent的HTTP请求,无需凭证即可绕过认证,以管理员身份访问设备。文章详细演示了从环境搭建到实战复现,最终植入SSH密钥获取控制权的完整过程,并提供了漏洞挖掘技巧与关键防御建议。

d6e7f8g9h的博客 700

【科普知识】什么是驱控一体化伺服电机?

驱控一体化伺服电机以其高度的集成性、兼容性、便捷性以及卓越的性能表现,成为了现代工业自动化领域的一颗璀璨明珠。对于那些追求高效、精准、智能控制的行业用户而言,它无疑是一种理想的选择。

m0_46512607的博客 3147

【推荐100个unity插件】Unity URP(通用渲染管线)的基于物理的天地和预计算大气散射——UnityPhysicallyBasedSkyURP

本文介绍了Unity URP(通用渲染管线)中基于物理的天地和预计算大气散射的实现方法。该插件提供物理天空、大气散射、高度雾效、动态天空反射和环境光等功能,要求Unity 2022.3及以上版本,支持着色器模型3.5+。使用步骤包括:添加渲染器功能、配置Volume组件(天空、雾效等),并建议太阳强度设为3、曝光为0作为初始设置。插件已在GitHub和Gitee开源,附带详细配置截图和效果展示。文末推荐了多个Unity开发相关专栏,涵盖游戏开发全领域知识。作者向宇提供了博客链接,欢迎交流学习问题。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 1215

基于FPGA的数字信号处理(11)--定点数的舍入模式(2)向最临近值取整nearest

基于FPGA的数字信号处理(11)--定点数的舍入模式(2)向最临近值取整nearest

孤独的单刀 5469

【AI黑话日日新】什么是AI Infra?

是支撑AI模型开发、训练、推理、部署与规模化运营的,是连接底层算力与上层AI应用的“数字基建”。没有高效的AI Infra,大模型训练、推理与落地都无法高效实现。

专注:太空算力、AI infra、异构调度、大模型成本工程 1072

华为OD机试新系统真题-谁没交卷(Java /Py/C++/Go/C/Js)

华为OD机试 新系统真题【谁没交卷】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题【谁没交卷】多语言题解。

qq_45776114的博客 409

18 中望CAD二次开发-DWG参照(ZRX C++)

本文介绍了CAD参考外部dwg文件的原理和代码实现及如何卸载参考文件的全过程,是中望CAD二次开发中重要的功能。

cilvsuanna的博客 204

17.6 LangSmith 私有化部署实战指南:企业级AI应用的安全基石

LangSmith 私有化部署, 企业级AI开发平台, 数据隐私合规, 混合云架构, 模型监控与审计。

yonggeit的博客 3765

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

上一篇: 浏览器书签栏藏神器:wn.run万能命令脚本的5种高阶玩法(含跨设备同步技巧)
下一篇: W25Qxx系列存储芯片选型指南:从16M到64M的实战对比
echo99
博客等级 码龄18年 39粉丝 1171原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值