Before doing any actual configuration, the wifi interface must be enabled in order to be able to scan for networks in the vincinity:
uci set wireless.@wifi-device[0].disabled=0
uci commit wireless
wifi
Set the disabled option to 0 (to enable wireless)
Save changed configuration file
Start wireless using the wifi command
Now we can list networks in range using iw dev wlan0 scan, substituting your actual wireless interface for wlan0 if different (ifconfig lists all available interfaces to find how your wlan is called)
iw dev wlan0 scan output example:
root@OpenWrt:/# iw dev wlan0 scan
BSS c8:d5:fe:c8:61:b0(on wlan0) -- associated
TSF: 24324848870 usec (0d, 06:45:24)
freq: 2412
beacon interval: 100 TUs
capability: ESS (0x0411)
signal: -72.00 dBm
last seen: 140 ms ago
Information elements from Probe Response frame:
SSID: Violetta
RSN: * Version: 1
* Group cipher: CCMP
* Pairwise ciphers: CCMP
* Authentication suites: PSK
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
BSS f8:35:dd:eb:20:f8(on wlan0)
TSF: 24225790925 usec (0d, 06:43:45)
freq: 2457
beacon interval: 100 TUs
capability: ESS (0x0431)
signal: -90.00 dBm
last seen: 1450 ms ago
Information elements from Probe Response frame:
SSID: GOinternet_EB20FB
HT capabilities:
Capabilities: 0x11ee
HT20/HT40
SM Power Save disabled
RX HT20 SGI
RX HT40 SGI
TX STBC
RX STBC 1-stream
Max AMSDU length: 3839 bytes
DSSS/CCK HT40
Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
Minimum RX AMPDU time spacing: 4 usec (0x05)
HT RX MCS rate indexes supported: 0-15, 32
HT TX MCS rate indexes are undefined
HT operation:
* primary channel: 10
* secondary channel offset: below
* STA channel width: any
RSN: * Version: 1
* Group cipher: TKIP
* Pairwise ciphers: TKIP CCMP
* Authentication suites: PSK
* Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
In the example, there are two networks, a Wifi g one called Violetta and a Wifi n one called GOinternet_EB20FB.
The device was configured to connect to the one called Violetta.
These are the uci values that were added or changed by the configuration procedure.
For SSID, BSSID, and encryption you must use the info you got from the wifi scan above.
For an explanation of why these values were changed, please read the luci tutorial above.
network.lan.ipaddr='192.168.2.1'
network.repeater_bridge=interface
network.repeater_bridge.proto='relay'
network.repeater_bridge.network='lan wwan'
network.wwan=interface
network.wwan.proto='dhcp'
firewall.@zone[0].network='lan repeater_bridge wwan'
dhcp.lan.ignore='1'
wireless.radio0.hwmode='11g'
wireless.radio0.country='00'
wireless.radio0.channel='1'
wireless.radio0.disabled='0'
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device='radio0'
wireless.@wifi-iface[0].mode='ap'
wireless.@wifi-iface[0].encryption='none'
wireless.@wifi-iface[0].ssid='OpenWrt'
wireless.@wifi-iface[0].network='lan'
wireless.@wifi-iface[1]=wifi-iface
wireless.@wifi-iface[1].network='wwan'
wireless.@wifi-iface[1].ssid='Violetta'
wireless.@wifi-iface[1].encryption='psk2'
wireless.@wifi-iface[1].device='radio0'
wireless.@wifi-iface[1].mode='sta'
wireless.@wifi-iface[1].bssid='C8:D5:FE:C8:61:B0'
wireless.@wifi-iface[1].key='myWifiPasswordHere'
Please note that the wifi network generated by the device in this example (the one called OpenWrt) has no password nor encryption.
This was done because the focus of this article was getting the relay bridge up and running.
You will likely want to set up your device's wifi network in a more secure way, as explained in the WiFi setup page here.