summaryrefslogtreecommitdiff
path: root/modules/core/networking/tailscale.nix
blob: 0228915ae3dd96d99f2b15c7ac20f8639cd59cda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  config,
  lib,
  pkgs,
  ...
}:
{
  networking.firewall.trustedInterfaces = [ "${config.services.tailscale.interfaceName}" ];

  # <https://tailscale.com/kb/1019/subnets/?tab=linux#step-1-install-the-tailscale-client>
  boot.kernel.sysctl = {
    "net.ipv4.ip_forward" = true;
    "net.ipv6.conf.all.forwarding" = true;
  };

  services = {
    tailscale = {
      enable = true;
      useRoutingFeatures = "both";
      authKeyFile = config.sops.secrets.tailscale_authentication_key.path;
    };

    networkd-dispatcher = {
      enable = true;

      rules."50-tailscale" = {
        onState = [ "routable" ];

        script = ''
          ${lib.getExe pkgs.ethtool} -K enp42s0 rx-udp-gro-forwarding on rx-gro-list off
        '';
      };
    };
  };
}