admin管理员组

文章数量:1625496

LIXI.FUN - PVE 安装和编译 RTL8811 无线网卡

前提配置

禁用 enterprise 的源

mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak

增加 非订阅用户 的源

这一步关乎能否下载 pve-headers,在编译无线网卡的标准教程中使用的是 linux-headers 而在 PVE 中是使用 pve-headers

# 先备份
cp /etc/apt/sources.list /etc/apt/sources.list.bak

修改 /etc/apt/sources.list 内容为

deb http://mirrors.aliyun/debian bullseye main contrib

deb http://mirrors.aliyun/debian bullseye-updates main contrib

# security updates
deb http://mirrors.aliyun/debian-security bullseye-security main contrib

# 这个就是 非订阅用户的源了
deb http://download.proxmox/debian/pve bullseye pve-no-subscription

安装编译需要的软件

apt install make gcc pve-headers-`uname -r` dkms usb-modeswitch wpasupplicant net-tools

下载驱动源码

mkdir -p ~/build
cd ~/build
git clone https://github/brektrou/rtl8821CU.git --depth 1

编译安装

cd rtl8831CU
./dkms-install.sh

无线网连接

wifi名称密码配置

适用于 WPA/WPA2-Personal 加密的无线网络,用手机可以查看需要连接的无线网络是否是这种类型加密。

# 回车之后,输入密码,再回车
wpa_passphrase 你的wifi的SSID >> /etc/wpa_supplicant/wpa_suppplicant.conf

可以查看下是否成功生成

cat /etc/wpa_supplicant/wpa_supplicant.conf

增加 interface 配置

编辑 /etc/network/interfaces 内容为

auto lo
iface lo inet loopback

# 增加 无线网卡
auto wlx你的网卡的mac地址
iface wlx你的网卡的mac地址 inet dhcp
        wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

# 有线网卡,但我没有插网线
iface enp1s0 inet manual

# 这是我用手机 usb 分享网络时用的
iface usb0 inet dhcp

# 桥接网卡,没有它,新建虚拟机没得搞
auto vmbr0
iface vmbr0 inet static
        address 10.10.10.1
        netmask 255.255.255.0
        bridge-ports none
        bridge-stp off
        bridge-fd 0

# 注意这里是定格的,不是 vmbr0 块里的内容
post-up         iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o wlx你的网卡的mac地址 -j MASQUERADE
post-down       iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o wlx你的网卡的mac地址 -j MASQUERADE

其中的 wlx你的网卡的mac地址 如果确认驱动安装好了的话,可以使用 ifconfig 进行查看。

重启网络服务

service networking restart

不出问题的话,无线网卡就已经能够使用了,新建虚拟机的时候也不会因为桥接网卡的问题无法启动。

本文标签: 无线网卡PVE