CoreRAD is pretty rad

Posted on Feb 11, 2024

I’m currently working on replacing my router with a newer machine running NixOS. While preparing the necessary configuration I discovered mdlayher/corerad, which looks like a modern replacement for radvd.

The configuration is done in toml and is pretty straight forward. A basic configuration (very similar to the reference configuration) might look like this:

[[interfaces]]
  name = "eth1"
  advertise = true

  [[interfaces.prefix]]
    prefix = "2001:db8::/64"

[[interfaces]]
  name = "eth2"
  advertise = true

  [[interfaces.prefix]]
    prefix = "2001:db8:1::/64"

[debug]
address = "localhost:9430"
prometheus = true

I haven’t tested the above as I’ve used the NixOS DSL to configure the service. Above should look something like this in nix:

{ config, libs, ... }:
{
  services.corerad.enable = false;

  services.corerad.settings = {
    interfaces = [
      {
        name = "eth1";
        advertise = true;
        prefix = [{ prefix = "2001:db8::/64"; }];
      }
      {
        name = "eth2";
        advertise = true;
        prefix = [{ prefix = "2001:db8:1::/64"; }];
      }
    ];

    debug = {
      address = "localhost:9430";
      prometheus = true;
    };
  };
}

A few things are implied in the above – like that the machine running CoreRAD is the router and DNS server, for example. These parameters can be changed if needed, but for most home applications (like mine) this is a correct assumption.

One final perk is that we can scrape prometheus metrics, and that there’s already a Grafana dashboard to start from.