hostapd:用于创建 WiFi 热点dnsmasq:提供 DNS 和 DHCP 服务git:用于下载create_ap工具
sudo apt update &&
sudo apt upgrade -y
sudo apt install -y hostapd dnsmasq git
若已经有 create_ap 命令 可跳过
# 克隆仓库
git clone https://github.com/oblique/create_ap.git
cd create_ap
# 安装工具
sudo make install
查看系统中的无线网卡(通常为 wlan0 或 wlx 开头):
找到类似 wlan0 的无线接口名称(确保你的 Orange Pi 5 Max 已安装 WiFi 驱动,能识别无线网卡)。
ip link show
确认有线网卡名称(用于共享网络,通常为 eth0或lo):
ip -br addr show
基本命令格式(替换为你的信息):
sudo create_ap [无线网卡] [有线网卡] [热点名称] [热点密码]
示例(假设无线网卡为 wlan0,有线网卡为 eth0):
sudo create_ap wlan0 eth0 OrangePi_Hotspot 12345678
热点名称:OrangePi_Hotspot(可自定义)
密码:12345678(至少 8 位,可自定义)
先停止当前运行的热点(按 Ctrl+C)。
创建系统服务实现自启:
创建服务文件
sudo nano /etc/systemd/system/orangepi-hotspot.service
粘贴以下内容(根据你的网卡和热点信息修改):
[Unit]
Description=Orange Pi WiFi Hotspot
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/create_ap wlan0 eth0 OrangePi_Hotspot 12345678
Restart=always
[Install]
WantedBy=multi-user.target
启用并启动服务:
sudo systemctl enable orangepi-hotspot
sudo systemctl start orangepi-hotspot
热点启动失败:
检查无线网卡是否被占用(如已连接其他 WiFi),先断开:
sudo nmcli device disconnect wlan0
确认 hostapd 服务未冲突:
sudo systemctl stop hostapd
设备无法连接:
密码长度是否至少 8 位
尝试更换信道:
sudo create_ap wlan0 eth0 OrangePi_Hotspot 12345678 --channel 6
无网络访问:
确认有线网卡 eth0 已连接互联网
检查 IP 转发是否开启:
sudo sysctl -w net.ipv4.ip_forward=1
