1. 程式人生 > >imx6 linux wifi ap模式配置(usb-wifi模組rt3070)

imx6 linux wifi ap模式配置(usb-wifi模組rt3070)

轉載自:https://blog.csdn.net/weixin_42381443/article/details/80566047

不是所有的usb-wif模組在linux下面都可以支援ap模式。
在linux下的ap模式是通過工具hostapd工具進行配置執行的,該工具一般使用nl80211協議驅動無線網絡卡ap模式的執行。所以一定要選擇linux下能支援80211ap協議(ap模式)的無線網絡卡。否則,免試(不用試)!如果你不用hostapd,請另外研究。

除錯步驟:

  1. 在核心driver選項裡面選擇80211相關的所有相關配置選項。
    在這裡插入圖片描述
  2. 因為wifi網絡卡一般都需要載入自己本身的韌體,所以選上firmware選項。
    在這裡插入圖片描述
  3. driver選擇 host ap相關的驅動介面和我的ralink 驅動。
    在這裡插入圖片描述
  4. 這裡我測試的是rt3070所以,做如下驅動的選擇:
    在這裡插入圖片描述
  5. 系統啟動之後,插上rt3070網絡卡會報找不到"/lib/firmware/rt2870.bin"的錯誤,請下載rt2870.bin拷貝到/lib/firmware/目錄中。下載方式可以通過
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git 下載。

以上rt3070的驅動ok之後,接下來可以進行wifi ap的配置啟動操作:

  1. hostapd /etc/apd.conf -B
    注意請按照如下修改正確的apd.conf檔案:
[email protected]:~# cat /etc/apd.conf 
interface=wlan0
driver=nl80211
ssid=imx6-wifi-test
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=0
wpa_passphrase=imx6wifi
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
  1. ifconfig wlan0 10.0.0.1
    注意不要和其他網段共用從而導致衝突。

  2. dpcpd ip地址分配服務(ap運行於router的模式[ap模式]需要給連結到imx6的每一臺client分配ip地址),修改dhcpd(注意在yocto裡面配置該包)
    dhcpd wlan0
    按照如下進行dhcpd配置檔案的配置

[email protected]:~# cat /etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
option SIP code 120 = string;
subnet 10.0.0.0  netmask 255.255.255.0 {

#  --- default gateway
        option routers                  10.0.0.1,10.0.0.2,10.0.0.3;
        option subnet-mask              255.255.255.0;
        option nis-domain               "domain.org";
        option domain-name              "domain.org";
#       option SIP                      0:7:65:78:61:6d:70:6c:65:3:63:6f:6d:0:7:65:78:61:6d:70:6c:65:3:6e:65:74;
        option SIP                      1:24:45:67:89;
        option domain-name-servers      203.145.184.13;
        option broadcast-address        10.0.0.255;
        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              10.0.0.1;
#       option netbios-name-servers     10.0.0.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;

        range dynamic-bootp 10.0.0.3 10.0.0.254;


        #default-lease-time 1000;
        default-lease-time 21600;
        #max-lease-time 1200;
        max-lease-time 6000;

        # we want the nameserver to appear at a fixed address
        host ns {
                next-server marvin.redhat.com;
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }
        host anand {
                        hardware ethernet 00:11:11:07:80:68;
                        fixed-address 10.0.0.155;
                        option host-name "anand";
        }
        host dhcphost {
                        hardware ethernet 00:04:9f:96:9c:4d;
                        fixed-address 10.0.0.168;
                        option host-name "dhcphost";
        }
}

作者:[email protected]
來源:CSDN
原文:https://blog.csdn.net/weixin_42381443/article/details/80566047
版權宣告:本文為博主原創文章,轉載請附上博文連結!