不要用刷機過程配置WIFI賬號,因為在那里配置的WIFI都是不受控的,會出很多問題。
1.安裝網絡
sudo apt-get install network-manager
2.將源碼CLONE到本地
sudo git clone https://github.com/oblique/create_ap
cd create_ap
sudo make install
當你在終端中看到錯誤消息“sudo: make: command not found”時,這意味著make
工具在你的系統上沒有安裝。make
是一個構建自動化工具,它根據一個名為Makefile
的文件來編譯和鏈接程序。
需要安裝make軟件。
sudo apt-get update
sudo apt-get install build-essential
3.安裝依賴的庫
sudo apt-get install util-linux procps hostapd iproute2 iw haveged dnsmasq
4.打開熱點(此時,樹莓派wifi開著,但沒有連wifi)
sudo create_ap wlan0 eth0 熱點名 密碼
? ?此時不出意外熱點將會開啟,但是會有warn,可以執行以下代碼
sudo create_ap --no-virt wlan0 eth0 m熱點名 熱點
sudo create_ap --no-virt wlan0 eth0 chaochao 12345678
5.以服務方式啟動,執行開機自啟
#1.修改服務配置,添加--no-virt參數
sudo nano /usr/lib/systemd/system/create_ap.service
# 將
ExecStart=/usr/bin/create_ap --config /etc/create_ap.conf
# 修改為
ExecStart=/usr/bin/create_ap --no-virt --config /etc/create_ap.conf#2.默認配置文件/etc/create_ap.conf,將下面兩橫改為自己的ssid和密碼即可,修改自己的dhcp網關
sudo nano /etc/create_ap.conf
# 將
GATEWAY=10.0.0.1
SSID=MyAccessPoint
PASSPHRASE=12345678
# 修改為
GATEWAY=192.168.10.1
SID=chenredian
PASSPHRASE=12345678
6.命令
# 啟動一個服務:
systemctl start create_ap.service
# 關閉一個服務:
systemctl stop create_ap.service
# 重啟一個服務:
systemctl restart create_ap.service
# 顯示一個服務的狀態:
systemctl status create_ap.service
# 在開機時啟用一個服務:
systemctl enable create_ap.service
# 在開機時禁用一個服務:
systemctl disable create_ap.service
# 查看服務是否開機啟動:
systemctl is-enabled create_ap.service
?7.異常問題:
異常一: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
sudo nmcli dev dis wlan0
異常二:
sudo create_ap wlan0 eth0 my_raspi 88166908
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 WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Config dir: /tmp/create_ap.wlan0.conf.cDxIozig PID: 1132 Network Manager found, set wlan0 as unmanaged device... DONE/bin/create_ap: line 1669: dnsmasq: command not found
ERROR: Wrong version format!
sudo yum install dnsmasq -y
異常三:
sudo create_ap wlan0 eth0 my_raspi 12345678
WARN: brmfmac driver doesn't work properly with virtual interfaces andit 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 WARN: Your adapter does not fully support AP virtual interface, enabling --no-virt Config dir: /tmp/create_ap.wlan0.conf.gC5KSqVQ PID: 2497 Sharing Internet using method: nat hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlan0.conf.gC5KSqVQ/hostapd_ctrl Configuration file: /tmp/create_ap.wlan0.conf.gC5KSqVQ/hostapd.conf
sudo create_ap --no-virt wlan0 eth0 my_raspi 12345678