我目前正在尝试从 arch-linux 共享无线网络。网络设置中有一个按钮可以让我执行此操作:
我点击了“打开”按钮,因为这正是我正在寻找的!
但在终端中使用以下命令:
$ sudo journalctl -xef
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.8790] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.8928] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.8967] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9001] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9011] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9019] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9029] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9037] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9046] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9055] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch NetworkManager[477]: <info> [1478176793.9064] audit: op="connection-add-activate" pid=12673 uid=1000 result="fail" reason="A 'wireless' setting with a valid SSID is required if no AP path was given."
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
Nov 03 08:39:53 zbookarch gnome-control-c[12673]: Failed to add new connection: (2) A 'wireless' setting with a valid SSID is required if no AP path was given.
我仍在阅读这里和那里的一些文档,但除了此处某些源代码中的确切错误消息之外,我还没有找到与此错误有关的任何内容:
https://github.com/lcp/NetworkManager/blob/master/src/nm-device-wifi.c#L1211
一位朋友在 Fedora 上进行了测试,它开箱即用,他ESSID
在这里找到了与他创建的 wifi 相匹配的设置:
/etc/sysconfig/network-scripts/ifcfg-Hotspot
但我在 Arch Linux 上没有这条路径。
有arch 上的 Software_access_point wiki 页面其中可能包含一些有关如何创建热点的信息。我稍后会跟进,但如果有人有关于该错误的一些信息,那就太好了:)
我的网卡应该兼容:
$ iw list
Wiphy phy0
...
Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* monitor
* P2P-client
* P2P-GO
* P2P-device
(需要AP
)
$ lspci -k | grep -A 3 -i network
3d:00.0 Network controller: Intel Corporation Wireless 7260 (rev 6b)
Subsystem: Intel Corporation Dual Band Wireless-AC 7260
Kernel driver in use: iwlwifi
Kernel modules: iwlwifi
iwlwifi
可以找到以下列表:
| Driver | Manufacturer | cfg80211 | AP | IBSS | mesh | monitor | PHY modes | Buses |
|----------------------------------------------------|---------------------|----------|---------|------|------|---------|------------|--------------------------|
| iwlwifi | Intel | yes | yes (6) | yes | no | yes | A/B/G/N/AC | PCI-E |
看起来确实支持AP。
第一次尝试
我尝试使用 热点
我创建了一个 python2.7 virtualenv 并安装了hotspotd==0.1.4
,然后我安装了主机和dnsmasq
。
$ sudo pacman -S hostapd
$ mkvirtualenv -p $(which python27) hotspot
$ workon hotspot
$ pip install hotspotd==0.1.4
$ sudo hotspotd -h
usage: hotspotd [-h] [-v] {start,stop,configure}
A small daemon to create a wifi hotspot on linux
positional arguments:
{start,stop,configure}
optional arguments:
-h, --help show this help message and exit
-v, --verbose
$ sudo hotspotd configure
Verifying connections
Wifi interface found: wlp61s0
Network interface found: enp0s25:
Enter an IP address for your ap [192.168.45.1] :
Enter SSID [joe_ssid] :
Enter 10 digit password [1234567890] :
created hostapd configuration: run.conf
{'wlan': 'wlp61s0', 'SSID': 'joe_ssid', 'ip': '192.168.45.1', 'netmask': '255.255.255.0', 'password': '1234567890', 'inet': 'enp0s25:'}
Configuration saved
$ sudo hotspotd start -v
command: ps aux |grep hostapd |grep -v grep
Verifying interfaces
command: ifconfig
done.
created interface: mon.wlp61s0 on IP: 192.168.45.1
command: ifconfig wlp61s0 up 192.168.45.1 netmask 255.255.255.0
wait..
command: sleep 2
command: ps aux |grep dnsmasq |grep -v grep
command: ps aux |grep hostapd |grep -v grep
enabling forward in sysctl.
command: sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
creating NAT using iptables: wlp61s0<->enp0s25:
command: iptables -P FORWARD ACCEPT
command: iptables --table nat --delete-chain
command: iptables --table nat -F
command: iptables --table nat -X
command: iptables -t nat -A POSTROUTING -o enp0s25: -j MASQUERADE
command: iptables -A FORWARD -i enp0s25: -o wlp61s0 -j ACCEPT -m state --state RELATED,ESTABLISHED
command: iptables -A FORWARD -i wlp61s0 -o enp0s25: -j ACCEPT
command: iptables -A OUTPUT --out-interface wlp61s0 -j ACCEPT
command: iptables -A INPUT --in-interface wlp61s0 -j ACCEPT
running dnsmasq
command: dnsmasq --dhcp-authoritative --interface=wlp61s0 --dhcp-range=192.168.45.20,192.168.45.100,255.255.255.0,4h
running hostapd
wait..
command: sleep 2
command: hostapd -B /home/gableroux/.virtualenvs/hotspot/lib/python2.7/site-packages/hotspotd/run.conf
Configuration file: /home/gableroux/.virtualenvs/hotspot/lib/python2.7/site-packages/hotspotd/run.conf
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Could not read interface wlan0 flags: No such device
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
hostapd_free_hapd_data: Interface wlan0 wasn't started
hotspot is running.
我不知道为什么wlan0
使用它,所以我尝试编辑/home/gableroux/.virtualenvs/hotspot/lib/python2.7/site-packages/hotspotd/run.conf
,替换wlan0
为我检测到的wlp61s0
:
$ sudo hotspotd start -v
command: ps aux |grep hostapd |grep -v grep
Verifying interfaces
command: ifconfig
done.
created interface: mon.wlp61s0 on IP: 192.168.45.1
command: ifconfig wlp61s0 up 192.168.45.1 netmask 255.255.255.0
wait..
command: sleep 2
command: ps aux |grep dnsmasq |grep -v grep
command: ps aux |grep hostapd |grep -v grep
enabling forward in sysctl.
command: sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
creating NAT using iptables: wlp61s0<->enp0s25:
command: iptables -P FORWARD ACCEPT
command: iptables --table nat --delete-chain
command: iptables --table nat -F
command: iptables --table nat -X
command: iptables -t nat -A POSTROUTING -o enp0s25: -j MASQUERADE
command: iptables -A FORWARD -i enp0s25: -o wlp61s0 -j ACCEPT -m state --state RELATED,ESTABLISHED
command: iptables -A FORWARD -i wlp61s0 -o enp0s25: -j ACCEPT
command: iptables -A OUTPUT --out-interface wlp61s0 -j ACCEPT
command: iptables -A INPUT --in-interface wlp61s0 -j ACCEPT
running dnsmasq
command: dnsmasq --dhcp-authoritative --interface=wlp61s0 --dhcp-range=192.168.45.20,192.168.45.100,255.255.255.0,4h
running hostapd
wait..
command: sleep 2
command: hostapd -B /home/gableroux/.virtualenvs/hotspot/lib/python2.7/site-packages/hotspotd/run.conf
Configuration file: /home/gableroux/.virtualenvs/hotspot/lib/python2.7/site-packages/hotspotd/run.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlp61s0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlp61s0: interface state UNINITIALIZED->DISABLED
wlp61s0: AP-DISABLED
hostapd_free_hapd_data: Interface wlp61s0 wasn't started
hotspot is running.
还是没有热点。我搜索了那个错误
nl80211:无法配置驱动程序模式
我尝试了推荐的命令:
$ sudo iwconfig wlp61s0 mode master
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlp61s0 ; Invalid argument.
好吧好吧,听起来这可能是我的网卡。
在 MacOS 上这绝对更容易:/
编辑:自从我搬到 Fedora 后,我无法再重现这个问题,而且现在大部分事情都是开箱即用的。感谢您的帮助 :)
答案1
问题可能出在您的主机名上。给出一些带有句点的名称。例如:“localhost.mine”或简单的“localhost”
您可以通过 GNOME 控制中心 -> 详细信息 -> 概述 -> 设置设备名称来设置主机名。
设置好主机名后,再次创建热点。
答案2
我用了create_ap
。
pacman -S create_ap
sudo create_ap -m bridge wifi_interface ethernet_interface test_arch vinod123
注意:您将无法在主机上浏览互联网。也许我们应该使用NAT
而不是bridge
.我还没有尝试确认有关 NAT 的任何内容。
答案3
我通过nm-connection-editor
手动创建 Wi-Fi 热点连接解决了这个错误。之后,“用作热点”按钮将按预期工作。