# FreedomBox for Communities/Performance Measurement

Wi-Fi signal strength is susceptible to many factors including obstruction by walls and buildings in between the access point and the mobile device, weather and even the presence of vegetation. Once the Wi-Fi network is setup, it is important to measure the signal strength and network performance to ensure that all the important locations in the community area get good network bandwidth. There are two primary ways to measure this. First is to measure that signal strength and the second is to measure actual bandwidth. Signal strength is easy to measure and is an indicator of performance while bandwidth measurement actually measures the performance.

## Measuring Signal Strength

The power of Wi-Fi signal received is a good indicator of how well a given device will perform on the Wi-Fi network.

The power for the Wi-Fi signal is measured in dBm which is a logarithmic scale with 0 dBm meaning 1mW (1 milliwatt). 10 dBm = 10mW, 20 dBm = 100mW, 30 dBm = 1000mW and so on. Since typical Wi-Fi signal power received by a device is lot more weaker than a 1 mW it is on negative dBm scale where -10 dBm = 100 μW (100 microwatt), -20 dBm = 10 μW, -30 dBm = 1 μW and so on. A typical signal between -40 dBm and -60dBm usually gives an acceptable network performance.

Some devices are better at receiving and transmitting the Wi-Fi signal than others. So on a given spot in space two different devices may actually perform differently even though they are connected to the same Wi-Fi access point receiving same signal strength. This is another reason to actually measure the performance.

### Measuring from Mobile Phone

To measure Wi-Fi signal strength use a mobile device with Android operating system. Due to difference in device capabilities, it is best to make the measurement with the same device or same model of the device. The model of the device should like be an average device used by the community member rather than high-end model. At the least, it is best to check multiple devices in the same spot to see the differences in their capabilities before starting the actual measurement.

To measure, install and use an application that shows the signal strength of the Wi-Fi network at a given point. There are also apps that can also provide heat maps based on signal strength. Roam around the community area and collect the measurements. Some special points of interest include points in the middle of two access points, points obscured by buildings or vegetation etc. Based on the measure it is important to communicate the characteristics of the network to the community members to set their expectations.

## Measuring Bandwidth

Wi-Fi signal strength even when it is measured in dBm is not good enough to understand the quality of the Wi-Fi network at a particular point in the large community area. Measuring bandwidth between the FreedomBox server and the Wi-Fi device in the village is a better way to understand the quality of the Wi-Fi signal.

Iperf3 is a tool that can be used to measure the bandwidth between nodes in a network. We can run iperf3 as a server on FreedomBox that runs all the time so that any time a device wants to measure the bandwidth with FreedomBox it can be done. See iperf3 documentation on how to tweak bandwidth measurement further.

### Setting Up Server

Configure the FreedomBox server to run iperf3 server all the time.

1. Install iperf3 package
```apt install iperf3
```
2. Create a user and a group for iperf3 daemon to run.
```addgroup --system --quiet iperf3
adduser --system --quiet --ingroup iperf3 --no-create-home --home /var/lib/iperf3 iperf3
```
3. Create a systemd service file for running iperf3 as a daemon
```cat << EOF > /etc/systemd/system/iperf3.service
[Unit]
Description=iperf3 daemon
Documentation=man:iperf3(1)
After=network.target

[Service]
ExecStart=/usr/bin/iperf3 --server
Restart=always
RestartSec=60s
User=iperf3
Group=iperf3

[Install]
WantedBy=multi-user.target
EOF
```
4. Enable and run systemd
```systemctl daemon-reload
systemctl enable iperf3
systemctl start iperf3
```
5. Open Firewall port for clients to connect to the server.
```firewall-cmd --zone=internal --add-port=5201/tcp
```

### Testing from Laptop

1. Install iperf3
```apt install iperf3
```
2. Run the client for bandwidth test (where IP address is typically 10.42.0.1)
```iperf3 -c [ip address of server]
```

### Testing from Mobile Phone

1. Install the Magic iperf with iperf3 app.
2. Provide the command as follows (where IP address is typically 10.42.0.1):
```iperf3 -c [ip address of the server]
```