我正在尝试使用 NanoPi M1+ 设备制作 WiFi 路由器。它将有两种工作模式,即 Eth<-->WiFi 和 WiFi<-->WiFi。
我可以完美地执行第一种模式,但是第二种模式(即设备必须作为站和接入点工作)让我很麻烦。
NanoPi 设备具有内置 WiFi 芯片组,我正在使用附加 WiFi 适配器来实现另一种模式。
问题是,设备无法显示第二个 WLAN 接口。使用 iw 手动添加接口时会抛出错误。
我在下面包含了命令的输出。
ifconfig:
eth0 Link encap:Ethernet HWaddr 02:81:c7:86:31:ec
inet addr:192.168.55.227 Bcast:192.168.55.255 Mask:255.255.255.0
inet6 addr: fe80::7f3c:fbbd:4f8a:34b4/64 Scope:Link
inet6 addr: fc00::74dd:b4f:9f39:8b36/64 Scope:Global
inet6 addr: fc00::c1ed:d2fc:ae81:f2c0/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4987 errors:0 dropped:0 overruns:0 frame:0
TX packets:2008 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3871199 (3.8 MB) TX bytes:160738 (160.7 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:614 errors:0 dropped:0 overruns:0 frame:0
TX packets:614 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:64279 (64.2 KB) TX bytes:64279 (64.2 KB)
wlan0 Link encap:Ethernet HWaddr b0:f1:ec:2c:ea:c6
inet6 addr: fe80::b2f1:ecff:fe2c:eac6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:1 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:542 (542.0 B) TX bytes:1130 (1.1 KB)
wlan0 接口应工作于接入点模式,wlan1 接口应工作于站模式。
/etc/network/interfaces:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet static
address 172.24.1.1
netmask 255.255.255.0
network 172.24.1.0
broadcast 172.24.1.255
allow-hotplug wlan1
iface wlan1 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
hostapd 文件:
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
beacon_int=100
auth_algs=1
#wpa_key_mgmt=WPA-PSK
ssid=test02c00081c78631ec
channel=7
hw_mode=g
#wpa_passphrase=raspberry
interface=wlan0
#wpa=2
#wpa_pairwise=TKIP
country_code=IN
dnsmasq.conf 文件:
domain-needed
interface=wlan0
except-interface=lo
dhcp-range=192.168.41.10,192.168.41.150,255.255.255.0,12h
#address=/#/192.168.41.1
#server=/192.168.0.245/8.8.8.8
log-dhcp
log-queries
log-facility=/tmp/dnsmasq.log
在系统盘,显示网络适配器,Realtek Semiconductor Corp. RTL8188EUS 802.11n 无线网络适配器
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 020: ID 413c:2113 Dell Computer Corp.
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
做事时:
iw dev wlan0 interface add wlan1 type station flags none
引发错误:
command failed: Operation not supported (-95)
我添加了 wlan1 作为接口/etc/udev/rules.d/70-persistent-net.rules文件,但仍然无法识别wlan1。
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="C0-25-E9-25-AB-14", NAME=="wlan1"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="b0:f1:ec:2c:ea:c6", NAME=="wlan0"
请告诉我遗漏了什么以及如何添加 wlan1 作为接口?