步骤如下
git clone https://github.com/oblique/create_ap
或者
git clone https://gitee.com/mirrors_oblique/create_ap.git(镜像)
cd create_ap
sudo make install
#安装依赖包
sudo apt-get install util-linux procps hostapd iproute2 iw haveged dnsmasq
#查看你的树莓派是否有iptables(dpkg -l | grep iptables) 如果有跳过这一步
sudo apt-get install iptables
#(通过网线给树莓派提供网络)创建热点
sudo create_ap wlan0 eth0 网络名称 网络密码 --no-virt
#(通过4G给树莓派提供网络)创建热点
sudo create_ap wlan0 wwan0 网络名称 网络密码 --no-virt
创建成功显示如下
如果遇到下面问题 看下是否你的树莓派连接wifi,如果是先将它断开,再重试
pi@raspberrypi:~ $ sudo create_ap wlan0 wwan0 raspi 1234567
WARN: brmfmac driver doesn't work properly with virtual interfaces and
it can cause kernel panic. For this reason we disallow virtual
interfaces for your adapter.
For more info: https://github.com/oblique/create_ap/issues/203
ERROR: Your adapter can not be a station (i.e. be connected) and an AP at the same time
查看默认的配置,修改热点名称(SSID),密码(PASSPHRASE),修改提供网络的网卡(INTERENCE_IFACE)
可以使用下面命令去控制wifi热点
sudo systemctl restart create_ap
sudo systemctl status create_ap
sudo systemctl stop create_ap
#(关闭开机自启)
sudo systemctl disbale create_ap
#(打开开机自启)
sudo systemctl enable create_ap
参考:树莓派上开热点(AP)的三种办法实践结果V2_Kearney form An idea的博客-CSDN博客_树莓派开热点