Dashboard: sort devices by hostname

This is absolutely amazing! Thank you so much for releaseing this!

would it be possible to add the feature to sort the devices by hostname in the dashboard?

I noticed when my prototype device rejoins after a day offline, it gets a new IP address but I end up with multiples of the same hostname in the device list, is it possible to get the device list to keep the hostname and update the IP rather than adding a new entry with the new IP and same hostname?

Hello @Alternitech,

Thank you for posting and for the kind words.

would it be possible to add the feature to sort the devices by hostname in the dashboard?

Yes, we will implement this eventually.

I noticed when my prototype device rejoins after a day offline, it gets a new IP address but I end up with multiples of the same hostname in the device list, is it possible to get the device list to keep the hostname and update the IP rather than adding a new entry with the new IP and same hostname?

This is actually unexpected, if your device has persistent storage (I assume linux) i.e. /var/lib/husarnet folder is kept intact between reboots etc. it should reuse previous IPv6 address.

So this means husarnet generates new ID each time, and from Dashboard POV it’s completely new device. So the Dashboard has no way figuring out it’s the same device, and thus updating hostname (in other words the devices are identified by their fc94: IPv6 addresses).

Best regards,
Szymon

Hey ympek,

Thank you for the reply..

Ah sorry I should have stated my setup, it is an ESP32-S3.

I could probably store the IPv6 address locally and try to reconnect with the same IP - If the IP changes, is there a way of getting the ESP32 to remove itself from the dashboard and re-register to obtain a new IPv6 (keeping the dashboard list clear of dupilcates)?

I am making a Communications Badge like in Star Trek, that uses WiFi & mobile radio (sim card with 4g/5g/starlink) to connect to the internet, using Husarnet all badges are in the same vpn and thus contactable anywhere in the world (or maybe even in space)..

Currently the hostname for each badge is derived from its ESP32 chipID (MAC + serial number of the ESP32) so each badge has a unique identifier that is stored along with the current IPv6 address, this is then published via self hosted mqtt on each badge to only known contacts.

Regards

Daniel

This sound like super fun project! Good luck!

After IP change ESP32 will be unable to unclaim the “old self”, as one IP=one unique device from Dashboard POV.
So it would be the best to somehow get the ESP to store husarnet ID in flash permanently.

But this can be solved the other way. If the hostnames are actually unique you could keep your Dashboard tidy by using the Dashboard API and some simple automation.
For example, using some non-ESP32 device (e.g. your laptop or some always-on rpi), enable AccountAdmin flag on the device (in the Dashboard) and set up a script that will periodically (eg. every minute or so):

  • request device list on your account (for example, as json): sudo husarnet --json device ls | jq .payload

  • see if there are any duplicates

  • if duplicate is found, check which one of the duplicates have more recent date in lastContact field

  • remove the older one via sudo device unclaim <DEVICE_IP>

The caveat is that the API described above is not yet in stable, so this “manager device” would have to run nightly version of Husarnet (current 2.0.339). Nightly versions can be obtained here and some things might not work. But this way IP addresses on the esp32 could be ephemeral with no problems.

Hope that helps a little. Happy Easter!

BR,
ympek

Thanks! If your’e interested you can find out more here: VoxAir | AlterniTech

Ah ok, they both seem like fairly elegant solutions!

I will try storing the address locally and reconnect with that first, if that doesn’t work then I will explore options for an always-on-manager..

Is there a timeout on the IPv6 addresses?

Thank you for the detailed answer!

Happy Easter!