我正在尝试将两个 wifi USB 适配器连接到 debian 系统。一种是连接到本地局域网,另一种是我计划在 adhoc 模式下使用来连接到特定设备。您可以将此视为尝试将两个 wifi 适配器连接到 Linux 设备,以同时连接到两个单独的 wifi 网络。
USB 设备似乎可以正确识别,没有任何问题。 ifconfig 报告 wlan0 并且我能够设置 /etc/network/interfaces,以便它正确配置并通过我的接入点连接到我的 LAN。
我的 /etc/network/interfaces 是:
auto wlan0
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
wpa-conf /etc/wpa.config
我的/etc/wpa.config是:
ap_scan=1
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="###"
psk="##########"
}
两个 USB wifi 适配器是相同的(华硕 EX N),第一个被识别并且我可以配置(如上所述),而第二个被检测到但不被识别为 LAN 设备。通过使用 dmesg 进行实验,我可以找到每个 USB 设备的以下信息:
dmesg | grep“usb1”
[ 1.841842] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 1.850929] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.860403] usb usb1: Product: DWC OTG Controller
[ 1.867357] usb usb1: Manufacturer: Linux 3.2.27+ dwc_otg_hcd
[ 1.875306] usb usb1: SerialNumber: bcm2708_usb
dmesg | grep "1-1:"
[ 2.343158] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.563416] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.572622] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.583814] hub 1-1:1.0: USB hub found
[ 2.591025] hub 1-1:1.0: 3 ports detected
dmesg | grep "1-1.1:"
[ 2.873414] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 2.983730] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 2.995145] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 3.078641] smsc95xx 1-1.1:1.0: eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:e8:9f:ac
[ 24.257871] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
dmesg | grep "1-1.2:"
[ 3.193382] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[ 3.306387] usb 1-1.2: New USB device found, idVendor=0b05, idProduct=1786
[ 3.319133] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.329079] usb 1-1.2: Product: ASUS EZ N Network Adapter
[ 3.340862] usb 1-1.2: Manufacturer: Manufacturer Realtek
[ 3.349052] usb 1-1.2: SerialNumber: 00e04c000001
我尝试过谷歌搜索,但找不到有关将两个 wifi 适配器连接到设备的任何信息。我怀疑我必须以某种方式应用驱动程序(显然已经可用)并使 wlan1 出现,一旦出现,我就能够弄清楚其余的事情。任何帮助,将不胜感激。
根据要求添加了额外信息:
lsusb:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0b05:1786 ASUSTek Computer, Inc. USB-N10 802.11n Network Adapter [Realtek RTL8188SU]
/var/log/messages(示例,假设这是相关的):
[ 13.057545] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[ 13.500489] r8712u: DriverVersion: v7_0.20100831
[ 13.783452] r8712u: register rtl8712_netdev_ops to netdev_ops
[ 13.791591] r8712u: USB_SPEED_HIGH with 4 endpoints
[ 14.027050] r8712u: Boot from EFUSE: Autoload OK
[ 15.017889] r8712u: CustomerID = 0x0010
[ 15.024091] r8712u: MAC Address from efuse = 30:85:a9:6e:a6:bb
[ 15.032267] r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
...
[ 30.073530] r8712u: 1 RCR=0x153f00e
[ 30.074269] r8712u: 2 RCR=0x553f00e
...
[ 38.336980] r8712u: [r8712_got_addbareq_event_callback] mac = 58:6d:8f:00:37:45, seq = 0, tid = 0
mac addy 30:85:a9:6e:a6:bb 与 ifconfig 中的匹配,因此我推测 r8712u 是用于被识别的 ASUS EX N 的。ifconfig -a
:
eth0 Link encap:Ethernet HWaddr b8:27:eb:e8:9f:ac
inet addr:192.168.1.132 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:656 errors:0 dropped:0 overruns:0 frame:0
TX packets:453 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:59529 (58.1 KiB) TX bytes:105486 (103.0 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 30:85:a9:6e:a6:bb
inet addr:192.168.1.117 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:418 errors:0 dropped:1 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:111070 (108.4 KiB) TX bytes:1308 (1.2 KiB)
请注意,虽然我是一位经验丰富的 Unix/Linux 用户,但我对内核和驱动程序并不是很有经验。所以请耐心等待我。
更多信息:
尝试用闪存驱动器替换第二个 WiFi 加密狗。效果很好。查看消息,我可以看到它检测到 USB 1-1.3,但它没有检测到我是否有第二个 wifi 适配器。
[ 9.443324] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[ 9.945760] usb 1-1.3: New USB device found, idVendor=090c, idProduct=1000
[ 9.963268] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 9.976352] usb 1-1.3: Product: USB DISK
[ 9.982674] usb 1-1.3: Manufacturer: SMI Corporation
[ 9.992819] scsi0 : usb-storage 1-1.3:1.0
更多信息:
我决定切换到将可工作的 WiFi 适配器移至另一个 USB 端口,然后决定插入另一个。有趣的是lsusb
现在指出:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0b05:1786 ASUSTek Computer, Inc. USB-N10 802.11n Network Adapter [Realtek RTL8188SU]
Bus 001 Device 005: ID 0b05:1786 ASUSTek Computer, Inc. USB-N10 802.11n Network Adapter [Realtek RTL8188SU]
所以它现在似乎检测到了两者(不知道为什么这与以前不同)。奇怪的是 wlan1 没有自动出现,不知道为什么。我/var/log/messages
现在看到:
[ 3.173177] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[ 3.296059] usb 1-1.2: New USB device found, idVendor=0b05, idProduct=1786
[ 3.305833] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.320060] usb 1-1.2: Product: ASUS EZ N Network Adapter
[ 3.331367] usb 1-1.2: Manufacturer: Manufacturer Realtek
[ 3.343032] usb 1-1.2: SerialNumber: 00e04c000001
[ 3.443224] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[ 3.566236] usb 1-1.3: New USB device found, idVendor=0b05, idProduct=1786
[ 3.575638] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 3.585429] usb 1-1.3: Product: ASUS EZ N Network Adapter
[ 3.593239] usb 1-1.3: Manufacturer: Manufacturer Realtek
[ 3.601034] usb 1-1.3: SerialNumber: 00e04c000001
...
[ 11.713221] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[ 11.728515] r8712u: module is from the staging directory, the quality is unknown, you have been warned.
[ 12.124771] r8712u: DriverVersion: v7_0.20100831
[ 12.131967] r8712u: register rtl8712_netdev_ops to netdev_ops
[ 12.550340] r8712u: USB_SPEED_HIGH with 4 endpoints
[ 12.691051] r8712u: Boot from EFUSE: Autoload OK
[ 13.716918] r8712u: CustomerID = 0x0010
[ 13.723264] r8712u: MAC Address from efuse = 30:85:a9:6e:a6:c9
[ 13.731529] r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
[ 13.740279] r8712u: DriverVersion: v7_0.20100831
[ 13.750556] r8712u: register rtl8712_netdev_ops to netdev_ops
[ 13.760178] r8712u: USB_SPEED_HIGH with 4 endpoints
[ 13.774319] r8712u: Boot from EFUSE: Autoload OK
[ 14.532517] r8712u: CustomerID = 0x0010
[ 14.538717] r8712u: MAC Address from efuse = 30:85:a9:6e:a6:bb
[ 14.546902] r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
...
[ 32.273631] r8712u: 1 RCR=0x153f00e
[ 32.274494] r8712u: 2 RCR=0x553f00e
通过ifconfig
我只看到 wlan1 而不是 wlan0。很奇怪...
更改ifconfig
为ifconfig -a
上面,输出是相同的(wlan1 未显示)。如果我ifconfig wlan1
这样做,我会得到:
wlan1: error fetching interface information: Device not found
当我交换它们并lsusb
显示所有五个 USB 设备(上面列出)时,当我执行 a 时,ifconfig -a
我同时得到 wlan0 和 wlan1:
eth0 Link encap:Ethernet HWaddr b8:27:eb:e8:9f:ac
inet addr:192.168.1.132 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:117 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12685 (12.3 KiB) TX bytes:12594 (12.2 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 30:85:a9:6e:a6:bb
inet addr:192.168.1.117 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:1 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5674 (5.5 KiB) TX bytes:1098 (1.0 KiB)
wlan1 Link encap:Ethernet HWaddr 30:85:a9:6e:a6:c9
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
并执行 aifconfig wlan1
显示 wlan1 信息,如上所示。
ip link show
在交换的 USB 设备配置中显示:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether b8:27:eb:e8:9f:ac brd ff:ff:ff:ff:ff:ff
3: wlan1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 1000
link/ether 30:85:a9:6e:a6:c9 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT qlen 1000
link/ether 30:85:a9:6e:a6:bb brd ff:ff:ff:ff:ff:ff
答案1
我使用的设备似乎不喜欢按我连接的顺序连接的两个 wifi 适配器。颠倒它们的连接顺序会导致两个 wifi 适配器都被识别(如通过 所示lsusb
),然后通过 进行配置/etc/network/interfaces
,之后可以通过 启动它们ifup wlan1
。
最终/etc/network/interfaces
有效的条目是:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa.config
auto wlan1
iface wlan1 inet dhcp
wireless-essid ardrone_3
结果ifconfig
是:
eth0 Link encap:Ethernet HWaddr b8:27:eb:e8:9f:ac
inet addr:192.168.1.132 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5111 errors:0 dropped:0 overruns:0 frame:0
TX packets:3001 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:431610 (421.4 KiB) TX bytes:552794 (539.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 30:85:a9:6e:a6:bb
inet addr:192.168.1.117 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4743 errors:0 dropped:1 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1322366 (1.2 MiB) TX bytes:1309 (1.2 KiB)
wlan1 Link encap:Ethernet HWaddr 30:85:a9:6e:a6:c9
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2420 (2.3 KiB) TX bytes:1476 (1.4 KiB)
可以看到,两个wifi设备都在工作并且都收到了IP地址。
看来问题不是 debian 的配置问题,而是硬件问题,需要交换两个设备。
非常感谢 Gert van den Berg 和用户 1129682 对我的耐心。