前提配置
禁用 enterprise 的源
1
| 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
1 2
| cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
修改 /etc/apt/sources.list 内容为
1 2 3 4 5 6 7 8 9
| deb http://mirrors.aliyun.com/debian bullseye main contrib
deb http://mirrors.aliyun.com/debian bullseye-updates main contrib
deb http://mirrors.aliyun.com/debian-security bullseye-security main contrib
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
|
安装编译需要的软件
1
| apt install make gcc pve-headers-`uname -r` dkms usb-modeswitch wpasupplicant net-tools
|
下载驱动源码
1 2 3
| mkdir -p ~/build cd ~/build git clone https://github.com/brektrou/rtl8821CU.git --depth 1
|
编译安装
1 2
| cd rtl8831CU ./dkms-install.sh
|
无线网连接
wifi名称密码配置
适用于 WPA/WPA2-Personal 加密的无线网络,用手机可以查看需要连接的无线网络是否是这种类型加密。
1 2
| wpa_passphrase 你的wifi的SSID >> /etc/wpa_supplicant/wpa_suppplicant.conf
|
可以查看下是否成功生成
1
| cat /etc/wpa_supplicant/wpa_supplicant.conf
|
增加 interface 配置
编辑 /etc/network/interfaces 内容为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| 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
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
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 进行查看。
重启网络服务
1
| service networking restart
|
不出问题的话,无线网卡就已经能够使用了,新建虚拟机的时候也不会因为桥接网卡的问题无法启动。