Configuring Homeplug from Linux
Thu, 23 May 2019 22:42:08 +0000
The new house doesn't have structured cabling, and I won't be doing anything to address that until we start work on the extension. In the meantime, therefore, we're using Homeplug AV (networking over the power line). I had two plugs, I needed a third so I bought the cheapest one I could find on Ebay.
When it turned up it had no buttons - which made it a little difficult to add to the existing network. Usually you press the "pair" button on the new plug and then on the existing plug and count to ten and wave a dead chicken around[*] and do a little dance, but that doesn't work when there is no button. Here's how to do it, assuming (1) it's an Intellon chipset, and (2) you have a Linux or other Unix-like box with an ethernet adaptor to plug it into.
2. Pick 8 random bytes to use for your encryption key. I did
count=1 if=/dev/random |od -x. This is a shared secret which you
will need to install on all your adaptors, so probably you should save
it somewhere until you're done. Note: the faifa source code
seems to suggest that the key you provide is further hashed before
being used, so maybe any amount of random stuff is OK here and there's
no need to be precious about the format.
3. For each adaptor you want to configure, you will need its MAC address. Hopefully this is printed somewhere on the device itself: I don't know how to get it programmatically.
4. Plug the first adaptor into the mains and attach it to the machine where you built faifa. Now run it
$ sudo faifa -i enp0s31f6 -m
5. You should get a long list of "supported frames" which I will assume
are about as meaningful to you as they were to me, followed by a
prompt to choose one. If you were to choose, for example,
(which is "Get Device/SW Version Request), it might respond something
Choose the frame type (Ctrl-C to exit): 0xa000 Frame: Get Device/SW Version Request (0xA000)
Dump: Frame: Get Device/SW Version Confirm (A001), HomePlug-AV Version: 1.0 Status: Success Device ID: INT6400, Version: INT6000-MAC-4-1-4102-00-3679-20090724-FINAL-C, upgradeable: 0
6. To set the encryption key, the frame type is
0xa050 (Set Encryption Key Request). It prompts you further for "local or remote" (I have no idea what this means, but "local" worked), for the key itself, and for the MAC address.
Choose the frame type (Ctrl-C to exit): 0xa050 Frame: Set Encryption Key Request (0xA050) Local or distant setting ? 0: distant 1: local 1 AES NMK key ?0001020304050607 Destination MAC address ?b0:48:7a:b9:00:00
Dump: Frame: Set Encryption Key Confirm (A051), HomePlug-AV Version: 1.0 Status: Success
7. Repeat for the next adapter, until you have done them all.
I make no claim that this is correct, but it seems to work for me, and now I can plug my new Odroid C2 (I'll write about that another time, but there's little to say so far, it just runs Kodi) into the TV without the use of a 5m HDMI cable.
[*] make sure it's dead. Waving a live chicken is stressful for all involved.