Builds a GeoLite2-ASN-compatible MaxMind database (dn42-asn.mmdb) from a dn42 registry checkout.
It maps every registered prefix (data/route/, data/route6/) to its origin ASN and the ASN's as-name (data/aut-num/), so flow collectors and anything else speaking MaxMind MMDB can enrich DN42 traffic the same way they enrich public internet traffic with GeoLite2-ASN.
The records carry the exact GeoLite2-ASN structure (autonomous_system_number, autonomous_system_organization) and metadata type GeoLite2-ASN, so any MaxMind reader accepts the file unchanged.
All registry sources are included (DN42, ICVPN, NEONETWORK, CRXN, CHAOSVPN). When a prefix has multiple origins, the numerically lowest ASN wins and a warning is printed. Overlapping prefixes resolve by longest-prefix match, like BGP.
Pre-built releases are automatically built and published every week driven by GitHub Actions. You can download the latest database and SHA-256 checksum from GitHub Releases:
curl -LO https://github.com/no42-org/dn42-mmdb/releases/latest/download/dn42-asn.mmdb
curl -LO https://github.com/no42-org/dn42-mmdb/releases/latest/download/dn42-asn.mmdb.sha256
sha256sum -c dn42-asn.mmdb.sha256A Systemd service and timer unit are included in systemd/ to fetch and verify the latest release weekly:
# Copy systemd unit files
sudo cp systemd/dn42-mmdb-update.service /etc/systemd/system/
sudo cp systemd/dn42-mmdb-update.timer /etc/systemd/system/
# Enable and start weekly timer (runs Mondays at 04:00 UTC)
sudo systemctl daemon-reload
sudo systemctl enable --now dn42-mmdb-update.timerTo run an immediate update manually:
sudo systemctl start dn42-mmdb-update.serviceThis repository includes a flake.nix for Nix and NixOS users:
Drop into a pre-configured development environment:
nix developBuild or run the database generator directly:
nix build
nix run . -- --registry /path/to/registry -o dn42-asn.mmdbImport the module in your NixOS configuration to enable automated weekly updates:
{
inputs.dn42-mmdb.url = "github:no42-org/dn42-mmdb";
outputs = { self, nixpkgs, dn42-mmdb, ... }: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
modules = [
dn42-mmdb.nixosModules.default
{
services.dn42-mmdb = {
enable = true;
autoUpdate.enable = true;
};
}
];
};
};
}You need a dn42 registry git checkout which requires an account:
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/python build_asn_mmdb.py --registry /path/to/registry -o dn42-asn.mmdbThe script prints a summary on success and exits non-zero if nothing could be built:
wrote dn42-asn.mmdb: 2536 IPv4 + 2602 IPv6 prefixes, 2551 ASNs, 0 skipped
The database is a snapshot of the registry checkout. After pulling registry updates, rebuild and redeploy:
git -C /path/to/registry pull
.venv/bin/python build_asn_mmdb.py --registry /path/to/registry -o /usr/share/GeoIP/dn42-asn.mmdbAdd the file as an extra GeoIP database in Riptide, no other configuration needed:
geoip:
databases:
- /usr/share/GeoIP/GeoLite2-ASN.mmdb
- /usr/share/GeoIP/GeoLite2-City.mmdb
- /usr/share/GeoIP/dn42-asn.mmdb