![将 wlan0 连接到桥接接口(然后将其移除)后,无法连接到 AP](https://linux22.com/image/1410032/%E5%B0%86%20wlan0%20%E8%BF%9E%E6%8E%A5%E5%88%B0%E6%A1%A5%E6%8E%A5%E6%8E%A5%E5%8F%A3%EF%BC%88%E7%84%B6%E5%90%8E%E5%B0%86%E5%85%B6%E7%A7%BB%E9%99%A4%EF%BC%89%E5%90%8E%EF%BC%8C%E6%97%A0%E6%B3%95%E8%BF%9E%E6%8E%A5%E5%88%B0%20AP.png)
我在一台运行 Debian Jessie 的笔记本电脑上,内核是 3.13-1-amd64;lspci 显示我的无线网卡 + 驱动程序
04:00.0 Network controller: Intel Corporation Wireless 3160 (rev 83)
Subsystem: Intel Corporation Dual Band Wireless-AC 3160
Kernel driver in use: iwlwifi
一切运行正常,没有任何问题,直到我尝试为 lxc 容器创建一个桥梁。我做了和这个人一样的事情:如何在笔记本电脑上设置网桥以供 LXC 使用?——最终遇到了和这位发帖者一样的问题,所以我决定“撤消”我的操作。
这还没有成功。
迄今采取的行动:
要配置网桥:
#> ip link add type veth
#> iw dev wlan0 set 4addr on
#> ifconfig veth0 up
#> brctl addbr br0
#> brctl addif br0 wlan0
#> brctl addif br0 veth0
#> ifconfig br0 192.168.0.4/24
#> ifconfig wlan0 0.0.0.0
要“取消配置”:
#> brctl delif br0 wlan0
#> brctl delif br0 veth0
#> iw dev wlan0 set 4addr off
#> ifconfig veth0 down
#> ifconfig wlan0 down
#> ifconfig br0 down
#> brctl delbr br0
现在,dmesg 和 /var/log/syslog 显示重复尝试连接之前正常工作的 AP,但在身份验证后失败:
May 27 09:16:01 myhostname kernel: [11350.757172] wlan0: authenticate with 00:18:f8:54:a3:d6
May 27 09:16:01 myhostname kernel: [11350.759036] wlan0: send auth to 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:01 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: scanning -> authenticating
May 27 09:16:01 myhostname wpa_supplicant[8946]: wlan0: Trying to associate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:01 myhostname kernel: [11350.762615] wlan0: authenticated
May 27 09:16:01 myhostname kernel: [11350.762753] iwlwifi 0000:04:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP
May 27 09:16:01 myhostname kernel: [11350.762755] iwlwifi 0000:04:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP
May 27 09:16:01 myhostname kernel: [11350.765080] wlan0: associate with 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:01 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: authenticating -> associating
May 27 09:16:01 myhostname kernel: [11350.767474] wlan0: RX AssocResp from 00:18:f8:54:a3:d6 (capab=0x411 status=12 aid=0)
May 27 09:16:01 myhostname kernel: [11350.767476] wlan0: 00:18:f8:54:a3:d6 denied association (code=12)
May 27 09:16:01 myhostname wpa_supplicant[8946]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:18:f8:54:a3:d6 status_code=12
May 27 09:16:01 myhostname kernel: [11350.788475] wlan0: deauthenticating from 00:18:f8:54:a3:d6 by local choice (reason=3)
May 27 09:16:01 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: associating -> disconnected
May 27 09:16:01 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: disconnected -> scanning
May 27 09:16:02 myhostname dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
May 27 09:16:04 myhostname wpa_supplicant[8946]: wlan0: SME: Trying to authenticate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:04 myhostname kernel: [11354.559579] wlan0: authenticate with 00:18:f8:54:a3:d6
May 27 09:16:04 myhostname kernel: [11354.561458] wlan0: send auth to 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:04 myhostname wpa_supplicant[8946]: wlan0: Trying to associate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:04 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: scanning -> associating
May 27 09:16:04 myhostname kernel: [11354.563445] wlan0: authenticated
May 27 09:16:04 myhostname kernel: [11354.563631] iwlwifi 0000:04:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP
May 27 09:16:04 myhostname kernel: [11354.563633] iwlwifi 0000:04:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP
May 27 09:16:04 myhostname kernel: [11354.565727] wlan0: associate with 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:04 myhostname wpa_supplicant[8946]: wlan0: Associated with 00:18:f8:54:a3:d6
May 27 09:16:04 myhostname kernel: [11354.568091] wlan0: RX AssocResp from 00:18:f8:54:a3:d6 (capab=0x411 status=0 aid=9)
May 27 09:16:04 myhostname kernel: [11354.569030] wlan0: associated
May 27 09:16:04 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: associating -> associated
May 27 09:16:05 myhostname kernel: [11354.978204] wlan0: deauthenticated from 00:18:f8:54:a3:d6 (Reason: 15)
May 27 09:16:05 myhostname wpa_supplicant[8946]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:18:f8:54:a3:d6 reason=15
May 27 09:16:05 myhostname kernel: [11354.992729] cfg80211: Calling CRDA to update world regulatory domain
May 27 09:16:05 myhostname kernel: [11354.995004] cfg80211: World regulatory domain updated:
May 27 09:16:05 myhostname kernel: [11354.995005] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
May 27 09:16:05 myhostname kernel: [11354.995006] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)
May 27 09:16:05 myhostname kernel: [11354.995007] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
May 27 09:16:05 myhostname kernel: [11354.995007] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm)
May 27 09:16:05 myhostname kernel: [11354.995008] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
May 27 09:16:05 myhostname kernel: [11354.995009] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm)
May 27 09:16:05 myhostname kernel: [11354.995010] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm)
May 27 09:16:05 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: associated -> disconnected
May 27 09:16:05 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: disconnected -> scanning
May 27 09:16:09 myhostname wpa_supplicant[8946]: wlan0: SME: Trying to authenticate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:09 myhostname kernel: [11358.763968] wlan0: authenticate with 00:18:f8:54:a3:d6
May 27 09:16:09 myhostname kernel: [11358.765796] wlan0: send auth to 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:09 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: scanning -> authenticating
May 27 09:16:09 myhostname wpa_supplicant[8946]: wlan0: Trying to associate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:09 myhostname kernel: [11358.769957] wlan0: authenticated
May 27 09:16:09 myhostname kernel: [11358.770102] iwlwifi 0000:04:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP
May 27 09:16:09 myhostname kernel: [11358.770104] iwlwifi 0000:04:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP
May 27 09:16:09 myhostname kernel: [11358.770846] wlan0: associate with 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:09 myhostname kernel: [11358.773358] wlan0: RX AssocResp from 00:18:f8:54:a3:d6 (capab=0x411 status=12 aid=0)
May 27 09:16:09 myhostname kernel: [11358.773361] wlan0: 00:18:f8:54:a3:d6 denied association (code=12)
May 27 09:16:09 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: authenticating -> associating
May 27 09:16:09 myhostname wpa_supplicant[8946]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:18:f8:54:a3:d6 status_code=12
May 27 09:16:09 myhostname kernel: [11358.802187] wlan0: deauthenticating from 00:18:f8:54:a3:d6 by local choice (reason=3)
May 27 09:16:09 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: associating -> disconnected
May 27 09:16:09 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: disconnected -> scanning
May 27 09:16:12 myhostname wpa_supplicant[8946]: wlan0: SME: Trying to authenticate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:12 myhostname kernel: [11362.573442] wlan0: authenticate with 00:18:f8:54:a3:d6
May 27 09:16:12 myhostname kernel: [11362.575270] wlan0: send auth to 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:12 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: scanning -> authenticating
May 27 09:16:12 myhostname wpa_supplicant[8946]: wlan0: Trying to associate with 00:18:f8:54:a3:d6 (SSID='myaccesspoint' freq=2437 MHz)
May 27 09:16:12 myhostname kernel: [11362.580334] wlan0: authenticated
May 27 09:16:12 myhostname kernel: [11362.580503] iwlwifi 0000:04:00.0 wlan0: disabling HT as WMM/QoS is not supported by the AP
May 27 09:16:12 myhostname kernel: [11362.580516] iwlwifi 0000:04:00.0 wlan0: disabling VHT as WMM/QoS is not supported by the AP
May 27 09:16:12 myhostname kernel: [11362.583508] wlan0: associate with 00:18:f8:54:a3:d6 (try 1/3)
May 27 09:16:12 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: authenticating -> associating
May 27 09:16:12 myhostname wpa_supplicant[8946]: wlan0: Associated with 00:18:f8:54:a3:d6
May 27 09:16:12 myhostname kernel: [11362.585908] wlan0: RX AssocResp from 00:18:f8:54:a3:d6 (capab=0x411 status=0 aid=9)
May 27 09:16:12 myhostname kernel: [11362.586781] wlan0: associated
May 27 09:16:12 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: associating -> associated
May 27 09:16:13 myhostname kernel: [11362.947693] wlan0: deauthenticated from 00:18:f8:54:a3:d6 (Reason: 15)
May 27 09:16:13 myhostname wpa_supplicant[8946]: wlan0: CTRL-EVENT-DISCONNECTED bssid=00:18:f8:54:a3:d6 reason=15
May 27 09:16:13 myhostname kernel: [11362.973461] cfg80211: Calling CRDA to update world regulatory domain
May 27 09:16:13 myhostname kernel: [11362.975673] cfg80211: World regulatory domain updated:
May 27 09:16:13 myhostname kernel: [11362.975675] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
May 27 09:16:13 myhostname kernel: [11362.975676] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm)
May 27 09:16:13 myhostname kernel: [11362.975677] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
May 27 09:16:13 myhostname kernel: [11362.975678] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm)
May 27 09:16:13 myhostname kernel: [11362.975678] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
May 27 09:16:13 myhostname kernel: [11362.975679] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm)
May 27 09:16:13 myhostname kernel: [11362.975679] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm)
May 27 09:16:13 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: associated -> disconnected
May 27 09:16:13 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: disconnected -> scanning
May 27 09:16:14 myhostname NetworkManager[13992]: <warn> Activation (wlan0/wireless): association took too long.
May 27 09:16:14 myhostname NetworkManager[13992]: <info> (wlan0): device state change: config -> failed (reason 'no-secrets') [50 120 7]
May 27 09:16:14 myhostname NetworkManager[13992]: <info> Marking connection 'Auto myaccesspoint' invalid.
May 27 09:16:14 myhostname NetworkManager[13992]: <warn> Activation (wlan0) failed for connection 'Auto myaccesspoint'
May 27 09:16:14 myhostname NetworkManager[13992]: <info> (wlan0): device state change: failed -> disconnected (reason 'none') [120 30 0]
May 27 09:16:14 myhostname NetworkManager[13992]: <info> (wlan0): deactivating device (reason 'none') [0]
May 27 09:16:14 myhostname NetworkManager[13992]: <info> (wlan0): supplicant interface state: scanning -> disconnected
让我印象深刻的是“根据本地选择取消身份验证......(原因=3)”以及包含“(原因=15)”的行。
我尝试过各种修复方法:
- iwconfig wlan0 关闭电源
- 终止 wpa_supplicant
- 使用 iwconfig + dhclient 连接,而不是使用 gnome 的网络管理器
- 在 /etc/network/interfaces 中明确配置 wlan0
- 创建 /etc/wpa_supplicant.conf 文件
...但似乎没有什么效果。
我不确定我做错了什么,或者在尝试将 wlan0 重新恢复为非桥接设备时我跳过了什么步骤——我将它从桥接器中移除,然后删除了桥接器本身。
有任何想法吗?
答案1
这行不通,因为您无法将无线接口与虚拟接口桥接起来。有一种方法可以解决这个问题,我稍后会告诉您如何做到这一点。
首先,关于你目前的问题:你试过关掉机器然后再打开吗?你所做的一切都不是永久的,所以,如果你真的感到绝望,重启肯定有效。
我不确定你的问题到底是什么。删除网桥后,你应该删除 veth 接口,
ip link del dev veth0 type veth
取消配置你的 wlan0 接口,
ip link set wlan0 down
ip addr flush dev wlan0
再次提起,
ip link set dev wlan0 up
然后让网络管理器发挥它的魔力
service network-manager start.
就像我之前说的,重启电脑肯定有效。另外,非常重要的一点是,你不应该使用过时的,已弃用命令,如 *ifconfig、brctl** 等。iproute2套件包含所有这些命令,包括设置虚拟接口(我们曾经不得不使用 openvpn 来实现)和创建网桥。如果你不知道如何使用知识产权, 开始了:
ip tuntap add tap0 mode tap user root
ip link set tap0 up
ip link add br0 type bridge
ip link set tap0 master br0
ip link set eth0 master br0
ip addr add 10.173.10.1/24 dev br0
ip link set br0 up
通过这组命令,我们创建了一个名为tap0,然后一座桥叫br0,然后奴役eth0和tap0连接到网桥,我们为其分配 IP 地址 10.173.10.1,然后将其全部启动。需要三个单独的实例来启动接口(用于 tap0、eth0 和 br0)。
至于你的问题。实现此问题的诀窍是使用 proxy.arp,它允许你的 PC (不是您的虚拟机/Linux 容器/网络命名空间)来回答 ARP 查询他们的代替。
换句话说,通过在硬件接口和虚拟接口之间使用 IPv4 转发,您认为可以将 VM/LXC/NNS 连接到 LAN,就像它是物理接口一样,但事实并非如此:您忘记了绝对基本的 ARP 流量,而这才是真正允许 LAN 运行的。因此,问题是:如果我正确转发 IPv4 流量,我如何转发 ARP 流量,以便我的 VM/LXC/NNS 正常工作?诀窍是使用代理 arp。
完整答案在Bohdi Zazen 的博客,标题颇具启发性:桥接无线网卡。他使用了一个过时的软件包,uml 实用程序,通过命令创建虚拟接口隧道:这是他使用的唯一命令uml 实用程序,这样你就可以放心地忽略下载软件包,并使用我上面写的命令创建一个轻敲或者屯接口,无论您喜欢哪个,只需相应地修改命令即可。然后为您的 LXC 创建一个 veth 对,现在在 tap0 和 veth0 之间创建一个桥接。这个桥称为 br0,是您必须代理arp而不是 Bohdi Zazen 描述的简单的 tap0 接口。