Skip to content

📦 darkone.host.gateway

The main gateway / router of a local network zone.

Sub-module (gateway/): backup-links.nix, backup uplinks.

  • enable bool Enable gateway features for the current host (dhcp, dns, proxy, etc.)
  • wanSsh.enable bool Public SSH on the WAN interface, to reach a remote gateway not yet on the tailnet
darkone.host.gateway = {
enable = false;
wanSsh.enable = dnfLib.gatewayAwaitsTailnet network zone;
};
  • backupLinks attrs Fallback uplinks, used when the WAN has no link, no lease or no Internet. Name: [a-z][a-z0-9-]*.
    • type enum [ "ethernet" "wifi" ] ethernet: DHCP client on a spare port, always up. wifi: WPA2/WPA3 client, radio off (rfkill) until no preferred link reaches the Internet; SSID and passphrase are read from sops (backup-link/<name>/ssid, backup-link/<name>/psk).
    • interface str Interface carrying the link: neither the WAN, a LAN port nor a hostapd radio.
    • priority ints.between 1 99 Lower is preferred among backup links (route metric 200 + 10 × priority, the WAN staying at 100).
  • linkCheck.targets nonEmptyListOf str IP addresses pinged through each uplink; one answer is enough. IP literals only: the probe must not depend on DNS.
  • linkCheck.interval ints.positive Seconds between two probe rounds.
  • linkCheck.failAfter ints.positive Failed rounds before an uplink is penalised.
  • linkCheck.recoverAfter ints.positive Good rounds before a penalised uplink is restored (hysteresis).
darkone.host.gateway = {
backupLinks.type = null;
backupLinks.interface = "wlp4s0";
backupLinks.priority = 10;
linkCheck.targets = internetProbeTargets;
linkCheck.interval = 10;
linkCheck.failAfter = 3;
linkCheck.recoverAfter = 6;
};

Source: modules/mixin/host/gateway.nix 🡕