This section describes the Wi-Fi operations in different work modes.
Wi-Fi Work Modes
The AIC8800 Wi-Fi subsystem supports two work modes: Station mode and Soft AP
mode.
- Station mode: The device connects to an existing wireless network as
a client. This is the default and most common mode.
- Soft AP mode: The device acts as a wireless access point, allowing
other devices to connect to it. This mode is used for local hotspot
functionality.
Operations in Station Mode
In Station mode, the device connects to an existing Wi-Fi network.
Table 1. Station Mode Operations
| Operation |
Details |
| WPA supplicant configuration |
-
Create or edit
/etc/wpa_supplicant.conf.
-
Add the following into the configuration
file: ctrl_interface=/var/run/wpa_supplicant
update_config=1
Add network entries based on the security
type. For example:
-
Open system without
encryption: network={
ssid="tttb"
key_mgmt=NONE
}
-
Open/Shared authentication
with WEP
encryption: network={
ssid="tttb"
key_mgmt=NONE
auth_alg=OPEN SHARED
wep_key0=1234567890
}
-
WPA/WPA2-PSK authentication with TKIP/AES
encryption: network={
ssid="tttb"
psk="12345678"
}
Alternatively, generate an encrypted
PSK entry using the
wpa_passphrase
tool: wpa_passphrase ssid >> wpa_supplicant.conf
password
|
| Connecting to a network |
-
Run the following command to connect to the network
configured in the
wpa_supplicant.conf
file. wpa_supplicant -Dnl80211 -i wlan0 -c wpa_supplicant.conf -d&
-
After a successful connection, obtain the IP address
of wlan0 using the udcpc
tool. udhcpc -i wlan0
|
| WPA CLI tool |
wpa_cli is a command-line front-end for
interacting with wpa_supplicant . Common
operations include: |
Soft AP Mode Operations
In Soft AP mode, the device acts as a wireless access point.
Table 2. Soft AP Mode Operations
| Operation |
Details |
| Hotspad configuration |
-
Create or edit
/etc/hostapd.conf.
-
Add the following into the configuration
file: ctrl_interface=/var/run/wpa_supplicant
update_config=1
Add network entries based on the security
type. For example:
-
Open system without
encryption: interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=AndroidAP
channel=6
ieee80211n=1
hw_mode=g
ignore_broadcast_ssid=0
-
WPA2-PSK authentication with AES
encryption: interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=AndroidAP
channel=6
ieee80211n=1
hw_mode=g
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=12345678
|
| Setting up a Wi-Fi hotspot with hostpad |
-
Run the following command to launch the Wi-Fi hotspot
using the hostapd.conf
configuration
file:. hostapd hostapd.conf -B
After
running this command, the hotspot is visible to
phones and computers, but client devices fail to
establish a connection. This happens because the
wireless interface has no assigned IP address and no
DHCP server to allocate client IPs. Complete the
subsequent steps to resolve this.
-
Add a dedicated subnet block to the main DHCP
configuration file
/etc/dhcp/dhcpd.conf. A sample
configuration is shown
below: subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.20;
option routers 192.168.0.1;
}
-
Run the following command to set the static IP for
the wlan0 wireless
interface. ifconfig wlan0 192.168.0.1
-
Run the following command to start the DHCP server
and troubleshoot any runtime
errors. dhcpd
You
may now connect mobile phones, PCs and other
wireless devices to the hotspot. Verify connectivity
by pinging the gateway address
192.168.0.1.
-
To route internet traffic through this Wi-Fi hotspot,
enable Linux IP forwarding. This forwards traffic
between the SBC’s wired Ethernet port and the
wlan0 wireless interface. Run the
commands below as an example
setup: echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE
|