1.检查无线网卡和驱动
1.检查无限接口名称 通常以wl开头
ip link
root@EclipsedRui:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 00:e0:1b:83:97:fc brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
link/ether 00:e0:1b:83:97:fc brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 00:e0:1b:83:97:fc brd ff:ff:ff:ff:ff:ff
6: tailscale1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc fq state UNKNOWN mode DEFAULT group default qlen 500
link/none
未寻找到无线接口
2.检查驱动状态
dmesg | grep iwlwifi
root@EclipsedRui:~# dmesg | grep iwlwifi
root@EclipsedRui:~#
未寻找到驱动
3.查看 PCI 网卡及驱动状态
lspci -k | grep -iA3 network
root@EclipsedRui:~# lspci -k | grep -iA3 network
00:14.3 Network controller: Intel Corporation Alder Lake-S PCH CNVi WiFi (rev 11)
DeviceName: Onboard - Ethernet
Subsystem: Intel Corporation Device 4090
Kernel driver in use: vfio-pci
Intel Alder Lake 无线网卡 的驱动被错误绑定到
vfio-pci
(一种用于 PCI 设备直通的驱动)。vfio-pci
会将设备从宿主机“隔离”,通常用于虚拟机直通(如 KVM/QEMU),导致宿主机无法直接使用该设备。
2.解除vfio-pci绑定
1.确认无限网卡的PCI地址
lspci
root@EclipsedRui:~# lspci
00:00.0 Host bridge: Intel Corporation 12th Gen Core Processor Host Bridge (rev 04)
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-S GT1 [UHD Graphics 770] (rev 08)
00:0a.0 Signal processing controller: Intel Corporation Platform Monitoring Technology (rev 01)
00:14.0 USB controller: Intel Corporation Alder Lake-S PCH USB 3.2 Gen 2x2 XHCI Controller (rev 11)
00:14.2 RAM memory: Intel Corporation Alder Lake-S PCH Shared SRAM (rev 11)
00:14.3 Network controller: Intel Corporation Alder Lake-S PCH CNVi WiFi (rev 11)
00:15.0 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #0 (rev 11)
00:15.2 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #2 (rev 11)
00:15.3 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #3 (rev 11)
00:16.0 Communication controller: Intel Corporation Alder Lake-S PCH HECI Controller #1 (rev 11)
00:17.0 SATA controller: Intel Corporation Alder Lake-S PCH SATA Controller [AHCI Mode] (rev 11)
00:19.0 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #4 (rev 11)
00:19.1 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO I2C Controller #5 (rev 11)
00:1c.0 PCI bridge: Intel Corporation Alder Lake-S PCH PCI Express Root Port #2 (rev 11)
00:1e.0 Communication controller: Intel Corporation Alder Lake-S PCH Serial IO UART #0 (rev 11)
00:1e.3 Serial bus controller: Intel Corporation Alder Lake-S PCH Serial IO SPI Controller #1 (rev 11)
00:1f.0 ISA bridge: Intel Corporation Device 7a87 (rev 11)
00:1f.3 Audio device: Intel Corporation Alder Lake-S HD Audio Controller (rev 11)
00:1f.4 SMBus: Intel Corporation Alder Lake-S PCH SMBus Controller (rev 11)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-S PCH SPI Controller (rev 11)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)
2.手动释放设备并绑定到iwlwifi 驱动
echo 0000:00:14.3 | sudo tee /sys/bus/pci/drivers/vfio-pci/unbind
echo 0000:00:14.3 | sudo tee /sys/bus/pci/drivers/iwlwifi/bind
lspci -k -s 00:14.3
# 释放设备
root@EclipsedRui:~# echo 0000:00:14.3 | sudo tee /sys/bus/pci/drivers/vfio-pci/unbind
0000:00:14.3
# 绑定到iwlwifi
root@EclipsedRui:~# echo 0000:00:14.3 | sudo tee /sys/bus/pci/drivers/iwlwifi/bind
0000:00:14.3
# 查看状态
root@EclipsedRui:~# lspci -k -s 00:14.3
00:14.3 Network controller: Intel Corporation Alder Lake-S PCH CNVi WiFi (rev 11)
DeviceName: Onboard - Ethernet
Subsystem: Intel Corporation Device 4090
Kernel modules: iwlwifi
3.加载启动
sudo modprobe iwlwifi
4.查看是否出现无线接口
ip link
5.未出现wl 开头的无线接口(出现 -> 6)
1.检查 dmesg 输出是否有驱动错误
dmesg | grep iwlwifi
2.强制重置PCI设备
# 移除设备(需替换 PCI 地址)
root@EclipsedRui:~# echo 1 | sudo tee /sys/bus/pci/devices/0000:00:14.3/remove
1
# 重新扫描 PCI 总线
root@EclipsedRui:~# echo 1 | sudo tee /sys/bus/pci/rescan
1
# 再次检查驱动绑定
root@EclipsedRui:~# lspci -k -s 00:14.3
00:14.3 Network controller: Intel Corporation Alder Lake-S PCH CNVi WiFi (rev 11)
DeviceName: Onboard - Ethernet
Subsystem: Intel Corporation Device 4090
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi
# 查看无限接口是否存在
root@EclipsedRui:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq master bond0 state UP mode DEFAULT group default qlen 1000
link/ether 00:e0:1b:83:97:fc brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
link/ether 00:e0:1b:83:97:fc brd ff:ff:ff:ff:ff:ff
5: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 00:e0:1b:83:97:fc brd ff:ff:ff:ff:ff:ff
6: tailscale1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc fq state UNKNOWN mode DEFAULT group default qlen 500
link/none
7: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 50:28:4a:31:9a:43 brd ff:ff:ff:ff:ff:ff
6.永久修复(避免重启后失效)
1. 移除 vfio-pci
的绑定配置
检查以下文件是否包含无线网卡的 PCI 地址:
/etc/modprobe.d/vfio.conf
/etc/default/grub
(检查GRUB_CMDLINE_LINUX
是否包含vfio-pci.ids=...
)
若存在类似配置,删除无线网卡的 PCI ID(8086:7af0
)或禁用相关设置。
# 更新 initramfs 并重启
sudo update-initramfs -u
sudo reboot
2.若未找到文件
1. 确认 Unraid 的 PCI 直通配置
通过 Web 界面解除 VFIO 绑定
进入 Unraid Web 界面 → Tools → System Devices。
找到无线网卡(PCI ID
00:14.3
,Vendor:Device ID8086:7af0
)。取消勾选该设备的
VFIO 绑定
选项。点击 Apply 保存设置。
2. 修改 Unraid 内核启动参数
Unraid 的启动参数保存在 /boot/syslinux/syslinux.cfg
,需手动编辑:
nano /boot/syslinux/syslinux.cfg
找到以 append initrd=/bzroot
开头的行,检查是否包含 vfio-pci.ids=...
参数。
若有,删除无线网卡的 ID
8086:7af0
(保留其他设备 ID,避免影响其他直通设备)。
3. 屏蔽 vfio-pci
驱动对无线网卡的劫持
在 Unraid 中,可以通过 modprobe
黑名单实现:
# 创建黑名单配置文件
nano /boot/config/modprobe.d/vfio-blacklist.conf
添加以下内容(阻止 vfio-pci
绑定到无线网卡):
# 屏蔽 Intel 无线网卡(设备ID 8086:7af0)
blacklist vfio-pci
options vfio-pci ids=!8086:7af0
4. 强制加载 iwlwifi
驱动
编辑 Unraid 的启动脚本 /boot/config/go
,确保每次启动加载驱动:
nano /boot/config/go
在文件末尾添加以下内容:
# 加载 Intel 无线驱动
modprobe iwlwifi
# 启用接口(接口名根据实际情况调整)
ip link set dev wlan0 up
3.连接wifi
1.启动 wlan0
ip link set dev wlan0 up
2.连接网络
1.生成 Wi-Fi 配置文件
wpa_passphrase "<Wi-Fi名称>" "<密码>" | sudo tee /etc/wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=root
network={
ssid="Your_WiFi_Name"
psk="Your_WiFi_Password"
}
2.连接网络
sudo wpa_supplicant -i <接口名> -c /etc/wpa_supplicant.conf -B
控制接口文件残留 or 无线驱动重复配置
Successfully initialized wpa_supplicant
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Failed to initialize control interface '/var/run/wpa_supplicant'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.
wlan0: CTRL-EVENT-DSCP-POLICY clear_all
wlan0: CTRL-EVENT-DSCP-POLICY clear_all
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
# 强制终止所有 wpa_supplicant 进程
sudo pkill -9 wpa_supplicant
# 删除残留的 socket 文件
sudo rm -f /var/run/wpa_supplicant/wlan0
# 重新运行
sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B
3.验证连接状态
iw dev wlan0 link
root@EclipsedRui:/var# iw dev wlan0 link
Connected to 94:d9:b3:fa:7b:90 (on wlan0)
SSID: TP-LINK_2402
freq: 5745.0
RX: 94656 bytes (294 packets)
TX: 118312 bytes (277 packets)
signal: -67 dBm
rx bitrate: 24.0 MBit/s
tx bitrate: 26.0 MBit/s VHT-MCS 3 VHT-NSS 1
bss flags: short-slot-time
dtim period: 1
beacon int: 100
4.获取ip地址
sudo dhclient wlan0
or
sudo dhcpcd wlan0
5.测试互联网访问
# 测试基础网络
ping -c4 8.8.8.8
# 测试 DNS
ping -c4 www.baidu.com
4.持久化wifi信息,并自动连接
1.Unraid 的文件系统特性:
Unraid 的根文件系统 (/) 是临时性的,重启后所有修改都会丢失(包括 /etc 目录下的文件)。
持久化配置必须存储在 /boot/config 目录(该目录对应 U 盘上的 config 文件夹)。
2.将配置文件保存到持久化目录
生成或复制 wpa_supplicant.conf 到 /boot/config
3.修改启动脚本以加载持久化配置
# 加载驱动
modprobe iwlwifi
# 将持久化配置复制到 /etc 目录
cp /boot/config/wpa_supplicant.conf /etc/wpa_supplicant.conf
# 启用接口并连接
ip link set dev wlan0 up
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
# 选择其一
dhcpcd wlan0 or sudo dhcpcd wlan0