我的无线适配器:
lsusb | rg -i wireless
Bus 001 Device 005: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
列出我的网络接口:
iwconfig
lo no wireless extensions.
enp6s0 no wireless extensions.
wlx38a28c80c24f IEEE 802.11 Mode:Master Tx-Power=20 dBm
Retry short long limit:2 RTS thr:off Fragment thr:off
Power Management:off
安装 hostapd 并设置配置:
sudo apt-get install hostapd
sudo vim /etc/hostapd/hostapd.conf
interface=wlx38a28c80c24f
driver=nl80211
ssid=myap
hw_mode=g
channel=7
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
wmm_enabled=1
ieee80211n=1
ht_capab=[HT40-][SHORT-GI-20][SHORT-GI-40]
wpa=2
wpa_passphrase=linuxprobe
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
安装 dnsmasq 并设置配置:
sudo apt-get install dnsmasq
sudo vim /etc/dnsmasq.conf
resolv-file=/etc/resolv.dnsmasq.conf
server=/cn/114.114.114.114
server=/taobao.com/114.114.114.114
listen-address=127.0.0.1,192.168.11.1
dhcp-range=192.168.11.50,192.168.11.150,12h
dhcp-option=3,192.168.11.1
dhcp-option=6,192.168.11.1
cache-size=1024
conf-dir=/etc/dnsmasq.d
sudo vim /etc/resolv.dnsmasq.conf
nameserver 114.114.114.114
sudo vim /etc/resolv.conf
nameserver 127.0.0.1
启动服务:
sudo systemctl start dnsmasq.service
sudo systemctl start hostapd.service
现在myap
使用密码连接linuxprobe
,为什么无法通过我的 Android 手机访问接入点?
答案1
执行以下命令:
git clone https://github.com/oblique/create_ap.git
cd create_ap
sudo make install
ifconfig
enp6s0
wlx38a28c80c24f
sudo ifconfig wlx38a28c80c24f up
wlan="wlx38a28c80c24f"
eth="enp6s0"
create_ap $wlan $eth MyAccessPoint MyPassPhrase
sudo systemctl start create_ap
现在我可以从 Android 手机通过 create_ap 连接 AP 设置。