ap-hotspot 可用,但无法连接

ap-hotspot 可用,但无法连接

我一直在搜索这个问题,但找不到任何和我情况相同的人。我正尝试使用 Ubuntu 设置 wifi 热点。我可以通过 Windows 7 做到这一点,但我的笔记本电脑没有 Win7,所以我尝试在我的笔记本电脑上创建相同的设置。

我使用的适配器是 ALFA AWUS036NHR V.2。据我所知,驱动程序已预装在 Ubuntu 中,因为它能够连接到网络。

我根据网上的各种说明设置了 ap-hotspot。

我正在使用命令

sudo ap-hotspot config

sudo ap-hotspot start

我的所有设备都可以看到网络,但是 Android 出现了身份验证错误,iPhone 一直输入“错误密码”,而树莓派则进入了“四次握手(站)”断开/重新连接循环。

当我在 Windows 7 上进行此练习时,我不得不手动强制适配器使用不同的驱动程序,直到找到一个可以用作热点的驱动程序。我担心这也可能是一个问题,但我甚至无法让我的系统从 alfa.com.tw 网站安装驱动程序。我在 HP Elitebook 8530 笔记本电脑上使用全新安装的 Ubuntu 12.04。以下是 ap-hotspot debug 的输出

sudo ap-hotspot debug
Starting Wireless Hotspot...
* Stopping DNS forwarder and DHCP server dnsmasq
* (not running)
update-rc.d: warning: hostapd start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: hostapd stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
Disabling system startup links for /etc/init.d/hostapd ...
Removing any system startup links for /etc/init.d/hostapd ...
/etc/rc0.d/K20hostapd
/etc/rc1.d/K20hostapd
/etc/rc2.d/K80hostapd
/etc/rc3.d/K80hostapd
/etc/rc4.d/K80hostapd
/etc/rc5.d/K80hostapd
/etc/rc6.d/K20hostapd
Adding system startup for /etc/init.d/hostapd ...
/etc/rc0.d/K20hostapd -> ../init.d/hostapd
/etc/rc1.d/K20hostapd -> ../init.d/hostapd
/etc/rc6.d/K20hostapd -> ../init.d/hostapd
/etc/rc2.d/K80hostapd -> ../init.d/hostapd
/etc/rc3.d/K80hostapd -> ../init.d/hostapd
/etc/rc4.d/K80hostapd -> ../init.d/hostapd
/etc/rc5.d/K80hostapd -> ../init.d/hostapd
update-rc.d: warning: dnsmasq start runlevel arguments (none) do not match LSB Default-Start values (2 3 4 5)
update-rc.d: warning: dnsmasq stop runlevel arguments (none) do not match LSB Default-Stop values (0 1 6)
Disabling system startup links for /etc/init.d/dnsmasq ...
Removing any system startup links for /etc/init.d/dnsmasq ...
/etc/rc0.d/K85dnsmasq
/etc/rc1.d/K85dnsmasq
/etc/rc2.d/K85dnsmasq
/etc/rc3.d/K85dnsmasq
/etc/rc4.d/K85dnsmasq
/etc/rc5.d/K85dnsmasq
/etc/rc6.d/K85dnsmasq
Adding system startup for /etc/init.d/dnsmasq ...
/etc/rc0.d/K85dnsmasq -> ../init.d/dnsmasq
/etc/rc1.d/K85dnsmasq -> ../init.d/dnsmasq
/etc/rc6.d/K85dnsmasq -> ../init.d/dnsmasq
/etc/rc2.d/K85dnsmasq -> ../init.d/dnsmasq
/etc/rc3.d/K85dnsmasq -> ../init.d/dnsmasq
/etc/rc4.d/K85dnsmasq -> ../init.d/dnsmasq
/etc/rc5.d/K85dnsmasq -> ../init.d/dnsmasq
* Restarting DNS forwarder and DHCP server configuration syntax check
...fail!
net.ipv4.ip_forward = 1
Wireless Hotspot active

我对此还不太熟悉,所以我不知道哪里出了问题,但似乎有很多问题。如果需要更多信息,请告诉我。

答案1

简短回答:你可能还有另一个dnsmasq正在运行的实例。因此,终止所有实例:

编辑1(感谢Andrea):

$ sudo killall dnsmasq

原始答案:

$ sudo netstat -taunp | grep -w LISTEN | grep dnsmasq | awk '{print $7}' | sed -r "s/([0-9]+).*/\1/" | xargs kill -9

并尝试再次启动热点:

$ sudo ap-hotspot debug

Starting Wireless Hotspot...
* Stopping DNS forwarder and DHCP server dnsmasq
* (not running)

[...]

* Restarting DNS forwarder and DHCP server dnsmasq
...done.
net.ipv4.ip_forward = 1
Wireless Hotspot active

答案2

您需要取消注释以下行/etc/sysctl.conf

net.ipv4.ip_forward=1

然后重新启动,一切都应该正常工作。

答案3

您可以使用 Ubuntu 的内置热点功能。只需进入网络并进入无线,然后单击开始使用热点。它对我来说可以连接 Win 笔记本电脑、Android 设备和掌上设备。

您还可以更改网络连接中的各种其他设置并编辑网络类型

网络设置

相关内容