Ubuntu 使用 create_ap 开启 wifi 热点教程
1. create\_ap 获取/安装
git clone https://github.com/oblique/create_ap.git
cd create_ap
sudo make install
2. 获取 wlan/wireless 名字
$ ifconfig
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.192.86.102 netmask 255.255.252.0 broadcast 10.192.87.255
inet6 fe80::aa92:4e32:da10:c75b prefixlen 64 scopeid 0x20<link>
ether 8c:16:45:b6:2e:37 txqueuelen 1000 (Ethernet)
RX packets 5798892 bytes 4354196578 (4.3 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1235123 bytes 187528025 (187.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xf2400000-f2420000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 61636 bytes 31703986 (31.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 61636 bytes 31703986 (31.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp5s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 30:24:32:45:ec:14 txqueuelen 1000 (Ethernet)
RX packets 1882722 bytes 1462883461 (1.4 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 904250 bytes 817127178 (817.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
如某笔记本
- wlan:
enp0s31f6
- wireless:
wlp5s0
3. 测试create\_ap 是否工作正常
create_ap 基本命令格式:
create_ap wlan0 eth0 MyAccessPoint MyPassPhrase
本机指令
create_ap wlp5s0 enp0s31f6 Thinkpad 20212021
正常就会创建一个名为Thinkpad
的 wifi热点, 密码为 20212021
- 常见错误
如ERROR: Failed to initialize lock
需要rm /tmp/create_ap.all.lock
4. 配置 create\_ap
/etc/create_ap.conf
/etc/create_ap.conf 配置如下项
WIFI_IFACE=wlp1s0 #wireless 网卡名
INTERNET_IFACE=wlp1s0 #wlan 网卡名
SSID=Thinkpad #要建立的热点名称
PASSPHRASE=20212021 #密码
5. 开启关闭命令
sudo systemctl start create_ap # 开启 wifi 热点
sudo systemctl stop create_ap # 关闭 wifi 热点
6. 查看 wifi 热点连接情况
- 查看创建的热点
$ create_ap --list-running
List of running create_ap instances:
329305 wlp5s0 (ap0)
====================================
- 查看连接在 ap 上的设备
create_ap --list-clients 329305 # 该id为之前创建的ap id
MAC IP Hostname
8c:c8:4b:f0:ac:f7 10.0.0.103 LAPTOP-C9UBHHB6
aa:35:e1:18:ee:37 10.0.0.14 8Plus