1、#启动无线网卡

ifup wlp1s0 #wlp1s0 改为你的实际网卡名称

2、#安装工具无线相关工具,以下命令已经全部打包

apt-get install iw net-tools wireless-tools hostapd
Y

3、查看是否支持无线AP模式,可以看AP AP/VLAN

iw list | grep “Supported interface modes” -A 8
image-1699607355755

4、编辑hostapd服务的默认配置文件

nano /etc/default/hostapd
添加:
DAEMON_CONF=“/etc/hostapd/hostapd.conf”

5、编辑无线热点配置,需要修改interface=? ssid=? wpa_passphrase=?,这三项目就是无线网卡名字、无线信号、无线密码

查1张无线网卡是否支持开虚拟接口?
iw list
valid interface combinations #定位字段,是否有以下内容
valid interface combinations:
* #{ managed } <= 2, #{ AP } <= 2,
total <= 2, #channels <= 2

若有则创建虚拟接口
sudo iw dev wlp3s0 interface add wlp3s0_1 type managed
iw dev wlp3s0_1 del #删除虚拟接口

2.4G设置
nano /etc/hostapd/hostapd.conf

This is a basic hostapd configuration for a 2.4GHz (802.11g) access point

Set the interface name

interface=网卡名称
#bridge=vmbr1 #根据实际网络,配置

Set the driver

driver=nl80211

Set the country code (adjust as necessary)

country_code=CN

Set the operating mode to 2.4GHz

hw_mode=g

Set the channel for 2.4GHz band (choose a specific channel or let hostapd choose)

channel=6

Set the SSID (network name)

ssid=无线信号

Set the network mode

ieee80211n=1

Set the network password

wpa=2
wpa_passphrase=无线密码
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

Enable 802.11w management frame protection

ieee80211w=1

5G设置
nano /etc/hostapd/hostapd1.conf

This is a basic hostapd configuration for a 5GHz (802.11a) access point

Set the interface name

interface=网卡名称
#bridge=vmbr1 #根据实际网络,配置

Set the driver

driver=nl80211

Set the country code (adjust as necessary)

country_code=CN

Set the operating mode to 5GHz

hw_mode=a

Set the channel for 5GHz band (choose a specific channel or let hostapd choose)

channel=149

Set the SSID (network name)

ssid=无线信号-5g

Set the network mode

ieee80211n=1
ieee80211ac=1

Set the network password

wpa=2
wpa_passphrase=无线密码
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

Enable 802.11w management frame protection

ieee80211w=1

6、nano /etc/network/interfaces

原先的内容清楚,输入复制粘贴一下内容,IP等根据你的网络实际配置:

auto lo

iface lo inet loopback

iface enp2s0 inet manual
#有线网卡地址,默认不需要改

auto vmbr0

iface vmbr0 inet static

address 10.10.254.63/24

gateway 10.10.254.1

bridge-ports enp2s0

bridge-stp off

bridge-fd 0

#无线网卡配置

allow-hotplug wlp1s0

iface wlp1s0 inet manual

#无线网卡桥接vmbr1

auto vmbr1

static

iface vmbr1 inet static

bridge_ports wlp1s0

address 192.168.100.63 #istoreos软路由lan段的地址,192.168.100.2~254里面的任意个一个

netmask 255.255.255.0

gateway 192.168.100.1

bridge-stp off

bridge-fd 0

6、解除pve对hostapd服务的禁用,及hostapd服务设置为开机启动。

systemctl unmask hostapd

systemctl enable hostapd

7、更新hostapd启动服务的配置

hostapd -d /etc/hostapd/hostapd.conf
hostapd -d /etc/hostapd/hostapd1.conf #若有配置多热点
可能会遇到不停滚代码的情况,按下ctrl+z,停止即可

8、重启下PVE。

输入:reboot

9、最后用 iw dev查看ssid 工作情况

输入:iw dev
phy#0
Interface wlp3s0
ifindex 4
wdev 0x1
addr 10:6f:d9:d0:ad:0d
ssid m5-5g
type AP
channel 149 (5745 MHz), width: 20 MHz, center1: 5745 MHz
txpower 3.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 0 0 0 0 0 0 0

10、其他一些相关命令

lspci | grep -i net #查询网卡型号
01:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)
02:00.0 Ethernet controller: Intel Corporation Ethernet Controller I225-V (rev 03)
03:00.0 Network controller: MEDIATEK Corp. MT7921K (RZ608) Wi-Fi 6E 80MHz

iw dev wlp3s0 scan | grep SSID #指定无线网卡,搜下无线信号
SSID: tt1
SSID: GSS
SSID: CMCC-9ba3-5G

iwlist wlp3s0 freq #查无线网卡支持的信道
wlp3s0 26 channels in total; available frequencies :
Channel 01 : 2.412 GHz
Channel 02 : 2.417 GHz
Channel 03 : 2.422 GHz
Channel 04 : 2.427 GHz
Channel 05 : 2.432 GHz
Channel 06 : 2.437 GHz
Channel 07 : 2.442 GHz
Channel 08 : 2.447 GHz
Channel 09 : 2.452 GHz
Channel 10 : 2.457 GHz
Channel 11 : 2.462 GHz
Channel 12 : 2.467 GHz
Channel 13 : 2.472 GHz
Channel 36 : 5.18 GHz
Channel 40 : 5.2 GHz
Channel 44 : 5.22 GHz
Channel 48 : 5.24 GHz
Channel 52 : 5.26 GHz
Channel 56 : 5.28 GHz
Channel 60 : 5.3 GHz
Channel 64 : 5.32 GHz
Channel 149 : 5.745 GHz
Channel 153 : 5.765 GHz
Channel 157 : 5.785 GHz
Channel 161 : 5.805 GHz
Channel 165 : 5.825 GHz