Skip to content

Instantly share code, notes, and snippets.

@frobware
Last active March 22, 2026 19:20
Show Gist options
  • Select an option

  • Save frobware/12cd7b36856d9cbf8394fc53017f88e5 to your computer and use it in GitHub Desktop.

Select an option

Save frobware/12cd7b36856d9cbf8394fc53017f88e5 to your computer and use it in GitHub Desktop.
accept routes

❯ And how did I advertise the local LAN?

● Let me check the NixOS configuration for tailgate01.

● Searched for 2 patterns, read 1 file (ctrl+o to expand)

● The route is advertised via the services.tailscale-gateway NixOS module at line 50-56. Let me find the module to show you the details.

● Searched for 1 pattern, read 1 file (ctrl+o to expand)

● Here's the chain:

  1. hosts/tailgate01/configuration.nix:50-56 — enables the tailscale-gateway module with defaults:
  services.tailscale-gateway = {
    enable = true;
    # advertisedRoutes defaults to host's network (192.168.7.0/24)
  };
  2. modules/services/tailscale-gateway.nix:70-73 — the advertisedRoutes option defaults to the host's own network, derived from IPAM:
  advertisedRoutes = mkOption {
    default = [ (getHostNetwork config.networking.hostName) ];
  };
  3. modules/services/tailscale-gateway.nix:28-40 — getHostNetwork looks up the host's IP via ipam.lib.getHostIP, strips the last octet, and appends .0/24:
  getHostNetwork = hostname:
    let hostIP = ipam.lib.getHostIP hostname;
        match = builtins.match "([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+" hostIP;
    in "${builtins.head match}.0/24";
  4. modules/services/tailscale-gateway.nix:258 — the advertised routes are passed as --advertise-routes=192.168.7.0/24 flags to tailscale up:
  ++ map (route: "--advertise-routes=${route}") cfg.advertisedRoutes;

  So the LAN route is never explicitly specified anywhere — it's automatically derived from the host's IP address in IPAM. Since tailgate01's IP is on 192.168.7.x, the
   module computes 192.168.7.0/24 and passes it to tailscale up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment