Loading...
 

Configuring wireless network on ESPRESSObin

Prerequisites

 

 NOTE

The instructions on this page have been tested to work with openwrt-dd 17.06. Some difficulties were reported with using this WiFi module on openwrt-dd 17.10.


Depending on the type of the wireless card, additional driver may be required. These can be found under the Kernel modules section:

Kernel modules  --->
Wireless Drivers  --->


Wireless card used in this tutorial is Marvell's 88W8897 Wi-Fi based module which uses mwlwifi driver (kmod-mwlwifi).

Basic configuration


Once you have built the image with the required drivers and booted the board, you can check if the wifi module was detected correctly using the lspci command:

root@OpenWrt:~# lspci

00:00.0 Ethernet controller: Marvell Technology Group Ltd. 88W8897 [AVASTAR] 802.11ac Wireless


If the wireless card is detected correctly, use the iw command to confirm that the driver was loaded correctly as well:

root@OpenWrt:~# iw list

Wiphy phy0
max # scan SSIDs: 4
max scan IEs length: 2242 bytes
max # sched scan SSIDs: 0
max # match sets: 0
Retry short limit: 7
Retry long limit: 4
Coverage class: 0 (up to 0m)
Device supports T-DLS.
Available Antennas: TX 0 RX 0
Supported interface modes:
 * managed
 * AP
 * AP/VLAN
 * monitor
Band 1:
Capabilities: 0x106f
RX LDPC
HT20/HT40
SM Power Save disabled
RX HT20 SGI
RX HT40 SGI
No RX STBC
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 TX/RX MCS rate indexes supported: 0-15, 32
VHT Capabilities (0x33813930):
Max MPDU length: 3895
Supported Channel Width: neither 160 nor 80+80
...


Basic wireless config is created by default, but wireless interfaces are disabled. To enable them either change the option disabled to 0 manually in /etc/config/wireless:

config wifi-device 'radio0'
option type 'mac80211'
option channel '36'
option hwmode '11a'
option path 'soc/d0070000.pcie/pci0000:00/0000:00:00.0'
option htmode 'VHT80'
option disabled '1' # Change this to '0'

config wifi-iface
option device 'radio0'
option network 'lan'
option mode 'ap'
option ssid 'OpenWrt'
option encryption 'none'


or change it via UCI:

uci set wireless.radio0.disabled='0' && uci commit wireless


UCI commands will be used for the rest of tutorial.

 Note

There might be more that one radios depending on the type of wifi module used. If that is case, you will need to enable all radios individually.


It is also recommended that you change the default SSID and add encryption:

uci set wireless.@wifi-iface[0].ssid='My ESPRESSObin AP'
uci set wireless.@wifi-iface[0].encryption='psk2'
uci set wireless.@wifi-iface[0].key='xxxxxxxxxx'
uci commit wireless


In cases where multiple radios/interfaces are available, you can just replace the array value to change value on the different interface, e.g:

# Radio 0
uci set wireless.@wifi-iface[0].ssid='My ESPRESSObin AP 2.4 GHz'

# Radio 1
uci set wireless.@wifi-iface[1].ssid='My ESPRESSObin AP 5 GHz'


Full configuration listing all available options can be obtained with uci show command:

root@OpenWrt:~# uci show wireless

wireless.radio0=wifi-device
wireless.radio0.type='mac80211'
wireless.radio0.channel='36'
wireless.radio0.hwmode='11a'
wireless.radio0.path='soc/d0070000.pcie/pci0000:00/0000:00:00.0'
wireless.radio0.htmode='VHT80'
wireless.radio0.disabled='1'
wireless.@wifi-iface[0]=wifi-iface
wireless.@wifi-iface[0].device='radio0'
wireless.@wifi-iface[0].network='lan'
wireless.@wifi-iface[0].mode='ap'
wireless.@wifi-iface[0].ssid='My ESPRESSObin AP'
wireless.@wifi-iface[0].encryption='psk2'
wireless.@wifi-iface[0].key='1122334455'


Once the changes are saved, restart the network with the wifi command:

root@OpenWrt:~# wifi

root@OpenWrt:~# [ 2160.322391] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 2160.329766] br-lan: port 3(wlan0) entered blocking state
[ 2160.335232] br-lan: port 3(wlan0) entered disabled state
[ 2160.340657] device wlan0 entered promiscuous mode
[ 2161.609345] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

 

Advanced configuration


The iw command is used to determine the capabilities of the wifi module, such as supported modes, channels, etc:

root@OpenWrt:~# iw dev
phy#0
Interface wlan0
ifindex 13
wdev 0x5
addr 10:a5:d0:98:da:2c
ssid My ESPRESSObin AP
type AP
channel 36 (5180 MHz), width: 80 MHz, center1: 5210 MHz
txpower 20.00 dBm


Use iw list for a more detailed output.

AP + STA


If your wifi module supports station (STA) mode, it is possible to combine multiple modes on the same radio.

For example, we can create a new WAN section in /etc/config/wireless which will be configured for the station mode:

...
option ssid 'My ESPRESSObin AP'
option encryption 'psk2'
option key '1122334455'

# New section:

config wifi-iface
option device 'radio0'
option network 'wan'
option mode 'sta'
option ssid 'xxxxxxxx'
option encryption 'xxx'
option key 'xxxxxxxx'


Replace the x's above with the existing values of the wireless network to which you are connecting.

We plan to use wlan0 as WAN interface and wlan0-1 as an access point. We will edit the /etc/config/network configuration file to bridge the existing WAN port to LAN so that the entire switch consist of LAN-only ports:

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option default_ps '0'
option ula_prefix 'fd36:3cdf:47bb::/48'

config interface 'lan'
option type 'bridge'
option ifname 'lan0 lan1 wan' # Add wan interface to LAN section
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
#option ifname 'wan' # Since we now have 2 interfaces on the WAN (wan/wlan0), we will comment out existing one
option proto 'dhcp'

config interface 'wan6'
option ifname 'wan'
option proto 'dhcpv6'


Restart the network:

/etc/init.d/network restart


Finally we should have the following:

br-lan    Link encap:Ethernet  HWaddr 00:50:43:01:02:05  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::250:43ff:fe01:205/64 Scope:Link
          inet6 addr: fd36:3cdf:47bb::1/60 Scope:Global
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:606 (606.0 B)

eth0      Link encap:Ethernet  HWaddr 00:50:43:01:02:03  
          inet6 addr: fe80::250:43ff:fe01:203/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:532 
          RX bytes:0 (0.0 B)  TX bytes:1636 (1.5 KiB)
          Interrupt:8 

lan0      Link encap:Ethernet  HWaddr 00:50:43:01:02:05  
          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)

lan1      Link encap:Ethernet  HWaddr 00:50:43:01:02:06  
          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)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:352 errors:0 dropped:0 overruns:0 frame:0
          TX packets:352 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:23992 (23.4 KiB)  TX bytes:23992 (23.4 KiB)

wan       Link encap:Ethernet  HWaddr 00:50:43:01:02:04  
          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)

wlan0     Link encap:Ethernet  HWaddr 12:A5:D0:98:DA:2C 
          inet addr:192.168.0.29  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::2c0:caff:fe67:b98e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:330 errors:0 dropped:0 overruns:0 frame:0
          TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:78010 (76.1 KiB)  TX bytes:7766 (7.5 KiB)

wlan0-1   Link encap:Ethernet  HWaddr 12:A5:D0:98:DA:2C
          inet6 addr: fe80::c0:caff:fe67:b98e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:2152 (2.1 KiB)


Where lan0, lan1 and wan interfaces are bridged together (br-lan) and serve as LAN ports. We are connected to the existing network over wlan0 which is used as WAN (wireless) port, and wlan0-1 is our My ESPRESSObin AP access point.