diff options
Diffstat (limited to 'modules/core/networking')
| -rw-r--r-- | modules/core/networking/default.nix | 22 | ||||
| -rw-r--r-- | modules/core/networking/tailscale.nix | 35 |
2 files changed, 57 insertions, 0 deletions
diff --git a/modules/core/networking/default.nix b/modules/core/networking/default.nix new file mode 100644 index 0000000..5e53759 --- /dev/null +++ b/modules/core/networking/default.nix @@ -0,0 +1,22 @@ +{ secrets, ... }: +{ + imports = [ ./tailscale.nix ]; + + networking = { + nftables.enable = true; + + nameservers = [ + "45.90.28.0#${secrets.nextdns_id}.dns.nextdns.io" + "2a07:a8c0::#${secrets.nextdns_id}.dns.nextdns.io" + "45.90.30.0#${secrets.nextdns_id}.dns.nextdns.io" + "2a07:a8c1::#${secrets.nextdns_id}.dns.nextdns.io" + ]; + + timeServers = [ + "0.nixos.pool.ntp.org" + "1.nixos.pool.ntp.org" + "2.nixos.pool.ntp.org" + "3.nixos.pool.ntp.org" + ]; + }; +} diff --git a/modules/core/networking/tailscale.nix b/modules/core/networking/tailscale.nix new file mode 100644 index 0000000..0228915 --- /dev/null +++ b/modules/core/networking/tailscale.nix @@ -0,0 +1,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 + ''; + }; + }; + }; +} |