1–WIFI命令
iwlist wlan0 scan 可以显示当前连接WIFI的名字【当前无用】
增加一个接入路由器的账户/密码 修改如下文件
sudo vim /etc/wpa_supplicant/wpa_supplicant.conf
2–作为热点
找到开源项目
https://github.com/oblique/create_ap
关注度比较高 迄今已经不在维护 按照说明开始操作
git clone https://github.com/oblique/create_ap
cd create_ap
make install
此后开始发起热点
测试如下指令
create_ap wlan0 eth0 MyPi 123456789
create_ap -n wlan0 eth0 MyPi 123456789
create_ap -m bridge wlan0 eth0 MyPi 123456789
create_ap -m bridge wlan0 br0 MyPi 123456789
create_ap --isolate-clients wlan0 eth0 MyPi 123456789
create_ap --ieee80211n --ht_capab '[HT40+]' wlan0 eth0 MyPi 123456789
create_ap --no-virt wlan0 eth0 MyPi 123456789
但是 都有同样问题
root@raspberrypi:/home/pi# create_ap wlan0 eth0 MyPi 123456789
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
根据描述 树莓派不能再连接的情况下去作为AP
根据错误提示的连接 找到另外一个带GUI的开源项目
https://github.com/lakinduakash/linux-wifi-hotspot
git clone https://github.com/lakinduakash/linux-wifi-hotspot
cd linux-wifi-hotspot //上面下载不了 WIN10下载 传到PI再解压的
#build binaries
make
#install
sudo make install
执行
wihotspot
结果还不如前面的开源项目
准备解决此问题。树莓派如何设置AP模式?
=======================================================================================
继续
注意到一个前人的文章 树莓派上开热点(AP)的三种办法实践结果V2_Kearney-CSDN博客
--最后实践结果表明官方的文档比 rasap 要繁琐一点,更容易出错,create_ap 团队表示不再维护,而且实践表明在 raspi 4 上行不通,因此这里推荐使用 rasap
开始使用rasap
简单办法 手上的树莓派很遗憾 不行
去官网 RaspAP — Simple wireless router setup for Debian-based devices
执行
sudo apt-get update
sudo apt-get full-upgrade
sudo reboot
sudo raspi-config
curl -sL https://install.raspap.com | bash
效果一样
自动挡换手动挡 Manual installation - RaspAP Documentation
准备工作1---
国内升级/安装过程中 常常有问题 需要换源 经过尝试 下面的最棒
树莓派从零开始快速入门第2讲——更换国内源_ShenZhen_zixian的博客-CSDN博客_树莓派换源
修改为如下内容
文件1------ nano /etc/apt/sources.list
deb Index of /raspbian/raspbian/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror buster main non-free contrib rpi
deb-src Index of /raspbian/raspbian/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror buster main non-free contrib rpi
文件2------nano /etc/apt/sources.list.d/raspi.list
deb Index of /raspberrypi/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror buster main ui
同步更新源
sudo apt-get update
更新软件包
sudo apt-get upgrade
准备工作2---
pi@raspberrypi:~ $ sudo rm -rf /var/www/html
pi@raspberrypi:~ $ sudo git clone https://github.com/RaspAP/raspap-webgui /var/www/html
正克隆到 '/var/www/html'...
fatal: unable to access 'https://github.com/RaspAP/raspap-webgui/': gnutls_handshake() failed: The TLS connection was non-properly terminated.
pi@raspberrypi:~ $
因为每次github下载都是失败!!有没有办法?
暂时绕过去
root@raspberrypi:/var/www# mkdir html
root@raspberrypi:/var/www# cd html/
root@raspberrypi:/var/www/html# pwd
/var/www/html
root@raspberrypi:/var/www/html#
自己建立一个文件夹 把仓库放进去
下载拷贝过去
sudo mv /home/pi/raspap-webgui-master /var/www/html
cd /etc/lighttpd/conf-available/
这里面有很多.config文件
新建一个文件 如下 50-raspap-router.conf
WEBROOT="/var/www/html"
CONFSRC="$WEBROOT/config/50-raspap-router.conf"
LTROOT=$(grep "server.document-root" /etc/lighttpd/lighttpd.conf | awk -F '=' '{print $2}' | tr -d " \"")
HTROOT=${WEBROOT/$LTROOT}
HTROOT=$(echo "$HTROOT" | sed -e 's/\/$//')
awk "{gsub(\"/REPLACE_ME\",\"$HTROOT\")}1" $CONFSRC > /tmp/50-raspap-router.conf
sudo cp /tmp/50-raspap-router.conf /etc/lighttpd/conf-available/
sudo mv /home/pi/50-raspap-router.conf /etc/lighttpd/conf-available
sudo ln -s /etc/lighttpd/conf-available/50-raspap-router.conf /etc/lighttpd/conf-enabled/50-raspap-router.conf
sudo systemctl restart lighttpd.service
这时候还是有问题
打开这个github看看
找电视机HDMI接入这个PI 启动SSH服务【当前已经没有VNC服务可以启动了】
SSH不能直接启动 需要先接入WIFI 才可以
默认的用户名: pi
默认的密码是: raspberry
sudo passwd root
sudo raspi-config 1-1写WIFI
此后可以SSH连接了
part2----
换源
part3----更新https://github.com/RaspAP/raspap-webgui
sudo apt-get update
sudo apt-get full-upgrade
sudo reboot
设置WIFI为中国 Set the "WLAN country" option in raspi-config
's Localisation Options: sudo raspi-config
【只能使用PUTTY 使用secureCRT的话这个GUI有问题】
重启 执行自动化命令 可以work了
curl -sL https://install.raspap.com | bash
重启一次
此时ssh已经无法接入PI 通过接屏幕 看到PI的地址已经变化了
所以不能SSH做下去了 需要显示器 它的IP是10.3.141.1
手机看到热点 raspi-webgui
手机 连接
- SSID:
raspi-webgui
- Password: ChangeMe
- 然后浏览器打开http://10.3.141.1/
- IP address: 10.3.141.1
- Username: admin
- Password: secret
此时可以看到PI可以发出热点 手机或者PC可以接入
后面研究怎么和PI设置WIFI参数
============================================================
继续这个方案 有两个问题
1—修改web页面 应该再pi里面对应一个文件的修改 找到这个文件的关联
2—当前PI作为AP以后会离线 怎样做到AP-STA
开始
先做2 (其实现在是可以往下发热点了 但是不能往上联网 通过测试可以加入网线 即可完成这个功能)
https://github.com/RaspAP/raspap-webgui#simultaneous-ap-and-wifi-client
当前计划
Q1—一步一步走 因为开机有一个openvpn的error
Q2—试一试修改 重启看看【看到是假的而已】
Q3–手机的问题【感觉这个问题处理好了 就没有问题了 但是还不行】
client(客户端) :如果一个设备的wifi能够搜索其他设备的无线,添加后能够转为有线联网,这就是client 模式。
AP(无线接入点):如果一个设备能够将有线网络转为wifi信息,就是AP模式。
Q2---Assuming you have wpa_supplicant.conf fully populated and a valid hostapd.conf, set the following values in /etc/raspap/hostapd.ini
:
LogEnable = 0
WifiAPEnable = 1
BridgedEnable = 0
WifiManaged = wlan0
substituting wlan0
for your AP interface, if necessary. You may then restart the raspap daemon with sudo systemctl restart raspapd.service
.
Q3----
WiFi scanning doesn't work or I get the error cannot execute "wpa_cli reconfigure"
. Help!
1 sudo wpa_cli -i wlan0 scan_results
Failed to connect to non-global ctrl_ifname: wlan0 error: No such file or directory
2 sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
3 sudo wpa_supplicant -B -Dnl80211,wext -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0
针对3的研究
新卡 用的32G的那个已经update的 看看效果 --sudo apt-get full-upgrade 几乎不要时间 下次用2G卡吧 哈哈
在SD外面放了2个文件 看看效果 --SSH 直接用 WIFI已经改好了
不插网线 安装完成 但是现在不复位还能做什么呢 没有WIFI出来 那就复位吧
解决手机的问题
增加几句话以后 现在没有WIFI了
重启的话 效果一样 那句话关机失效了
准备知识
network是Linux管理网络的一个服务,网卡连接上网线,没有network提供网络服务,也是无法连接网络的。所以只要关闭network,我们也无法连接网络。
systemctl status network ## 当前network服务状态
systemctl stop network ## 关闭network服务
systemctl start network ## 启动network服务
systemctl restart network ## 重启network服务
systemctl status network 发现已经没有这个服务了
FAQ - RaspAP Documentation RaspAP 控制面板可以工作,但重启后没有 WiFi
sudo systemctl status raspapd.service
执行reload 还是不行
我可以在不使用 UI 的情况下配置托管模式 AP 吗?
假设您正在使用首次启动时设置 RaspAP 的脚本创建 RPi 操作系统映像(或其他支持的操作系统)。在这种情况下,要配置托管模式 AP,您必须通过浏览器手动连接,通过 UI 进行一些更改,然后保存您的设置。这也可以以编程方式完成。假设您已wpa_supplicant.conf完全填充且有效hostapd.conf,请在 中设置以下值/etc/raspap/hostapd.ini:
LogEnable = 0
WifiAPEnable = 1
BridgedEnable = 0
WifiManaged = wlan0
wlan0如有必要,替换您的 AP 接口。然后,您可以使用 重新启动 raspap 守护程序sudo systemctl restart raspapd.service。
再次启动 还是没有WIFI
试试这个
cp hostapd.ini /etc/raspap/
直接写这个文件的结果是
依然不能上网 可以看到图标是激活了
所以是个假的!
还是需要去发消息
逻辑1--直接写文件不行 2--手机发 但是手机提示error 按照提示 现在是服务以后没有WIFI了 怎样保证WIFI持续
拔掉网线 重启 看到昨天一样的 PI现在是10.3.141.1
记录一下手机进去的截图
修改为 桥
复位
手机现在无法接入PI了
插入网线复位一下
手机 可以接入WIFI了 看到信息也变化了
现在是10.60.32.1---以前是10.3.141.1
现在是网线+桥 前面是默认无桥+无网线
手机进不去WEB 但是可以刷抖音的
管理页面的进入也有描述 用文字 主要 因为可以上网 很容易上百度
http://raspberrypi.local/ 而不是 raspberrypi.local/
现在准备一步一步再来一次
How do I uninstall RaspAP?
cd /var/www/html
sudo installers/uninstall.sh
完成以后 ifconfig看到wlan0 没有了 重启一次
正常上网了10.60.20.125
cp home/pi/50-raspap-router.conf /etc/lighttpd/conf-available
手动 也不麻烦 PUTTY很好右键粘贴
最后启动 LOG看问题很多
手机连接WIFI 看到WEB打不开!
把32G的PI镜像 烧到SD卡
再来一次
curl -sL https://install.raspap.com | bash -s -- --yes
BLE部分
A--------
直接下载环境 失败
roy使用的是 go1.16.7.linux-armv6l.tar.gz
我下载 https://golang.org/dl/
go1.17.1.linux-armv6l.tar.gz
WIN10下载以后传过去
tar -zxvf go1.17.1.linux-armv6l.tar.gz
sudo
mv
go
/usr/local
sudo
echo
'export PATH=$PATH:/usr/local/go/bin'
|
cat
>> .profile
#add golang path
source
.profile
#reload bash setting
此时GO环境OK
B-------------
这里给GO做一个代理 执行如下命令 参考文章golang的goproxy配置_嗯嗯~的博客-CSDN博客_golang goproxy
39 go version
40 export GO111MODULE=on
41 export GOPROXY=https://mirrors.aliyun.com/goproxy/
42 export GOPROXY=https://goproxy.cn
43 export GOSUMDB=off
44 history
C-------
此时去muka的仓库试试 它是我们的根基
https://github.com/muka/go-bluetooth
git clone https://github.com/muka/go-bluetooth.git
cd go-bluetooth/
make bluez/init bluez/checkout gen/clean gen/run