無法新增連線:(2) 如果未給予 AP 路徑,則需要具有有效 SSID 的「無線」設置

無法新增連線:(2) 如果未給予 AP 路徑,則需要具有有效 SSID 的「無線」設置

我目前正在嘗試從 arch-linux 共享無線網路。網路設定中有一個按鈕可以讓我執行此操作:

網路設定“用作熱點...”

我點擊了“打開”按鈕,因為這正是我正在尋找的!

Wi-Fi 熱點彈出視窗打開

但在終端機中使用以下命令:

$ 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 熱點連線解決了這個錯誤。之後,“用作熱點”按鈕將按預期工作。

相關內容