iovxw

Linux 下 Intel® 网卡开启 5Ghz AP

最好还是换网卡

Intel 家的网卡都禁止使用 5Ghz 开 AP, 只能开 2.4 的

比如我的 9560, 可以说是旗舰网卡, 能跑 1.7Gbps, 强得一匹

但却连个 5Ghz AP 都开不了

周边 2.4Ghz 信道都满了,要它何用啊

今日得一魔法, 可破此局


默认情况下, iw list 输出 5Ghz 可用频段如下:

Frequencies:
        * 5180 MHz [36] (22.0 dBm) (no IR)
        * 5200 MHz [40] (22.0 dBm) (no IR)
        * 5220 MHz [44] (22.0 dBm) (no IR)
        * 5240 MHz [48] (22.0 dBm) (no IR)
        * 5260 MHz [52] (22.0 dBm) (no IR, radar detection)
        * 5280 MHz [56] (22.0 dBm) (no IR, radar detection)
        * 5300 MHz [60] (22.0 dBm) (no IR, radar detection)
        * 5320 MHz [64] (22.0 dBm) (no IR, radar detection)
        * 5340 MHz [68] (disabled)
        * 5360 MHz [72] (disabled)
        * 5380 MHz [76] (disabled)
        * 5400 MHz [80] (disabled)
        * 5420 MHz [84] (disabled)
        * 5440 MHz [88] (disabled)
        * 5460 MHz [92] (disabled)
        * 5480 MHz [96] (disabled)
        * 5500 MHz [100] (22.0 dBm) (no IR, radar detection)
        * 5520 MHz [104] (22.0 dBm) (no IR, radar detection)
        * 5540 MHz [108] (22.0 dBm) (no IR, radar detection)
        * 5560 MHz [112] (22.0 dBm) (no IR, radar detection)
        * 5580 MHz [116] (22.0 dBm) (no IR, radar detection)
        * 5600 MHz [120] (22.0 dBm) (no IR, radar detection)
        * 5620 MHz [124] (22.0 dBm) (no IR, radar detection)
        * 5640 MHz [128] (22.0 dBm) (no IR, radar detection)
        * 5660 MHz [132] (22.0 dBm) (no IR, radar detection)
        * 5680 MHz [136] (22.0 dBm) (no IR, radar detection)
        * 5700 MHz [140] (22.0 dBm) (no IR, radar detection)
        * 5720 MHz [144] (22.0 dBm) (no IR, radar detection)
        * 5745 MHz [149] (22.0 dBm) (no IR)
        * 5765 MHz [153] (22.0 dBm) (no IR)
        * 5785 MHz [157] (22.0 dBm) (no IR)
        * 5805 MHz [161] (22.0 dBm) (no IR)
        * 5825 MHz [165] (22.0 dBm) (no IR)
        * 5845 MHz [169] (disabled)
        * 5865 MHz [173] (disabled)
        * 5885 MHz [177] (disabled)
        * 5905 MHz [181] (disabled)

除了 disabled 就是 no-IR, 意思就是没戏

解决方法是关掉 Intel 的 Location Aware Regulatory, 这玩意禁止你使用非法信道(别家网卡都没有,你咋管这么多)

echo options iwlwifi lar_disable=1 >> /etc/modprobe.d/iwlwifi.conf

重启

Frequencies:
        * 5180 MHz [36] (22.0 dBm) (no IR)
        * 5200 MHz [40] (22.0 dBm) (no IR)
        * 5220 MHz [44] (22.0 dBm) (no IR)
        * 5240 MHz [48] (22.0 dBm) (no IR)
        * 5260 MHz [52] (22.0 dBm) (no IR, radar detection)
        * 5280 MHz [56] (22.0 dBm) (no IR, radar detection)
        * 5300 MHz [60] (22.0 dBm) (no IR, radar detection)
        * 5320 MHz [64] (22.0 dBm) (no IR, radar detection)
        * 5500 MHz [100] (disabled)
        * 5520 MHz [104] (disabled)
        * 5540 MHz [108] (disabled)
        * 5560 MHz [112] (disabled)
        * 5580 MHz [116] (disabled)
        * 5600 MHz [120] (disabled)
        * 5620 MHz [124] (disabled)
        * 5640 MHz [128] (disabled)
        * 5660 MHz [132] (disabled)
        * 5680 MHz [136] (disabled)
        * 5700 MHz [140] (disabled)
        * 5720 MHz [144] (disabled)
        * 5745 MHz [149] (22.0 dBm)
        * 5765 MHz [153] (22.0 dBm)
        * 5785 MHz [157] (22.0 dBm)
        * 5805 MHz [161] (22.0 dBm)
        * 5825 MHz [165] (22.0 dBm)

虽然好像少了几个, 不过至少有看起来能用的信道了

为什么是看起来呢, 因为还是不能用, 网卡不给你开

咋办呢

该使用魔法了:

打开你的 WiFi, 找到个 5Ghz 的, 连上去

你要用的信道就开启了

当然要确认那个 WiFi 是在上述可使用频段中的

再正常创建 AP 就行了

create_ap --ieee80211ac --freq-band 5 wlo1 eno1 AP PASSWORD
Config dir: /tmp/create_ap.wlo1.conf.ZWqfelAf
PID: 3478
Network Manager found, set ap0 as unmanaged device... DONE
wlo1 is already associated with channel 149 (5745 MHz), fallback to channel 149
Creating a virtual WiFi interface... ap0 created.
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlo1.conf.ZWqfelAf/hostapd_ctrl
Configuration file: /tmp/create_ap.wlo1.conf.ZWqfelAf/hostapd.conf
Using interface ap0 with hwaddr xx:xx:xx:xx:xx:xx and ssid "AP"
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED

注意 already associated with channel 149 (5745 MHz) 这里, 说明在用已连接的信道

如果提示 rfkill: WLAN soft blocked, 运行 rfkill unblock all 解锁即可