I'm building a set of portable OpenWRT nodes which create a mesh via BATMAN-IV. A central router is used to monitor the network and collect information that can be displayed on a tablet. The idea is that you can quickly use this setup to build a mesh-network-to-go wherever you want.
This is working quite well already, but when a user now places those nodes, he/she needs some kind of feedback on the mesh quality. Precisely, the node needs to indicate to the user
- is it still connected to the mesh at all?
- does it still have a good connection to the central node?
Should any of those not be true, the user knows that the node has to be placed closer to the last one.
So, my question is: How can a node measure the quality of it's connection to another node (the central router in this case) in a meaningful way that can be displayed to a user?
What I've found so far:
- You can get the attenuation (
signal
) of the network adapter usingiw dev <mesh-interface> station dump
. That's a good quality indicator, but it only measures the link quality to the next node, not through the mesh to the central router.
root@OpenWrt:~# iw dev if-mesh station dump
Station dc:4e:f4:0a:4a:64 (on if-mesh)
inactive time: 64 ms
rx bytes: 13306109
rx packets: 129950
tx bytes: 170941244
tx packets: 130887
tx retries: 126146
tx failed: 8578
rx drop misc: 990
signal: -34 dBm
signal avg: -32 dBm
Toffset: 18446744070017047128 us
tx bitrate: 86.7 MBit/s MCS 12 short GI
tx duration: 0 us
rx bitrate: 86.7 MBit/s MCS 12 short GI
rx duration: 0 us
expected throughput: 37.536Mbps
mesh llid: 54040
mesh plid: 61489
mesh plink: ESTAB
mesh airtime link metric: 213
mesh connected to gate: no
mesh connected to auth server: no
mesh local PS mode: ACTIVE
mesh peer PS mode: ACTIVE
mesh non-peer PS mode: ACTIVE
authorized: yes
authenticated: yes
associated: yes
preamble: long
WMM/WME: yes
MFP: no
TDLS peer: no
DTIM period: 2
beacon interval:100
short slot time:yes
connected time: 6124 seconds
associated at [boottime]: 169.367s
associated at: 1643892934015 ms
current time: 1643899057675 ms
- Using
batadv-vis -f jsondoc
, you can get a structure of the whole mesh, where every node is annotated with an internal metric value that describes the connection quality between it an the querying node. This is basically what I want, but the metric values behave a little odd sometimes, jumping to bad values while the actual connection quality is still good.
root@OpenWrt:~# batadv-vis -f jsondoc
{
"source_version" : "2021.1-openwrt-1",
"algorithm" : 4,
"vis" : [
{ "primary" : "dc:4e:f4:0a:4a:64",
"neighbors" : [
{ "router" : "dc:4e:f4:0a:4a:64",
"neighbor" : "dc:4e:f4:0a:3e:eb",
"metric" : "1.143" }
],
"clients" : [
"ee:47:c3:2d:41:5b",
"8c:83:e1:81:e1:70",
"dc:4e:f4:0a:4a:65",
"3c:dc:bc:cd:30:db",
"ee:47:c3:2d:41:5b",
"ee:47:c3:2d:41:5b"
]
},
{ "primary" : "dc:4e:f4:0a:3e:eb",
"neighbors" : [
{ "router" : "dc:4e:f4:0a:3e:eb",
"neighbor" : "dc:4e:f4:0a:4a:64",
"metric" : "1.016" }
],
"clients" : [
"c2:c6:8f:55:eb:49",
"c2:c6:8f:55:eb:49",
"c2:c6:8f:55:eb:49"
]
}
]
}
- With
batctl tp <MAC>
, you can run a throughput test to another node. Unfortunately, this works by just sending data over as fast as possible and then calculate throughput by time and data sent. This floods the connection completely and cannot be done every x seconds to display a new measurement to the user.
I'm running BATMAN-IV on OpenWrt 21.02.0. The portable routers are equipped with a multi colored indicator led and a small OLED display, so displaying any kind of information is not an issue.