Here we use the installation of WiFi hotsport on the MYD-SAM9X5 board through the MY-WF003U WiFi module as an example to explain how to use AP function of the USB WiFi module.
On other MYIR's boards, it is similar.
Connect eth0 of the development board to ethernet, using udhcpd as dhcp server, iptables to forward data of the WiFi module and eth0. Other mobiles and wireless devices can connect with the WiFi module and acquire relative ip, dns and other network configurations so can connect to internet.
Network configuration
Eth0
network segment: 192.168.1.0
gateway: 192.168.1.1
DNS: 202.96.128.86
DNS setting method: write "nameserver 202.96.128.86" into /etc/resolv.conf file and then restart the network
Please note the nameserver value is up to your networks.
Wlan0
network segment: 192.168.2.0
IP: 192.168.2.1
Using steps:
1. insert USB WiFi module driver
It is normal if appears below information:
2. configure IP address of wlan0
3. cross compile hostapd (the source code is in the wifi module disk) and copy hostapd to the development board
4. configure /etc/hostapd.conf file on development board (please create one if none), please refer to below configuration (hotspot name: MY-HOSTAP, password: 11111111, can be modified)
5. configure /etc/udhcpd.conf file on devleopment board (please create one if none), please refer to below configuration, can be modified according to actual status:
6. If there is no /etc/udhcpd.leases file under /etc directory, please create using below command:
Start DHCP server
7. Set IP routing rule
Note: if there is no iptables command, please port iptables to your target board first.
Check if the router settings are OK (It indicates success if appearing below information.)
8. Enable IP forward function
9. Start hostapd
10. After above steps, you can use WiFi device to search "MY-HOSTAP" hotsport, you will be able to get on internet after connecting to this hotspot.
|