准备直接给台机虚拟化,安装pve系统,但是安装之后,插上无线网卡,没有网络,怎么办?
由于布线不方便,还是准备继续看怎么给无线网卡装上驱动。买之前,特意看了无线网卡是免驱的,买的急,没仔细看,结果这个免驱只是windows下面自动安装,在pve上面并不行,并且直插mac都识别不出来。幸运的是,手头有个hub,插上去,居然被识别出来。因为台机没有网,所以先搭个虚拟机试验。
pve安装
pve是基于debian的,安装比较简单,网上找个教程就可以。
Ndiswrapper
在知道网卡是win下面的时,网络搜索发现存在Ndiswrapper方案,可以在linux下面调用win xp的驱动。由于这个是某星ud6免驱无线网卡,去官网竟然搜不到网卡驱动,而我并没有win环境,本想装个pe,结果网盘下载限速,下了半天没有成功,最终此方案作罢。
0bda:1a2b RTL8188GU
连接网卡到虚拟机,使用命令lsusb
查看到设备0bda:1a2b RTL8188GU,(这里走了弯路),以此为基础RTL8188GU,编译安装了RTL8188GU的驱动,结果还是不行。后来才知道是设备被识别成cdrom了。
rtl8821CU
使用命令usb_modeswitch -KW -v 0bda -p 1a2b
,拿着id去搜索,发现是rtl8821CU,重新安装rtl8821CU的驱动,成功在虚拟机上连接到wifi。接下来就是怎么在另一台没有网络的环境安装驱动和相关软件。
有网络的环境
替换软件源,(选择你那里比较快的节点,安装好之后,网速一直很慢,还以为是驱动的问题,结果是源比较慢),安装必要的软件,下载rtl8821CU驱动源码,安装好依赖,由于我们需要提取驱动,这里选择make
的方式,将8821cu.ko复制出来。
# replace apt source
sed -i 's/deb/#deb/g' /etc/apt/sources.list.d/pve-enterprise.list
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian buster pve-no-subscription' >> /etc/apt/sources.list.d/pve-no-subscription.list
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" > /etc/apt/sources.list
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >> /etc/apt/sources.list
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >> /etc/apt/sources.list
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
sed -i "s/mirrors.tuna.tsinghua.edu.cn/mirrors.ustc.edu.cn/g" /etc/apt/sources.list
sed -i "s/mirrors.tuna.tsinghua.edu.cn/mirrors.ustc.edu.cn/g" /etc/apt/sources.list.d/pve-no-subscription.list
apt update
apt -y install usb-modeswitch wireless-tools make gcc git dkms pve-headers-$(uname -r) wpasupplicant pve-headers
git clone https://github.com/brektrou/rtl8821CU.git
make
make install
使用iwconfig
查看网卡名称,下文用wlan0
指代。
# 启动网卡
ifup wlan0
# 配置wifi
echo 'ctrl_interface=/var/run/wpa_supplicant
network={
ssid="YOUR_SSID"
psk="YOUR_WIFI_PWD"
}' > /etc/my_wpa_supplicant.conf
# 启动wifi
wpa_supplicant -B -i wlan0 -c /etc/my_wpa_supplicant.conf
# 配置网络,以路由器的实际环境配置
ifconfig wlan0 192.168.1.100
route add default gw 192.168.1.1 dev wlan0
实际使用参考 https://github.com/h4fan/rtl8821CU_pve
参考
- https://github.com/brektrou/rtl8821CU
- https://my.oschina.net/u/3378766/blog/3135082
- https://koolshare.cn/thread-160531-1-1.html
- https://blog.csdn.net/u012349696/article/details/52524124
- https://blog.csdn.net/qq_19905867/article/details/114118476
- https://askubuntu.com/questions/1162974/wireless-usb-adapter-0bdac811-realtek-semiconductor-corp
- https://www.wyr.me/post/623
- https://www.leonlu.cc/hobby/note006-rtl8188gu-linux/
- https://forum.ubuntu.org.cn/viewtopic.php?t=489451
- https://einverne.github.io/post/2020/03/proxmox-install-and-setup.html