I recently blogged on the trials and tribulations (and gotchas) of using HomePlug AV to glue bits of network together around the house without having to run UTP around the place.
One of the comments I’d made in that article was about monitoring and logging the node-to-node speeds between the HomePlug bridges. Obviously, being a consumer product, they come with a pretty (and depending on your PoV, awful) GUI.
How was the information being gathered by the GUI? Turns out it’s using a Layer 2 protocol, so I cracked out Wireshark.
The head and tail of it is that the requesting station sends a L2 broadcast frame of ethertype 0x88e1 (Homeplug AV), containing a network info request.
The HomePlug bridges reply to the MAC address originating the broadcast with a network info confirmation – there are other sorts of management frames (such as read module data and get device/sw version), but this is the bit we’re interested in, containing the negotiated speed between each pair of bridges.
The speeds are plain hex values, which occur in certain places in the frame.
The number of networks (and therefore how many instances of “Networks informations“) to expect are in byte 21 of the frame, and the number of AV stations in a network is embedded in byte 17 of the Networks Informations, so you then know how many sets of stations informations to expect.
In the stations informations the address of the far end HomePlug bridge is in the first 6 bytes, while the TX rate is in byte 14, and the RX in byte 15.
It should therefore, maybe with a bit of scripting, be possible to grab those values and write them into a rrd or something like that, and make graphs, rather than have to fire up a GUI which only helps you in realtime. But here I am talking about banging away with my awful scripting crafting specific L2 frames and interpreting what comes back using regex matching and chomp. Surely someone’s done something like this before, and come up with something more elegant?
Well it turns out, github is your friend, as it seems are the people at Qualcomm Atheros who make the chips inside a lot of the HomePlug devices.
They’ve put up something called Open Powerline Utils – which I think may be able to do the job I want.
So, when I get a free evening, I’ll have a read of the docs and see what can be boshed together using this toolset rather than some ugly scripts.