【EmbeddedDev】BBB&RTL8188CUS搭建wifi AP 问题整理
来源:互联网 发布:c语言课程设计单词统计 编辑:程序博客网 时间:2024/06/06 08:29
BBB&RTL8188CUS搭建wifi AP 问题整理
1.nl80211 not found.
root@beaglebone:~# iw listnl80211 not found.
解决: 需加载mac80211模块, 参考
http://forum.ubuntu.org.cn/viewtopic.php?f=116&t=479321
http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git
sudo modprobe mac80211
2.wlan0: error fetching interface information: Device not found
插上无线网卡后能识别并且挂载, 但是通过ifconfig看不到对应的网卡名
root@beaglebone:~# lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 003: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapterroot@beaglebone:/data/packages/wifi-reset#root@beaglebone:~# ifconfig -aeth0 Link encap:Ethernet HWaddr 88:c2:55:6c:1e:ed UP BROADCAST 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) Interrupt:40lo 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:56 errors:0 dropped:0 overruns:0 frame:0 TX packets:56 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:5224 (5.1 KiB) TX bytes:5224 (5.1 KiB)usb0 Link encap:Ethernet HWaddr 88:c2:55:6c:1e:e0 BROADCAST 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)root@beaglebone:/data/packages/wifi-reset# ifconfig wlan0wlan0: error fetching interface information: Device not found
解决: 需加载对应的驱动, 如RTL5370 RTL8188,而RTL8188系列可以通过8192cu
驱动来使用
sudo modprobe 8192cu
参考: https://github.com/desflynn/realtek-8192cu-concurrent-softAP#bring-up-code
3.FATAL: Module iwlwifi not found
root@beaglebone:~# uname -aLinux beaglebone 3.8.13-bone80 #1 SMP Wed Jun 15 17:03:55 UTC 2016 armv7l GNU/Linuxroot@beaglebone:sudo modprobe iwlwifi FATAL: Module iwlwifi not found
该版本内核并没有自带iwlwifi驱动,需要自行编译; 后来也没用到这个模块, 也就不再深究。
4.ifup: interface wlan0 already configured
root@beaglebone:~# ifup wlan0ifup: interface wlan0 already configured
说明wlan0已经启用; 重启过程一般先ifdown再ifup
5.nl80211 driver initialization failed.
root@beaglebone:~# sudo hostapd -d /etc/hostapd/hostapd.confrandom: Trying to read entropy from /dev/randomConfiguration file: /etc/hostapd/hostapd.confCould not open file /sys/class/net/wlan0/phy80211/name: No such file or directorynetlink: Operstate: linkmode=0, operstate=6nl80211: Set mode ifindex 4 iftype 2 (STATION)nl80211: Failed to set interface 4 to mode 2: -19 (No such device)nl80211: Try mode change after setting interface downnl80211: Set mode ifindex 4 iftype 2 (STATION)nl80211: Failed to set interface 4 to mode 2: -19 (No such device)nl80211: Interface mode change to 2 from 0 failednl80211 driver initialization failed.
解决:
1)/etc/hostapd/hostapd.conf中修改使用的driver类型
driver=nl80211
—> driver=rtl871xdrv
2)不能使用官方默认安装的hostapd版本, 具体参考–
http://www.daveconroy.com/turn-your-raspberry-pi-into-a-wifi-hotspot-with-edimax-nano-usb-ew-7811un-rtl8188cus-chipset/
http://blog.csdn.net/paul_c_v/article/details/41585483
6.modprobe: invalid option -- 'l'
modprobe: invalid option – ‘l’
这时modprobe版本的问题引起的, 具体参考:http://forum.ubuntu.org.cn/viewtopic.php?f=116&t=469088
查看所有 你正使用中的 Linux kernel 版本 能夠提供的 Linux kernel Modules:sudo ls -alRUv /lib/modules/$(uname -r)/kernel
7.ioctl[RTL_IOCTL_HOSTAPD]: Invalid argument
root@beaglebone:/data/packages# sudo hostapd /etc/hostapd/hostapd.confConfiguration file: /etc/hostapd/hostapd.confdrv->ifindex=4l2_sock_recv==l2_sock_xmit=0x0x64648+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2rtl871x_set_key_opsrtl871x_set_key_opsrtl871x_set_key_opsrtl871x_set_key_opsUsing interface wlan0 with hwaddr 00:1d:43:20:01:74 and ssid 'moxiaomomo'rtl871x_set_wps_assoc_resp_iertl871x_set_wps_beacon_iertl871x_set_wps_probe_resp_iertl871x_set_key_opsrtl871x_set_beacon_opsrtl871x_set_hidden_ssid_opsioctl[RTL_IOCTL_HOSTAPD]: Invalid argument
可以参考上面第5点, 使用其他版本的hostapd; 具体操作也可以参考这个:
https://forums.adafruit.com/viewtopic.php?f=19&t=47716 中的这部分内容
cd /tmp ##sudo wget "ftp://95.130.192.218/cn/wlan/RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip" ##(without the quotes)sudo wget "http://12244.wpc.azureedge.net/8012244/drivers/rtdrivers/cn/wlan/0001-RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip"sudo unzip RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zipcd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911cd wpa_supplicant_hostapdsudo tar -xvf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gzcd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812cd hostapdsudo makesudo make installsudo mv hostapd /usr/sbin/hostapdsudo chown root.root /usr/sbin/hostapdsudo chmod 755 /usr/sbin/hostapd
8. 创建AP后, 移动设备连接wifi时卡在 "正在获取IP地址"
原因是路由没有给移动设备分配ip地址, 一般需要开启dhcp服务;
修改/etc/dhcp/dhcpd.conf, 并且启动dhcpd
可参考: http://www.jb51.net/os/Ubuntu/388419.html
9.连上了热点, iphone手机却没有wifi信号, 安卓手机联网提示net:ERR_NAME_NOT_RESOLVED
dns配置出了问题, 首先在/etc/dhcp/dhcpd.conf中subnet部分 确定是否增加了配置option domain-name-servers
10.RTNETLINK answers: File exists
root@beaglebone:/data/packages/realtek-8192cu-concurrent-softAP# ifup wlan0RTNETLINK answers: File existsFailed to bring up wlan0.
应该是/etc/network/interfaces配置有问题,
auto wlan0 iface eth0 inet static
尝试去掉iface前的空格, 修改为:
auto wlan0iface eth0 inet static
再尝试ifdown/ifup
11.配置wlan1为AP模式,wlan0为连接路由器模式
具体可参考:
https://github.com/desflynn/realtek-8192cu-concurrent-softAP#bring-up-code
https://pannzh.github.io/tech/2016/04/04/linux-kernel-forwarding.html
http://m.blog.csdn.net/article/details?id=51010243
http://blog.csdn.net/paul_c_v/article/details/41585483
http://www.cnblogs.com/buptmuye/p/3695790.html
以下为通过有线网卡转发的例子
配置路由转发这里是参考:把树莓派配置成无线路由器 通过前面的配置过程,已经可以通过无线网络连接到Raspberry pi的无线网卡,但是还不能连接到互联网,下一步就是让从无线网卡 wlan0 进来的数据 转发到 有线网卡 eth0上面 通过有线网卡连接网络接到互联网。 因为eth0是获取的动态ip,所以这里通过iptables来实现简单的路由转发。 输入命令sudo iptables -F sudo iptables -X sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo bash iptables-save > /etc/iptables.up.rules exit输入sudo nano /etc/network/if-pre-up.d/iptables把下面两行复制粘贴到编辑窗口#!/bin/bash /sbin/iptables-restore < /etc/iptables.up.rules保存退出,输入命令。sudo chmod 755 /etc/network/if-pre-up.d/iptables开启内核转发,输入命令。sudo nano /etc/sysctl.conf找到这里# Uncomment the next line to enable packet forwarding for IPv4#net.ipv4.ip_forward=1去掉 net.ipv4.ip_forward 前面的#,保存退出,输入命令。sudo sysctl -p配置完毕 通过无线连接上以后ping一下外网,可以通了,这样就可以把Raspberry Pi 当作路由器来用了。
12. ioctl[SIOCSIWAP]: Operation not permitted
root@beaglebone:~# wpa_supplicant -B -iwlan0 -Dwext -c/etc/wpa_supplicant.confioctl[SIOCSIWAP]: Operation not permittedioctl[SIOCSIWENCODEEXT]: Invalid argumentioctl[SIOCSIWENCODEEXT]: Invalid argument
暂时没找到原因和解决方案, 不过这个报警貌似也没造成什么影响。
================================
我的参考配置
root@beaglebone:~# cat /etc/dhcp/dhcpd.conf
## Sample configuration file for ISC dhcpd for Debian### The ddns-updates-style parameter controls whether or not the server will# attempt to do a DNS update when a lease is confirmed. We default to the# behavior of the version 2 packages ('none', since DHCP v2 didn't# have support for DDNS.)#ddns-update-style none;INTERFACES="wlan1";default-lease-time 600;max-lease-time 7200;# If this DHCP server is the official DHCP server for the local# network, the authoritative directive should be uncommented.#authoritative;# This is a very basic subnet declaration for 192.168.12.*subnet 192.168.12.0 netmask 255.255.255.0{ range 192.168.12.10 192.168.12.50; option routers 192.168.12.1; #option domain-name-servers 202.99.166.4,202.99.160.68; option domain-name-servers 8.8.8.8; option broadcast-address 192.168.12.255;}
root@beaglebone:~# cat /etc/wpa_supplicant/wpa_supplicant.conf
network={ ssid="T-1000" #psk="1qazxsw23edcvfr4!" psk=39b26236550ac04b4026bfa020e54ec1308f5ee8ad726a846655d0f1a2e4a33d}
root@beaglebone:~# cat /etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapdctrl_interface_group=0macaddr_acl=0auth_algs=1ignore_broadcast_ssid=0#WPA2 settingswpa=3wpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP# CHANGE THE PASSPHRASEwpa_passphrase=moxiaomomo# Most modern wireless drivers in the kernel need driver=nl80211 byt we need rtl871xdrvdriver=rtl871xdrvwme_enabled=1wpa_group_rekey=86400# set proper interfaceinterface=wlan1bridge=lanbr0hw_mode=g# best channels are 1 6 11 14 (scan networks first to find which slot is free)channel=11# this is the network namessid=moxiaomomo
root@beaglebone:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceiface lo inet loopback### The primary network interface#iface eth0 inet static# address 10.0.0.200# netmask 255.255.255.0# network 10.0.0.1# gateway 10.0.0.1# WiFi Setup Client on wlan0 + AP on wlan1auto wlan0allow-hotplug wlan0iface wlan0 inet static address 10.0.0.177 netmask 255.255.255.0 network 10.0.0.1 gateway 10.0.0.1 wpa-ssid "T-1000" wpa-psk "1qazxsw23edcvfr4!"allow-hotplug wlan1iface wlan1 inet static address 192.168.12.1#Enable on startupauto lo eth0
root@beaglebone:~# lsusb
Bus 001 Device 002: ID 0409:005a NEC Corp. HighSpeed HubBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 003: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN AdapterBus 001 Device 004: ID 413c:2113 Dell Computer Corp.
root@beaglebone:~# lsmod
Module Size Used by8192cu 417956 0 g_multi 50407 2 libcomposite 15028 1 g_multimac80211 424813 0 cfg80211 354018 1 mac80211rfkill 16672 2 cfg80211omap_rng 4062 0 xt_tcpudp 1841 3 xt_state 1217 2 iptable_filter 1479 1 ipt_MASQUERADE 1573 6 iptable_nat 2172 1 nf_conntrack_ipv4 11792 3 nf_defrag_ipv4 1324 1 nf_conntrack_ipv4nf_nat_ipv4 3018 1 iptable_natnf_nat 13695 3 ipt_MASQUERADE,nf_nat_ipv4,iptable_natnf_conntrack 69347 6 ipt_MASQUERADE,nf_nat,xt_state,nf_nat_ipv4,iptable_nat,nf_conntrack_ipv4ip_tables 9478 2 iptable_filter,iptable_natx_tables 15355 5 ip_tables,xt_tcpudp,ipt_MASQUERADE,xt_state,iptable_filterrt5370sta 535960 0
root@beaglebone:~# ifconfig -a
eth0 Link encap:Ethernet HWaddr 88:c2:55:6c:1e:ed UP BROADCAST 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) Interrupt:40lo 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:56 errors:0 dropped:0 overruns:0 frame:0 TX packets:56 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:5224 (5.1 KiB) TX bytes:5224 (5.1 KiB)usb0 Link encap:Ethernet HWaddr 88:c2:55:6c:1e:e0 BROADCAST 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)wlan0 Link encap:Ethernet HWaddr 00:1d:43:20:01:74 inet addr:10.0.0.177 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::21d:43ff:fe20:174/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:21513 errors:0 dropped:22026 overruns:0 frame:0 TX packets:16167 errors:0 dropped:3 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:17389209 (16.5 MiB) TX bytes:2366728 (2.2 MiB)wlan1 Link encap:Ethernet HWaddr 02:1d:43:20:01:74 inet addr:192.168.12.1 Bcast:192.168.12.255 Mask:255.255.255.0 inet6 addr: fe80::1d:43ff:fe20:174/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:42859 errors:0 dropped:887 overruns:0 frame:0 TX packets:14727 errors:0 dropped:82 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2311874 (2.2 MiB) TX bytes:14785216 (14.1 MiB)
root@beaglebone:/data/packages/realtek-8192cu-concurrent-softAP# cat bring-up.sh
#Script to kill any existing hostapd, dhcps, wpa_supplicant, dhcpd, dnsmasq etc then bring up AP and Clientkillall wpa_supplicant hostapd dnsmasq dhcpd udhcpdifdown wlan1ifup wlan1dhcpd -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid wlan1hostapd -B /etc/hostapd/hostapd.confifdown wlan0wpa_supplicant -B -iwlan0 -Dwext -c/etc/wpa_supplicant/wpa_supplicant.confifup wlan0
- 【EmbeddedDev】BBB&RTL8188CUS搭建wifi AP 问题整理
- 树莓派做AP发射wifi(RTL8188CUS芯片)
- 将树莓派Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)
- 将树莓派Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)2
- 将Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)
- 将树莓派Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)
- 将树莓派Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)
- [转载]将树莓派Raspberry Pi设置为无线路由器(WiFi热点AP,RTL8188CUS芯片)
- bbb+wifi
- RTL8188CUS Raspberry Pi AP设置
- 4.0-rtl8188cus wifi调试
- wifi 热点搭建 wifi ap linux 下搭建
- 【EmbeddedDev】BBB上打开PWM串口并进行操作
- 【EmbeddedDev】BBB上通过ADC串口获取光感数值
- 【EmbeddedDev】BBB控制直流电机的转速与方向
- 树莓派使用 RTL8188CUS芯片 开AP模式
- 关于wifi 同时做ap, sta 问题
- usb接口wifi模块rtl8188cus issue
- MySql笔记1
- 微服务架构下的数据一致性保证(二):可靠事件模式
- js的基本常识
- 三、OSM数据导入PostGIS数据库的过程
- 使用xib布局UIView
- 【EmbeddedDev】BBB&RTL8188CUS搭建wifi AP 问题整理
- WebView的使用
- 关于字符串和小数的互相转换?
- json的二三事儿
- 解决 IE 不支持 document.getElementsByClassName()
- 无效的表达式项 else
- 深入理解LabVIEW中的While循环
- 棋盘覆盖2(1X2骨牌 和 L型骨牌 混合铺满)(强行轮廓线DP)
- html 图像 链接