Search by Tags

Wireless Access Point Mode

 
Applicable for

Compare with Revision


Subscribe for this article updates

This article describes how to setup an Access Point Wi-fi using open source software Hostapd.

First of all, make sure that the Wi-Fi adapter supports Access Point mode. You can check which Toradex modules have built-in Wi-Fi in the Wi-Fi (Linux) article, and broader information in the comprehensive Wi-Fi article.

Note: This setup was tested using Embedded Linux BSP release 2.8b3 and Colibri iMX6ULL 512MB WB IT V1.0A. Instructions may vary when using other Wi-Fi adapters.

Verify that the Access Point interface uap0 is available:

$ ifconfig uap0
uap0      Link encap:Ethernet  HWaddr 00:19:88:5E:10:B0  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Make sure that the mwifiex driver is creating two interfaces during initialization (mlan0 and uap0 respectively for regular station and access point interfaces) by setting the driver mode to 0x3 in /etc/modprobe.d/mwifiex.conf

/etc/modprobe.d/mwifiex.conf
options mwifiex driver_mode=0x3

Set the Access Point interface IP and SSID in Hostapd configuration file. Change the following variables in /etc/hostapd.conf:

/etc/hostapd.conf
interface=uap0 # Access Point interface name ssid=access-point # SSID hw_mode=g # default channel=1 # default own_ip_addr=192.168.8.1 # IP address of the Access Point interface #wpa=1 # no wpa

To provide the Access Point interface with a static IP address and DHCP, it is necessary to create the file /etc/systemd/network/hostapd.network:

/etc/systemd/network/hostapd.network
[Match] Name=uap0 [Network] Address=192.168.8.1/24 DHCPServer=yes

At last, enable the following services and reboot to activate them:

$ connmanctl enable wifi
$ systemctl enable hostapd
$ reboot

After reboot, check the Access Point interface:

$ ifconfig uap0
uap0      Link encap:Ethernet  HWaddr 00:19:88:5E:10:B0  
          inet addr:192.168.8.1  Bcast:192.168.8.255  Mask:255.255.255.0
          inet6 addr: fe80::219:88ff:fe5e:10b0%2124282624/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2173 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2087 errors:43 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:233040 (227.5 KiB)  TX bytes:172662 (168.6 KiB)

Now you can connect to this Access Point from other Wi-Fi devices.