找回密码
 注册
关于网站域名变更的通知
查看: 462|回复: 5
打印 上一主题 下一主题

用树莓派3创建AP热点出现了连接不能建立的情况

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2022-1-7 10:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x

虽然树莓派自带了一个无线网卡,但是我的任务是用外接的无线网卡去创建一个AP热点,注意是外接的,机器自带的是wlan0,我的外接无线网卡是wlan1

在此之前用我从github上获取了一个ap-hotspot的shell脚本,该脚本集合了hostapd命令和dnsmasq命令,我在上面做了一些实验所需的修改并且在笔记本电脑ubuntu系统自带的无线网卡上成功建立了AP热点并能够成功连接

但是实验是要在树莓派3上面完成的,所以我把成功实行的脚本和相关文件拷贝到了树莓派3自带系统上了,经过一系列的调试,成功在树莓派3上运行了脚本并且成功的创建了AP热点,但是当我想要用我的安卓设备连接这个热点的时候,问题出现了,手机一直在连接但是连接不上去,一直在获取ip地址,我就想着可能是dnsmasq服务出了问题,果然我去树莓派上试了试,start这个service发现
Job for dnsmasq.service failed. See 'systEMCtl status dnsmasq.service' and 'journalctl -xn' for details.
出现了这样的提示
我用这个systemctl status dnsmasq.service命令出现了这样的提示
root@raspberrypi:/# systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; disabled)
Drop-In: /run/systemd/generator/dnsmasq.service.d
└─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
Active: failed (Result: exit-code) since Sun 2018-07-01 23:27:13 JST; 43s ago
Process: 4417 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=1/FAILURE)
Process: 4413 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
Jul 01 23:27:13 raspberrypi dnsmasq[4413]: dnsmasq: syntax check OK.
Jul 01 23:27:13 raspberrypi dnsmasq[4417]: dnsmasq: junk found in command line
Jul 01 23:27:13 raspberrypi systemd[1]: dnsmasq.service: control process exited, code=exited status=1
Jul 01 23:27:13 raspberrypi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jul 01 23:27:13 raspberrypi systemd[1]: Unit dnsmasq.service entered failed state.

dnsmasq.conf文件的配置,由于我使用的是ap-hotspot脚本里面的默认配置,我并没有去修改,只不过可能在路径上有所不同
在ap-hotspot脚本里我设置成了自己的路径
dnsmasqcinfig="/home/pi/wifitest/mydnsmasq.conf"
默认配置如下
root@raspberrypi:/# cat /etc/dnsmasq.conf
bind-inteRFaces
interface=wlan1
dhcp-range=192.168.150.2,192.168.150.10,12h

系统的日志我也不大会看,只能找到这样的
日志文件
Jul 1 06:21:59 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Jul 1 06:21:59 raspberrypi dnsmasq[1119]: dnsmasq: syntax check OK.
Jul 1 06:21:59 raspberrypi dnsmasq[1123]: dnsmasq: junk found in command line
Jul 1 06:21:59 raspberrypi dnsmasq[1123]: junk found in command line
Jul 1 06:21:59 raspberrypi dnsmasq[1123]: FAILED to start up
Jul 1 06:21:59 raspberrypi systemd[1]: dnsmasq.service: control process exited, code=exited status=1
Jul 1 06:21:59 raspberrypi systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
Jul 1 06:21:59 raspberrypi systemd[1]: Dependency failed for Host and Network Name Lookups.
Jul 1 06:21:59 raspberrypi systemd[1]: Unit dnsmasq.service entered failed state.

关于网络设置,在这里
root@raspberrypi:/etc/network# cat interfaces

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

在网上查了很多资料,运行sudo dnsmasq
然后出现了 dnsmasq:unknown interface wlan1 这样的返回,但是wlan1明明是我的外接无线网卡的啊

有没有对这方面了解的大神能帮忙解惑一下子吗,到底是不是我的dnsmasq出了问题呢?因为我已经成功建立了AP能搜索得到但是就是连接不上去,这是怎么一回事呢?


  • TA的每日心情
    开心
    2022-12-27 15:07
  • 签到天数: 1 天

    [LV.1]初来乍到

    2#
    发表于 2022-1-7 11:11 | 只看该作者
    你可以试一下指定IP连接。在脚本中写入手机的IP,看看是否能连上。如果可以就是脚本问题。如果不行,可能是服务中出现了问题。

    该用户从未签到

    3#
    发表于 2022-1-7 13:09 | 只看该作者
    dnsmasq服务没有起来,导致手机通过验证后获取不了IP地址

    该用户从未签到

    4#
    发表于 2022-1-7 13:40 | 只看该作者
    查看系统(ifconfig -a), 端口wlan1的名称是否为wlan1?

    该用户从未签到

    5#
    发表于 2022-1-7 17:23 | 只看该作者
    dhcp配置里启用了一个pool,端口wlan1上有没有设置IP?例如:192.168.150.1/24

    该用户从未签到

    6#
    发表于 2022-1-14 18:37 | 只看该作者
    IP地址不对吧              
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

    推荐内容上一条 /1 下一条

    EDA365公众号

    关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

    GMT+8, 2025-6-19 06:35 , Processed in 0.078125 second(s), 23 queries , Gzip On.

    深圳市墨知创新科技有限公司

    地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

    快速回复 返回顶部 返回列表