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

    不是所有的usb-wif模块在linux下面都可以支持ap模式。
    在linux下的ap模式是通过工具hostapd工具进行配置运行的,该工具一般使用nl80211协议驱动无线网卡ap模式的运行。所以一定要选择linux下能支持80211ap协议(ap模式)的无线网卡。否则,免试(不用试)!如果你不用hostapd,请另外研究。

调试步骤:
1. 在内核driver选项里面选择80211相关的所有相关配置选项。
imx6 linux wifi ap模式配置(usb-wifi模块rt3070)_第1张图片
2. 因为wifi网卡一般都需要加载自己本身的固件,所以选上firmware选项。
3. driver选择 host ap相关的驱动接口和我的ralink 驱动。
imx6 linux wifi ap模式配置(usb-wifi模块rt3070)_第2张图片
4. 这里我测试的是rt3070所以,做如下驱动的选择:
imx6 linux wifi ap模式配置(usb-wifi模块rt3070)_第3张图片
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的配置启动操作:

6. hostapd /etc/apd.conf -B
注意请按照如下修改正确的apd.conf文件:
root@imx6qsabrelite:~# 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

7. ifconfig wlan0 10.0.0.1
注意不要和其他网段共用从而导致冲突。

8. dpcpd ip地址分配服务(ap运行于router的模式[ap模式]需要给链接到imx6的每一台client分配ip地址),修改dhcpd(注意在yocto里面配置该包)
dhcpd wlan0
按照如下进行dhcpd配置文件的配置
root@imx6qsabrelite:~# 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";
}
}

你可能感兴趣的:(linux)