一、更改更新源
更新国内源,可以用SSH软件连接并登陆PVE后台,按照以下步骤修改相应文件:
1./etc/apt/sources.list
将系统 /etc/apt/sources.list 软件包仓库位置的原始默认配置文件备份(前面加#号),修改为 Debian系统源(清华源)内容如下:
先把原来的信息前面加#屏蔽掉,再加入下面内容:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
2./etc/apt/sources.list.d/pve-enterprise.list
如果你没有订阅 Proxmox VE 企业版,可以将企业版软件源配置信息在软件源配置文件中注释掉(在该行开头插入一个 # 字符),以避免系统发出错误提示信息。这种情况下可以配置使用 pve-no-subscriptin 软件源。或者用清华源如下
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
修改完成后,运行下面命令,更新一下:
apt update
二、安装常用命令及依赖
Pve
默认缺失以下几个常用命令,用ssh软件登陆后台后,先安装如下几个后面会用到的常用命令:
apt-get install net-tools
apt-get install lshw
apt-get install ethtool
三、驱动前后信息对比
先用以下命令查看网卡信息:
lshw -c network -businfo
得到两个8156B USB网卡的名称信息如下:
usb@3:2 enx1cbfcefbeaf0 network Ethernet interface
usb@3:3 enx00e04c68887 network Ethernet interface
查看名称为enx00e04c68887的网卡信息,命令如下:
ethtool enx00e04c68887
运行后,得到如下信息:
Settings for enx00e04c68887:
Supportedports: [ ]
Supportedlink modes: Not reported
Supportedpause frame use: No
Supportsauto-negotiation: No
SupportedFEC modes: Not reported
Advertisedlink modes: Not reported
Advertisedpause frame use: No
Advertisedauto-negotiation: No
AdvertisedFEC modes: Not reported
Speed:Unknown!
Duplex:Half
Port:Twisted Pair
PHYAD: 0
Transceiver: internal
Auto-negotiation: off
MDI-X:Unknown
Currentmessage level: 0x00000007 (7)
drv probe link
Linkdetected: no
驱动成功后,再运行该命令,得到的信息如下:
Settings for enx00e04c68887:
Supportedports: [ TP MII ]
Supportedlink modes: 10baseT/Half 10baseT/Full
100baseT/Half100baseT/Full
1000baseT/Half1000baseT/Full
2500baseT/Full
Supportedpause frame use: No
Supportsauto-negotiation: Yes
SupportedFEC modes: Not reported
Advertisedlink modes: 10baseT/Half 10baseT/Full
100baseT/Half100baseT/Full
1000baseT/Full
2500baseT/Full
Advertisedpause frame use: Symmetric Receive-only
Advertisedauto-negotiation: Yes
AdvertisedFEC modes: Not reported
Linkpartner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Linkpartner advertised pause frame use: Symmetric Receive-only
Linkpartner advertised auto-negotiation: Yes
Linkpartner advertised FEC modes: Not reported
Speed:2500Mb/s
Duplex:Full
Port: MII
PHYAD: 32
Transceiver: internal
Auto-negotiation: on
SupportsWake-on: pumbg
Wake-on: g
Currentmessage level: 0x00007fff (32767)
drv probe linktimer ifdown ifup rx_err tx_err tx_queued intr tx_done rx_status pktdata hw wol
Linkdetected: no
四、下载驱动
五、安装 Linux Kernel Header
1.
先用以下命令查看自己版本:
uname -r
运行后信息如下:
6.2.16-6-pve
2.
搜索自己对应版本的Linux Kernel Header,命令如下:
apt search 6.2.16-6
运行后信息如下:
Sorting... Done
Full Text Search... Done
pve-headers-6.2.16-6-pve-pve/stable 6.2.16-7-pve amd64
Proxmox KernelHeaders
pve-kernel-6.2.16-6-pve/stable,now 6.2.16-7-pve amd64[installed]
Proxmox KernelImage
3.
安装自己对应版本的Linux Kernel Header,命令如下:
apt install pve-headers-6.2.16-6-pve
运行后信息如下:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
pve-headers-6.2.16-6-pve-pve
0 upgraded, 1 newly installed, 0 to remove and 0 notupgraded.
Need to get 12.5 MB of archives.
After this operation, 86.8 MB of additional disk spacewill be used.
Fetched 12.5 MB in 4s (3,095 kB/s)
Selecting previously unselected packagepve-headers-6.2.16-6-pve.
(Reading database ... 69904 files and directoriescurrently installed.)
Preparing to unpack.../pve-headers-6.2.16-6-pve_6.2.16-6_amd64.deb ...
Unpacking pve-headers-6.2.16-6-pve (6.2.16-6) ...
Setting up pve-headers-6.2.16-6-pve (6.2.16-6) ...
4.
安装DKMS
apt-get install dkms
5.
建立dkms.conf
(1)将以上下载的r8152-2.17.1.tar.bz2驱动文件放到/usr/src目录下
tar -jxvf r8152-2.17.1.tar.bz2
(2)进入解压后的文件夹
cd /usr/src/r8152-2.17.1
(3)在文件夹里新增 dkms.conf
sudo nano /usr/src/r8152-2.17.1/dkms.conf
在窗口中粘贴以下代码:
PACKAGE_NAME="r8152"
PACKAGE_VERSION="2.17.1"
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"
完成后,键盘按 Ctrl+O,再按回车,然后再按 Ctrl+X 离开编辑模式。
**提示:
如果你下载的版本不同,务必更改 PACKAGE_VERSION="2.17.1"
里面的版本号!
6.
使用DKMS安装驱动
逐行输入以下指令
(1)dkms add -m r8152 -v 2.17.1
运行后,信息如下:
Creating symlink /var/lib/dkms/r8152/2.17.1/source ->
/usr/src/r8152-2.17.1
DKMS:add completed.
(2)dkms build -m r8152 -v 2.17.1
Kernelpreparation unnecessary for this kernel. Skipping...
Buildingmodule:
cleaningbuild area...
make-j8 KERNELRELEASE=6.2.16-6-pve -C /lib/modules/6.2.16-6-pve/buildM=/var/lib/dkms/r8152/2.16.3/build....
cleaningbuild area...
DKMS:build completed.
(3)dkms install -m r8152 -v 2.17.1
运行后,信息如下:
r8152.ko:
Runningmodule version sanity check.
- Original module
- Installation
- Installing to/lib/modules/6.2.16-6-pve/updates/dkms/
depmod....
Backingup initrd.img-6.2.16-6-pve to /boot/initrd.img-6.2.16-6-pve.old-dkms
Makingnew initrd.img-6.2.16-6-1-pve
(Ifnext boot fails, revert to initrd.img-6.2.16-6-pve.old-dkms image)
update-initramfs........
DKMS:install completed.
(4)sudo depmod -a
运行后,没有任何信息
(5)sudo modprobe r8152
运行后,没有任何信息
7.
启用驱动
如果没有报错,驱动基本上就安装好了,就差启用了
(1)导向驱动所在位置
cd/usr/src/r8152-2.17.1
(2)将附带的rule文件复制到udev配置文件
cp 50-usb-realtek-net.rules /usr/lib/udev/rules.d/
(3)载入驱动
sudo modprobe r8152
(4)重启系统
reboot
重启系统之后,驱动如无意外就会自动启用了,也就大功告成了!
此时,在终端输入命令
ethtool enx00e04c68887
即可查看网卡信息了,其中
enx00e04c68887为本机网卡的名字,替换成你自己网卡的名字即可。
查看网卡名字用以下命令:
lshw-c network -businfo
运行后,本机信息如下:
Bus info Device Class Description
=============================================================
pci@0000:00:14.3 network Intel Corporation
pci@0000:01:00.0 enp1s0 network RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
pci@0000:02:00.0 network RTL8125 2.5GbE Controller
usb@3:3 enx00e04c68887 network Ethernet interface
其中的usb@3:3后面的内容enx00e04c68887即为网卡名: