Skip to main content

WiFi Networking

Introduction

The Omega2 has a built-in 2.4 GHz 802.11 b/g/n WiFi radio adapter. It can host a network, connect to an existing network, or host a network and connect to a wireless network simultaneously.

Modes of operation

  • AP: WiFi network hosted by Omega2.
  • STA: Connecting to an existing WiFi network.
  • AP+STA: Hosting a network and connecting to an existing wireless network simultaneously.
  • Off: WiFi radio disabled.

Driver

The Omega2 uses the open source mt76 wireless network driver.

Configuration for wireless networking is at /etc/config/wireless on the device.

note

Configuration changes are made using the Unified Configuration Interface (UCI) command-line utility. UCI is useful for quick and easy modifications to configuration files. See the OpenWRT docs for more info on UCI.

AP

The Omega2 hosts a WiFi Access Point (AP), also known as a WiFi Hotspot, that other WiFi-enabled devices can connect to. This is like a WiFi router.

Default behaviour

The AP is enabled on the Omega2 by default. The SSID, name of the network, will be Omega-abcd where abcd matches the last 4 digits of the device’s MAC address.

The AP acts as a DHCP host and provides IP addresses to clients.

IP Addresses and DHCP

  • Omega2 AP IP address is 192.168.3.1
  • DHCP will give IP addresses to clients in the 192.168.3.100 to 192.168.3.150 range

To check the IP address given to connected clients, run cat/tmp/dhcp.leases.

How to change DHCP

For information on how to change the DHCP, see the OpenWRT DHCP docs for more configuration options.

Configuring the AP

The AP has a few settings that are configurable.

Changing the AP SSID

To change the AP SSID:

uci set wireless.default_radio0.ssid='<NEW SSID>' 
uci commit wireless
wifi

Changing the password

To change the password:

uci commit wireless.default_radio0.key='<NEW PASSWORD>' 
uci commit wireless
wifi

Disabling the AP

To disable the AP:

uci set wireless.default_radio0.disabled='1' 
uci commit wireless
wifi
note

Running the disable command will turn off the Omega’s WiFi AP. If you were connected to the AP and using SSH for command line access, that will no longer work when the AP is turned off. Make sure the device is accessible via serial or through STA network connection before doing this.

See the OpenWRT wireless docs for more configuration options.

STA

The Station (STA) allows you to connect the Omega2 to an existing wireless network as a client.

Default behaviour

The STA is disabled on the Omega2 by default.

Configuring the STA

The STA has several settings that are configurable.

Enabling an STA connection

To enable an STA connection:

uci set wireless.client.disabled='0' 
uci commit wireless
wifi

Scanning for WiFi networks

To scan for WiFi networks:

iwinfo ra0 scan

Sample output:

Cell 01 - Address: 0C:AC:8A:51:F4:1B 
ESSID: "ABCD517"
Mode: Master Channel: 1
Signal: -80 dBm Quality: 30/70
Encryption: WPA2 PSK (CCMP)
HT Operation:
Primary Channel: 1
Secondary Channel Offset: no secondary
Channel Width: 20 MHz

Cell 02 - Address: 0C:AC:8A:E3:27:51
ESSID: "ABCD791"
Mode: Master Channel: 6
Signal: -83 dBm Quality: 27/70
Encryption: WPA2 PSK (CCMP)
HT Operation:
Primary Channel: 6
Secondary Channel Offset: no secondary
Channel Width: 40 MHz or higher

Connecting to a secure wireless network

To connect to a wireless network with WPA2 security:

uci set wireless.client.ssid='<YOUR WIFI NETWORK NAME HERE>' 
uci set wireless.client.key='<YOUR WIFI NETWORK PASSWORD HERE>'
uci commit wireless
wifi

If a connection is successful, you’ll see the following message in the kernel logs.

[ 993.442095] apcli0: associated

Checking the IP address on Omega

To check the IP address given to the Omega:

ifconfig apcli0

This will return the following information.

omega2-ip-address-check

Note the highlighted IP address inet addr:.

note

The Omega2 will only connect to the wireless network specified. This version of the WiFi driver does not support automatic network switching.

To disable this functionality of the radio and disconnect from any connected radio:

 uci set wireless.client.disabled='1'
uci commit wireless
wifi

See the OpenWRT wireless docs for more configuration options including supporting different WiFi network types.

AP+STA

The Omega2 can host a wireless network access point and connect to an existing wireless network simultaneously.

WARNING

Having both the AP and STA enabled simultaneously may result in IP address collisions.

What is an IP address collision?

An IP address collision can occur if your Omega’s access point (AP) and WiFi network that you try connecting to share the same subnetwork (subnet). The Omega’s AP is 192.168.3.0/24 and it’s possible that your WiFi network has the same subnet. This results in the Omega not knowing what data to send where.

See the article Avoiding IP address collisions for more information.

Disabling the WiFi radio

You may want to completely power down the WiFi radio and disable all wireless networking.

Why would you disable the WiFi radio?

The WiFi radio consumes a relatively large amount of power. If wireless networking is not required for your application, disabling this feature will result in large power savings.

To disable the WiFi radio:

uci set wireless.radio0.disabled='1'
uci commit wireless
wifi

Additional configuration options

See the OpenWRT docs for additional configuration options including support for different WiFi network security types, enterprise WiFi, fast switching, and more.