FizZ 发表于 2017-9-1 17:39:54

CubieBoard6 S500 linux下开启wifi热点

本帖最后由 FizZ 于 2017-9-8 17:42 编辑

本文基于CubieBoard6, 通过以太网eth0转WiFi热点      手机连接热点上网
步骤如下:
(1)编辑/etc/modules,在wlan_bcmdhd前加#进行注释,重启系统vi /etc/moduleshttp://115.28.34.208/forum.php?mod=image&aid=4737&size=300x300&key=a98e69d15c237a4f&nocache=yes&type=fixnone
reboot(2)重启系统后,执行以下命令,重新加载wifi模块
modprobewlan_bcmdhd firmware_path=/lib/firmware/ap6212/fw_bcm43438a0_apsta.bin 使用lsmod查看wifi模块 lsmod
(3)连接网线,安装udhcpd,输入以下命令
sudo apt-get install udhcpd(4)查看/etc/udhcpd.conf,如果存在,则需要删除,重新建立udhcpd.conf,如果不存在,直接建立即可ls/etc/udhcpd.confrm/etc/udhcpd.conf创建并编辑udhcpd.confvi/etc/udhcpd.confudhcpd.conf配置如下:    start 192.168.2.2
    end 192.168.2.100
    interface wlan0
    max_leases 20
    remaining yes
    auto_time 7200
    decline_time 3600
    conflict_time 3600
    offer_time 60
    min_lease 60
    lease_file /etc/udhcpd.leases
    opt dns 114.114.114.114         #192.168.1.2 192.168.1.10                        
    option subnet 255.255.255.0                                             
    opt router 192.168.2.1                                                
    option domain local(5)建立一个udhcpd.leasesde文件

touch /etc/udhcpd.leases(6)创建并编辑hostapd.conf
vi/etc/hostapd.conf hostapd.conf配置:interface=wlan0
driver=nl80211
ssid=Cubieboard6
channel=6
hw_mode=g
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP注意: hostapd.conf配置每行代码前面并不能有空格
其中, ssid=Cubieboard6“Cubieboard6”表示wifi名称                wpa_passphrase=12345678   “12345678”表示wifi密码
(6)直接执行以下代码即可
ifconfig wlan0 192.168.2.1 netmask 255.255.255.0 up
udhcpd -fS /etc/udhcpd.conf&
iptables -A FORWARD -s 192.168.2.0/24 -o eth0 -j ACCEPT
iptables -A FORWARD -d 192.168.4.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.2.0/255.255.255.0 -o eth0 -j MASQUERADE
echo 1 >/proc/sys/net/ipv4/ip_forward
hostapd -B /etc/hostapd.confPS:为了方便,可以把加载驱动模块和第6步的命令保存为ap.sh文件,在用命令$ chmod 777ap.sh增加权限vi ap.shap.sh内容:modprobewlan_bcmdhd firmware_path=/lib/firmware/ap6212/fw_bcm43438a0_apsta.bin
ifconfig wlan0 192.168.2.1 netmask 255.255.255.0 up
udhcpd -fS /etc/udhcpd.conf&
iptables -A FORWARD -s 192.168.2.0/24 -o eth0 -j ACCEPT
iptables -A FORWARD -d 192.168.4.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.2.0/255.255.255.0 -o eth0 -j MASQUERADE
echo 1 >/proc/sys/net/ipv4/ip_forward
hostapd -B /etc/hostapd.conf
~
之后增加权限:sudo chmod 777 ap.sh开机后,直接执行以下命令即可./ap.sh参考:http://blog.csdn.net/wang_shuai_ww/article/details/52763366






@allen 发表于 2018-6-7 17:09:39

本帖最后由 @allen 于 2018-6-7 17:12 编辑


S700 Linux 系统验证发热点

1. sudo apt-get install hostapd

2. vi /etc/modprobe.d/s700-wifi.conf
options wlan_bcmdhd \
                firmware_path=/lib/firmware/fw_bcm43438a0_apsta.bin \
                nvram_path=/lib/firmware/ap6212_nvram.txt \
                config_path=/lib/firmware/ap6212_config.txt
重启或重新加载驱动。加载打印必须有dhd_conf_set_fw_name_by_chip: firmware_path=/lib/firmware/fw_bcm43438a0_apsta.bin

3.因为network-manager的关系, 需要/etc/init.d/network-manager stop后再执行ap.sh


页: [1]
查看完整版本: CubieBoard6 S500 linux下开启wifi热点