Ubuntu Server 20.04下TP-Link TX201 2.5G PCIe网卡未识别及配置迁移求助
问题描述
我在Ubuntu Server 20.04.6 LTS上尝试将网络连接从板载Intel I219-LM网卡切换到新的TP-Link TX201 2.5G PCIe网卡,但新网卡目前显示为UNCLAIMED状态。我的目标是将现有网卡的网络配置迁移到新网卡,然后切换物理网线到新网卡上。
以下是我的系统信息:
- 系统版本:
lsb_release -a # 输出: Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal
- 内核版本:
uname -r # 输出:5.4.0-146-generic
- 网卡硬件信息:
sudo lshw -C network # 输出: *-network UNCLAIMED description: Ethernet controller product: RTL8125 2.5GbE Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:03:00.0 version: 04 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd cap_list configuration: latency=0 resources: ioport:d000(size=256) memory:f7000000-f700ffff memory:f7010000-f7013fff *-network description: Ethernet interface product: Ethernet Connection (5) I219-LM vendor: Intel Corporation physical id: 1f.6 bus info: pci@0000:00:1f.6 logical name: enp0s31f6 version: 00 serial: d8:9e:f3:17:4c:ec size: 1Gbit/s capacity: 1Gbit/s width: 32 bits clock: 33MHz capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.1-4 ip=192.168.2.100 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s resources: irq:128 memory:f7300000-f731ffff
- 现有网卡Netplan配置:
cat /etc/netplan/*.yaml # 输出: network: ethernets: enp0s31f6: addresses: - 192.168.2.100/24 gateway4: 192.168.2.1 nameservers: addresses: - 8.8.8.8 - 8.8.4.4 - 192.168.2.1 version: 2
- PCI设备及驱动信息:
lspci -k # 输出: 00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05) Subsystem: Dell Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers Kernel driver in use: skl_uncore 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 05) Kernel driver in use: pcieport 00:02.0 Display controller: Intel Corporation HD Graphics 630 (rev 04) Subsystem: Dell HD Graphics 630 Kernel driver in use: i915 Kernel modules: i915 00:14.0 USB controller: Intel Corporation 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller Subsystem: Dell 200 Series/Z370 Chipset Family USB 3.0 xHCI Controller Kernel driver in use: xhci_hcd 00:14.2 Signal processing controller: Intel Corporation 200 Series PCH Thermal Subsystem Subsystem: Dell 200 Series PCH Thermal Subsystem 00:15.0 Signal processing controller: Intel Corporation 200 Series PCH Serial IO I2C Controller #0 Subsystem: Dell 200 Series PCH Serial IO I2C Controller Kernel driver in use: intel-lpss Kernel modules: intel_lpss_pci 00:16.0 Communication controller: Intel Corporation 200 Series PCH CSME HECI #1 Subsystem: Dell 200 Series PCH CSME HECI Kernel driver in use: mei_me Kernel modules: mei_me 00:17.0 RAID bus controller: Intel Corporation SATA Controller [RAID mode] Subsystem: Dell SATA Controller [RAID mode] Kernel driver in use: ahci Kernel modules: ahci 00:1b.0 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #17 (rev f0) Kernel driver in use: pcieport 00:1d.0 PCI bridge: Intel Corporation 200 Series PCH PCI Express Root Port #9 (rev f0) Kernel driver in use: pcieport 00:1f.0 ISA bridge: Intel Corporation 200 Series PCH LPC Controller (Q270) Subsystem: Dell 200 Series PCH LPC Controller (Q270) 00:1f.2 Memory controller: Intel Corporation 200 Series/Z370 Chipset Family Power Management Controller Subsystem: Dell 200 Series/Z370 Chipset Family Power Management Controller 00:1f.3 Audio device: Intel Corporation 200 Series PCH HD Audio Subsystem: Dell 200 Series PCH HD Audio Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel 00:1f.4 SMBus: Intel Corporation 200 Series/Z370 Chipset Family SMBus Controller Subsystem: Dell 200 Series/Z370 Chipset Family SMBus Controller Kernel driver in use: i801_smbus Kernel modules: i2c_i801 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (5) I219-LM Subsystem: Dell Ethernet Connection (5) I219-LM Kernel driver in use: e1000e Kernel modules: e1000e 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde PRO / Venus LE / Tropo PRO-L [Radeon HD 8830M / R7 250 / R7 M465X] (rev 87) Subsystem: Dell Cape Verde PRO / Venus LE / Tropo PRO-L [Radeon HD 8830M / R7 250 / R7 M465X] Kernel driver in use: radeon Kernel modules: radeon, amdgpu 01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Oland/Hainan/Cape Verde/Pitcairn HDMI Audio [Radeon HD 7000 Series] Subsystem: Dell Oland/Hainan/Cape Verde/Pitcairn HDMI Audio [Radeon HD 7000 Series] Kernel driver in use: snd_hda_intel Kernel modules: snd_hda_intel 02:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 Subsystem: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 Kernel driver in use: nvme Kernel modules: nvme 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller (rev 04) Subsystem: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller Kernel modules: r8169
解决方案
Hey Scott, let's get that TP-Link TX201 up and running! The core issue here is that your Ubuntu 20.04's 5.4 kernel doesn't include full native support for the RTL8125 chipset — the default r8169 driver is for older Realtek cards and doesn't play nice with the 2.5G model. Here's a step-by-step fix:
1. Install the correct RTL8125 driver via DKMS
First, we'll set up a DKMS (Dynamic Kernel Module Support) driver that will persist across kernel updates:
- Install the required build tools and dependencies:
sudo apt update && sudo apt install git build-essential dkms linux-headers-$(uname -r) - Grab the official Realtek RTL8125 DKMS driver (you can download this from Realtek's official website for Linux systems):
- Unzip the downloaded driver package, then navigate into the extracted directory using
cd
- Unzip the downloaded driver package, then navigate into the extracted directory using
- Install the driver with DKMS:
This script will handle adding the module to DKMS, compiling it, and loading it into the kernel.sudo ./autorun.sh
2. Verify the driver is loaded
Reboot your server to ensure the driver loads properly, then run:
sudo lshw -C network
Your TP-Link card should now show a logical name (like enp3s0) instead of UNCLAIMED, and the driver should be listed as r8125.
3. Migrate your Netplan configuration
Now let's copy your existing network settings to the new card:
- First, confirm the new card's interface name with:
Look for the entry corresponding to the Realtek RTL8125 (it'll match the physical ID fromip link showlshw—03:00.0). - Edit your Netplan config file (replace the filename with your actual one if needed):
sudo nano /etc/netplan/00-installer-config.yaml - Either comment out your old card's config and add the new one, or duplicate the settings for the new interface. Here's an example where we replace the old config:
network: ethernets: # enp0s31f6: # addresses: # - 192.168.2.100/24 # gateway4: 192.168.2.1 # nameservers: # addresses: # - 8.8.8.8 # - 8.8.4.4 # - 192.168.2.1 enp3s0: # Replace this with your new card's interface name addresses: - 192.168.2.100/24 gateway4: 192.168.2.1 nameservers: addresses: - 8.8.8.8 - 8.8.4.4 - 192.168.2.1 version: 2 - Apply the new configuration:
sudo netplan apply
4. Switch the physical connection
Finally, unplug the Ethernet cable from your old Intel card and plug it into the TP-Link adapter. Test connectivity with:
ping 8.8.8.8 ping 192.168.2.1
Troubleshooting Tips
- If the driver doesn't load after reboot, manually load it with
sudo modprobe r8125 - If you get build errors, double-check that you installed the correct kernel headers (
linux-headers-$(uname -r)matches your running kernel) - Ensure your BIOS/UEFI has the PCIe slot enabled where the TP-Link card is installed
备注:内容来源于stack exchange,提问作者Scott Fenech

