This tutorial describes the steps to set up a Dual Channel Wi-Fi (dcwifi) system and verify functionality. The dcwifi server daemon runs on an OpenWrt Wi-Fi Access Point, and this tutorial uses a Raspberry Pi (with an additional USB Wi-Fi adapter) as the dcwifi client.

CONTACT US to order your MCSR™ powered Development Kit.

Server Daemon Setup

Ensure that the OpenWrt Wi-Fi AP has the dcwapd component installed. This will install several additional libraries and components (libdcwprotolibdcwsocketmrmctlkmod-macremapper, …).

It is also recommended, but not strictly required, to install the luci-app-dcwapd application. It is possible to configure the Dual Channel Wi-Fi daemon directly through UCI, but it is easier to use the web-based interface.

Start by configuring 2 Wi-Fi interfaces (Network -> Wireless). Decide which of the interfaces to use as the primary channel, and one of the interfaces as the data channel.

Note – The primary channel interface/SSID will exhibit typical Wi-Fi behavior, but the data channel will be unroutable for non-Dual Channel Wi-Fi clients when the server daemon is enabled.

When selecting SSIDs, any values may be used. If encryption is enabled, ensure that the type and key/password are the same on both Wi-Fi interfaces.

Enable both interfaces.

Below is a summary of the AP Wi-Fi configuration used for this tutorial:

primary
-----------------------
 Interface: wlan1
      SSID: OpenWrt
      Band: 5 GHz
Encryption: WPA2-PSK
  Password: dcwifi123

data
-----------------------
 Interface: wlan0
      SSID: OpenWrt-DCW
      Band: 2.4 GHz
Encryption: WPA2-PSK
  Password: dcwifi123

Next, navigate to the Dual Channel Wi-Fi configuration page (Network -> Dual Channel WiFi).

In the Channel Sets section, ensure that CHANNELSET0 has the correct SSID value selected for the primary channel (OpenWrt). Verify that the Bridge value is correct – this is typically the default LAN bridge (br-lan or similar). Also ensure that the channel set Enable checkbox is checked.

In the Data Channels section, ensure that DATACHANNEL0 has the correct SSID value selected for the data channel (OpenWrt-DCW). Verify that the Bridge value is correct – this is typically a new bridge that will be created by the Dual Channel WiFi daemon (br-dc0 or similar). Also ensure that the correct Interface is selected for the data channel (wlan0).

No changes need to be made in the Filter Sets or Filters sections. This tutorial utilizes the default Filters (filter0and filter1), and the default Filter Set (TFP_Default).

Note – The Filter Sets and Filters sections control which inbound packets are directed over the primary and datachannels. A Filter defines a rule for matching packets. A Filter Set defines a set of Filters to apply, potentially matching a MAC address. Packets that match a Filter Set and Filter are directed over the data channel. Packets that do not match a Filter Set and Filter are directed over the primary channel.

Ensure that the Enable checkbox is checked at the top of the page under General Settings. Click the Save and Applybutton.

Raspberry Pi Client Setup

Note – Dual Channel Wi-Fi requires 2 Wi-Fi interfaces, so assuming that there is a single onboard Wi-Fi interface (Raspberry Pi 3 B+ and Rasperry Pi 4 B for example), you will need an additional USB Wi-Fi device. The Wi-Fi interfaces can be any combination of frequencies (2.4 GHz x 2, 5 GHz x 2, or 2.4 GHz & 5 GHz), as long as the AP has corresponding radios of the same frequency bands.

These instructions were written against a Raspberry Pi 3B+ running Raspbian Stretch Lite (see https://www.raspberrypi.org/downloads/raspbian). They were also verified against a Raspberry Pi 4B running Raspbian Buster Lite.

You can use the full Raspbian if you would prefer a GUI environment.

Install Raspbian

Follow the Installing Operating System Images Guide to download a Raspbian image and write the image to an SD card.

Insert the SD card into the Raspberry Pi, connect a USB keyboard and HDMI cable to the Pi, and power on the TV/Monitor. If possible, also connect an Ethernet cable with a WAN connection so that you can easily update the base OS. Connect power to the Raspberry Pi. You should see the Pi boot sequence on the TV/Monitor.

Raspbian Configuration

At the raspberrypi login: prompt, enter the default login/password (pi/raspberry)

If you have a WAN ethernet connection, update the base OS:

sudo apt-get update
sudo apt-get dist-upgrade

Run the additional base configuration command:

sudo raspi-config
  • Select Network Options -> Network interface names, and ensure that predictable network interface names are DISABLED
  • Select Localisation Options -> Change Wi-Fi Country, and set a value (this seems to be required before onboard Wi-Fi can be enabled?)
  • Select Interfacing Options -> SSH, and ENABLE the SSH server

Wi-Fi Interfaces

Below is a summary of the Raspberry Pi Wi-Fi configuration used for this tutorial:

primary
-----------------------
 Interface: wlan0 (onboard)
      Band: 5 GHz

data
-----------------------
 Interface: wlan1 (USB Wi-Fi adapter)
      Band: 2.4 GHz

Consistent Wi-Fi Interface Ordering

Sometimes the onboard Wi-Fi interface will come up as wlan0, and sometimes the USB Wi-Fi interface will come up as wlan0. This can be problematic, especially if they operate on different frequency bands and they are expected to connect to the correct Dual Channel Wi-Fi primary or data channel.

To fix this problem:

Edit /etc/udev/rules.d/70-persistent-net.rules (create it if it does not exist):

sudo nano /etc/udev/rules.d/70-persistent-net.rules

Add the following contents:

# USB Wi-Fi
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0f:00:*", KERNEL=="wlan*", NAME="wlan1"

# Raspberry Pi onboard Wi-Fi
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b8:27:eb:*", KERNEL=="wlan*", NAME="wlan0"

NOTE: Make sure to modify the MAC address mask (the value of ATTR{address}) for the USB Wi-Fi device that you are using. You can use ifconfig or ifconfig -a to list the interface MAC addresses

NOTE: The MAC address mask (the value of ATTR{address}) of the Raspberry Pi may also have to be modified

Wireless LAN Configuration

Update the DHCP client configuration so that wlan1 does not request an address:

sudo nano /etc/dhcpcd.conf

Add the following lines to the bottom of the file:

interface wlan1
    static ip_address=0.0.0.0/24

Move or remove the default wpa_supplicant.conf configuration file:

sudo mv /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.ORIG

Create a new wpa_supplicant configuration file for the wlan0 interface:

sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

And add the following contents:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
  ssid="OpenWrt"
  psk="dcwifi123"
}

Note: Make sure that you insert the correct ssid and psk values for the primary channel on the AP

Note: Now might be a good time to ensure that the AP is running, configured properly, and reboot the Raspberry Pi (sudo reboot). When the Pi reboots, it should automatically connect wlan0 to the AP primary SSID

Building the Dual Channel Wi-Fi Client (dcstad)

Make sure that the prerequisite build tools are installed:

sudo apt-get install autoconf automake autotools-dev libtool git

Download and unzip the libdcwprotolibdcwsocket, and dcstad sources:

cd ~
wget -O libdcwproto-1.0.0.tar.gz https://codeload.github.com/ewsi/libdcwproto/tar.gz/v1.0.0
wget -O libdcwsocket-1.0.0.tar.gz https://codeload.github.com/ewsi/libdcwsocket/tar.gz/v1.0.0
wget -O dcstad-1.0.0.tar.gz https://codeload.github.com/ewsi/dcstad/tar.gz/v1.0.0
tar xvf libdcwproto-1.0.0.tar.gz
tar xvf libdcwsocket-1.0.0.tar.gz
tar xvf dcstad-1.0.0.tar.gz

Navigate into the libdcwproto-1.0.0 directory, build it, and install it:

cd ~/libdcwproto-1.0.0
./autogen.sh
./configure
make
sudo make install

Navigate into the libdcwsocket-1.0.0 directory, build it, and install it:

cd ~/libdcwsocket-1.0.0
./autogen.sh
./configure
make
sudo make install

Navigate into the dcstad-1.0.0 directory and build it:

cd ~/dcstad-1.0.0
./autogen.sh
./configure
make

The dcstad executable should be located in ~/dcstad-1.0.0/src/

Dual Channel Wi-Fi Operation

On the AP

Ensure that the Dual Channel Wi-Fi AP Daemon has been configured and enabled as described above.

On the Client

Ensure that there is no Ethernet cable is connected, so that the only network connection on the client is the wlan0 interface to the AP Primary SSID.

Use an SSH session (or a direct keyboard/mouse/video connection) to the Client to run the client-side operations.

Start the dcstad Dual Channel Wi-Fi Client Daemon:

cd ~/dcstad-1.0.0/src
sudo LD_LIBRARY_PATH=/usr/local/lib ./dcstad -pwlan0 -dwlan1 -s../scripts/rpi-dcjoin.sh
# or to start the client and run in the background:
# sudo LD_LIBRARY_PATH=/usr/local/lib ./dcstad -pwlan0 -dwlan1 -s../scripts/rpi-dcjoin.sh &

Verifying Operation

On the AP

Remap entries can be verified with the mrmctl show command

Note: Remap rules can be added manually by running:

mrmctl remap TFP_Default <client_wlan0_MAC> <client_wlan1_MAC> br-dc0

Open an SSH session to the AP to run the following operations.

watch -n 1 'ifconfig br-lan; ifconfig br-dc0'

Note: You can also add the individual wlanX interfaces to the watch command, for example:

watch -n 1 'ifconfig br-lan; ifconfig wlan1; ifconfig br-dc0; ifconfig wlan0'

You should see the RX packets and TX packets counters on the br-lan interface steadily increasing. This is normal and due to the SSH connection traffic. The RX packets and TX packets counters on the br-dc0 interface may increment by a small amount when dcstad initiates the Data Channel connection, but this traffic should stop shortly after the connection is established.

On the Client

Open an SSH session to the Client to run the following client-side operations.

Start pinging an IP address:

ping 8.8.8.8

On the client, you should observe the ping command operating normally, and successfully pinging the destination.

On the AP, you should still see the RX packets and TX packets counters on the br-lan interface steadily increasing, but the br-dc0 counters should remain unchanged (since the ping traffic is not sent over the Data Channel, as per the TFP_Default.tfp filter configuration file).

Use Control-C to stop the ping.

Run a curl operation on port 80 or 443:

curl http://www.google.com
curl https://www.google.com

On the client, you should observe the curl command operating normally, and successfully printing the contents of the web page to the console.

On the AP, you should still see the RX packets and TX packets counters on the br-lan interface steadily increasing (due to the SSH traffic), but you should also see a short burst of TX packets on the br-dc0 interface, indicating that the curl traffic was sent over the Data Channel.

Note: You can also perform verification by using the watch command on the Client side to observe the wlan0 and wlan1 traffic

Stopping the Operation

On the AP

Navigate to the Dual Channel Wi-Fi page (Network -> Dual Channel WiFi). Uncheck the Enable checkbox in the General Settings section. Click the Save & Apply button.

On the Client

Use Control-C in the dcstad console to terminate the process.

If the process was forked into the background, use:

sudo kill `pidof dcstad`