准备

模块驱动编译

make ARCH=arm CROSS_COMPILE=arm-hisiv400-linux-
Makefile:
obj-$(CONFIG_RTL8723BU)		+= rtl8723bu/
Kconfig:
source "drivers/net/wireless/rtl8723bu/Kconfig"

##最好编译成模块

工具编译

可以使用buildroot来编译,减少依赖问题。也可以单独编译

  • openssl
  • wpa_supplicant
    • libnl
    • wpa_supplicant

WIFI Station模式

内核配置

Networking support —>Wireless下增加802.11 协议栈的支持:cfg80211

使用

iwconfig
#rfkill list
#rfkill unblock wlan

./wpa_supplicant -d -B -Dnl80211 -iwlan0 -c./wpa_supplicant.conf
./wpa_supplicant -d -Dwext -iwlan0 -c./wpa_supplicant.conf

wpa_passphrase TP-LINK_8CEA 11111111 > /etc/wpa_supplicant.conf

iwlist wlan0 scanning

iw list

WIFI AP模式

内核配置

Linux Kernel Configuration
    -> Networking support
        -> Networking options
            -> Network packet filtering framework(netfilter)
                -> Core netfilter configuration
                    -> Netfilter connection tracking support
                    -> Netbios name service protocal support(new)
                    -> Netfilter Xtables support (required for ip_tables)


Linux Kernel Configuration
    -> Networking support
        -> Networking options
            -> Network packet filtering framework(netfilter)
                -> IP: Netfilter Configuration
                    -> IPv4 connection tracking support (require for NAT)
                    -> IP tables support (required for filtering/masq/NAT)
                -> Full NAT
                    -> MASQUERADE target support
                    -> REDIRECT target support

使用

  1. 加载wifi驱动,网卡up,配置ip
    insmod r8723bs.ko
    ifconfig wlan0 192.168.0.1
  2. 配置开启hostapd
    hostapd /etc/hostapd.conf -B
  3. 配置开启udhcpd:
    mkdir -p /var/lib/misc  
    touch /var/lib/misc/udhcpd.leases 
    udhcpd -fS /etc/udhcpd.conf
  4. 配置NAT转发
    echo "1" >/proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING -s 192.168.0.1/255.255.255.0 -o eth0 -j SNAT --to-source 192.168.1.101