|
硬件环境:
BananaPi-R1
操作系统:
Lubuntu (Linux lamobo 3.4.103 #1 SMP PREEMPT Tue Feb 10 18:51:55 CST 2015 armv7l armv7l armv7l GNU/Linux)
软件准备:
dnsmasq haveged (apt-get install)
进入正题
1.进入下面网址,下载linux版本软件
http://www.realtek.com/downloads/downloadsView.aspx?Langid=1&PNid=48&PFid=48&Level=5&Conn=4&DownTypeID=3&GetDown=false&Downloads=true#RTL8192CU
2.通过ssh传到开发板,进行解压(ssh传输请自行百度)
3.unzip RTL8192xC_USB_linux_*.zip
4.tar zxvf RTL8188C_8192C_USB_linux_*/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_rtw_*.tar.gz
5.cd wpa_supplicant_hostapd-0.8_*/hostapd/
6.make
7.sudo cp hostapd hostapd_cli /usr/local/sbin/
8.编写开启ap的配置文件vi /etc/hostapd/hostapd.conf :
ssid=MyAccessPoint #ap名字
wpa_passphrase=MySecretPassword #ap密码
ctrl_interface=/var/run/hostapd #用途未知
interface=@INTERFACE@ #无线网卡接口 iwconfig 会显示出 wlanx x未随机数
bridge=br0 #网桥编号,通过网桥共享上网
driver=rtl871xdrv #驱动 和网上大多数驱动不同,但是这个是确实可用的
hw_mode=g #未知
channel=6 #频道号,需要根据iwconfig中提示的hz数进行设置
wpa=2 #加密方式
ieee80211n=1 #未知,但是有用
wme_enabled=1 #未知
ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+] #未知
wpa_key_mgmt=WPA-PSK #加密方式
wpa_pairwise=CCMP
max_num_sta=8 #允许的最大的连接数目
9.配置网桥 vi /etc/network/interfaces
auto br0
iface br0 inet static
address 192.168.xxx.1
netmask 255.255.255.0
network 192.168.xxx.0
broadcast 192.168.xxx.255
bridge_ports none
bridge_fd 1
bridge_hello 1
bridge_stp on
10.编辑dnsmasq配置文件: /etc/dnsmasq.d/dhcp.conf :
dhcp-range=192.168.xxx.100,192.168.xxx.200,255.255.255.0,12h
dhcp-option=option:router,192.168.xxx.1
dhcp-option=option:dns-server,192.168.xxx.1
dhcp-authoritative
11.编写开机脚本文件,开机即可运行
vi ~/.bash_profile (本文件在用户登录后执行)
ifconfig wlan1 up
brctl addif br0 eth0
brctl addif br0 wlan1
hostapd -d /etc/hostapd/hostapd.conf
缺点:1.搭建网桥时间过长,所以连上wifi并可以用需要较长时间
2.有时候会碰到网卡或网桥不存在的问题需要重启
3.有时候会连不上wifi需要多次连接在可以连上,或者需要重启板子
4.功能可能不能满足你的需求,希望各路大神批评指正,互相交流。
个人心得:开启ap过程中慢慢懂得了一些网络知识,最终能够实现也是一次次尝试
不同的方法才弄好的,最终还是要找到合适的hostapd以及合适的方法。
|
|