Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WiFiMon Hardware Probes (WHP) are used for to gather performance measurements in a WiFi network from dedicated small form factor devices which are installed in fixed points. WiFiMon tested its operation and recommends the use of Raspberry Pi’s v3 Model B+ or v4. 

WHP configuration

WiFiMon Hardware Probe will work in the following configuration:

WiFiMon Raspberry Pi image given above is a custom version of Raspbian Stretch with desktop, with the default Raspberry Pi credentials (user: pi, password: raspberry).

We advise the user to secure Raspberry Pi by changing the default password (more details are given below in Step 3).

Setting up the WHP

There are two options for the WHP installation:

  1. Installation and configuration from the prepared WiFiMon WHP image (Installation option 1)
  2. Installation and configuration on the Raspberry Pi with already installed Raspberry Pi OS (Stretch or later) (Installation option 2)

Installation and configuration
Anchor
Option 1
Option 1

The following steps apply for both installation options. WiFiMon users who will use the prepared WHP image (installation option 1) should simply edit the crontab and wireless.py files as discussed in the following. WiFiMon users who will not use the prepared WIFiMon WHP image (installation option 2) should follow the steps 2 up to 4.

...

Step 1: Write the image to the micro SD card

Follow the instructions at the official Raspberry Pi site. Skip the "Download the image" step and use the WiFiMon Raspberry Pi operating system image instead (download size is approx. 8 GB).

WiFiMon Raspberry Pi image given above is a custom version of Raspberry Pi OS (Buster) with desktop, with the default Raspberry Pi credentials (user: pi, password: raspberry).

We advise the user to always secure Raspberry Pi by changing the default password.

Step 2: Start the Raspberry Pi

Follow the simple steps below:

  • Insert the microSD in the Raspberry Pi
  • Plug the USB keyboard into one of the USB ports (or USB wireless adapter for keyboard and mouse)
  • Plug the USB mouse into one of the USB ports
  • Connect the monitor cable to the Pi's HDMI port
  • Plug the power supply into a socket and connect it to the micro USB power port

You should see a red light on the Raspberry Pi and raspberries on the monitor. The WiFiMon Hardware Probe will boot up into a graphical desktop.

Step 3: Configure the

...

Raspberry Pi
Anchor
Step3
Step3


Secure your the Raspberry Pi by changing the default password. Optionally, you may enable SSH to access the command line of a Raspberry Pi remotely or setup remote desktop. Next, you have to connect to the wireless network you want to measure.

First, the following programs should be downloaded:

Code Block
sudo apt-get update
sudo apt-get install -y xvfb firefox-esr

The WiFiMon Hardware Probe (WHP) regularly performs performance tests against towards the WiFiMon Test Server (WTS) in an automated manner, thus simulating end users from a fixed location in the monitored WiFi network. To that end, WHPs leverage on a crontab script. Within the crontab script, the tests that will be executed (NetTest/boomerang/speedtest) should be defined. It uses crontab to schedule the tests. To do that, open the terminal (as user "pi") and enter the command:crontab -e. You will see the following code block. You are required to modify the parts of the crontab that are denote

19,39,59 * * * * export DISPLAY=:0 && firefox --new-window https://www.google.com >/dev/null 2>&1

have to pick the text editor. Then scroll to the bottom of the file and add the following code block (which you will modify as explained below):

Code Block
languagebash
00,10,20,30,40,50 * * * * Xvfb :100 &
02,12,22,32,42,52 * * * * export DISPLAY=:100 && firefox-esr --new-tab 

...

URL_TO_nettest.html >/dev/null 2>&1

...


04,

...

14,

...

24,

...

34,

...

44,54 * * * * export DISPLAY=:100 && firefox-esr --new-tab URL_TO_speedworker.html >/dev/null 2>&1

...


06,

...

16,

...

26,

...

36,

...

46,56 * * * * export DISPLAY=:100 && firefox-esr --new-tab URL_TO_boomerang.html >/dev/null 2>&1

...


08

...

,18,

...

28,

...

38,

...

48,

...

58 * * * * /home/pi/wireless.py >> ~/cron.log 2>&1

...

18,38,58 * * * * scripts/kill-firefox.sh >/dev/null 2>&1

10 0 * * 0 scripts/pi-reboot.sh >/dev/null 2>&1

You have to modify the following parts of the crontab in lines 2-4:

  • URL_TO_nettest
  • URL_TO_speedworker
  • URL_TO_boomerang

You should put the URL or IP address of the WTS in which the NetTest, speedtest and boomerang JS scripts are injected. Details about the configuration of the WiFiMon testtools are included in the WiFiMon Test Server (WTS) installation documentation. Following the assumptions/notations of the WTS guide, examples of the URLs for NetTest, speedtest and boomerang respectively are (i) https://WTS_FQDN/wifimon/measurements/nettest.html, (ii) https://WTS_FQDN/wifimon/measurements/speedworker.html and (iii) https://WTS_FQDN/wifimon/measurements/boomerang.html.

Line 5 of the crontab is related to the streaming of wireless network interface metrics to the WiFiMon Analysis Server (WAS). Optionally, the intervals of the WHP measurements could be altered by appropriately configuring the crontab so that measurement are more or less frequent. The configuration of the crontab config given above sets up 10-minute intervals between the measurements of each test tool in a way in which there are no overlapping measurements.

Note:

Depending on the available tests (or WiFiMon-enabled pages), you can specify which tests will be executed and when. You may also see an example. It is advised to visit the test pages with Mozilla Firefox in case Adding Security Exceptions are necessary, e.g. when certificates are not trusted. This will ensure that SSL-related errors will not prevent the WiFiMon HW Probe from visiting these pages.

Step 4: Streaming Wireless Network Interface Metrics to the WiFiMon Analysis Server (WAS)
Anchor
Step4
Step4

In /home/pi, you will find the Python script wireless.py. The contents of the script are the following:

Code Block
languagepy
firstline1
titlewireless.py
linenumberstrue
#!/usr/bin/python

import subprocess
import datetime
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

def return_command_output(command):
    proc = subprocess.Popen(command, stdout = subprocess.PIPE, shell = True)
    (out, err) = proc.communicate()
    out_without_carriage_return = out.rstrip('\n')
    return out_without_carriage_return

def parse_iwconfig():
    command1 = "sudo iwconfig wlan0 | grep \"Link Quality\""
    command1_output = return_command_output(command1)
    command1_output = ' '.join(command1_output.split())
    command1_parsed = command1_output.split(" ")
    link_quality = command1_parsed[1].split("=")[1]
    link_quality = link_quality.split("/")[0]
    signal_level = command1_parsed[3].split("=")[1]
    command2 = "sudo iwconfig wlan0 | grep \"Tx-Power\""
    command2_output = return_command_output(command2)
    command2_output = ' '.join(command2_output.split())
    command2_parsed = command2_output.split(" ")
    bit_rate = command2_parsed[1].split("=")[1]
    tx_power = command2_parsed[3].split("=")[1]

    timestamp = int(datetime.datetime.now().strftime("%s")) * 1000
    probeNo = "WHP_NUMBER"

    headers = {'content-type':"application/json"}
    data = "{\"timestamp\":" + str(timestamp) + ", \"bitRate\":" + bit_rate + ", \"txPower\":" + tx_power + ", \"linkQuality\":" + link_quality + ", \"signalLevel\":" + signal_level + ", \"probeNo\":\"" + probeNo + "\"}"
    try:
        session = requests.Session()
        session.verify = False
        session.post(url='https://WAS_FQDN:8443/wifimon/probes/', data=data, headers=headers, timeout=15)
    except:
        pass
    return None

if __name__ == "__main__":
    parse_iwconfig()

User has to edit lines 31 and 38 according to their setupthe network configuration of the key WiFiMon components. In line 31, "WHP_NUMBER" should match the number assigned to the testtools of the particular WiFiMon Hardware Probe (WHP), e.g. for the WHP assigned the number 1, the value should be "1". Assigning numbers to WHPs WHPs is possible by appropriately setting the testtool attribute included in the websites monitored by them. More information related to assigning number to WHPs WHPs is available in the WiFiMon Test Server installation guide. In line 38, "WAS_FQDN" should match the FQDN of the WiFiMon Analysis Server (WAS) responsible for processing the wireless performance metrics of the WHP. The above code block assumes that the WAS uses the WiFiMon Secure Agent. In case of using the WiFiMon Non-Secure Agent, the URL of line 38 should be modified; instead of " https ", the WiFiMon Non-Secure Agent requires "http" and the port on which the WAS listens is "9000" instead of "8443"port 8443. It is possible to use http in which case WAS listens on port 9000 instead of 8443.

That's all! At this point you may (optionally) unplug the keyboard, the mouse and the monitor and let the WHP measure the performance of your wireless network!

Security Issues

We suggest that you take additional efforts to safeguard the security of your probes:

  • Set the password for the "pi" user and the "root" user of the WiFiMon Hardware Probe.
  • Disable auto-login to the WiFiMon Hardware Probe. Open the terminal and type "sudo raspi-config". Then, from the third line "Boot Options", select "B1. Desktop / CLI" and then "B3. Desktop".
  • When connecting to your Wi-Fi network, your password will be stored as plaintext to the file "/etc/wpa_supplicant/wpa_supplicant.conf". Use the following commands to hash your ESSID and password:
Code Block
languagebash
set +o history
wpa_passphrase YOUR_ESSID YOUR_PASSWORD
set -o history

A "psk=....." line will be generated. Add this line in /etc/wpa_supplicant/wpa_supplicant.conf under your ESSID and delete the plaintext password.

  • Default user "pi" comes with sudo privileges. You can remove them with the following commands from the "root" user:
Code Block
languagebash
delgroup pi sudo
rm /etc/sudoers.d/010_pi-nopasswd
  • Convert the privileges of the "/etc/wpa_supplicant/wpa_supplicant.conf" to "600".
  • You may configure a firewall to further protect your device.