Archived
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3014a45936 | ||
|
|
cda2132d6a | ||
|
|
6c1cc821a0 | ||
|
|
4be064572d | ||
|
|
89d506180d |
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
{ ... }:
|
{ vars, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -12,8 +12,21 @@
|
|||||||
# own setting) so the intent is clear at the build-type level.
|
# own setting) so the intent is clear at the build-type level.
|
||||||
services.tailscale.useRoutingFeatures = "server";
|
services.tailscale.useRoutingFeatures = "server";
|
||||||
|
|
||||||
|
# Advertise the LAN subnet so Tailscale peers can route back to LAN machines.
|
||||||
|
# Must also be approved in the Tailscale admin console (Machines → Edit route settings).
|
||||||
|
services.tailscale.extraUpFlags = [ "--advertise-routes=${vars.lanCidr}" ];
|
||||||
|
|
||||||
# Forwarded subnet-router traffic arrives on tailscale0 already
|
# Forwarded subnet-router traffic arrives on tailscale0 already
|
||||||
# tailscale-authenticated -- the firewall's normal per-port allow-list
|
# tailscale-authenticated -- the firewall's normal per-port allow-list
|
||||||
# would otherwise drop it. Standard NixOS/Tailscale subnet-router guidance.
|
# would otherwise drop it. Standard NixOS/Tailscale subnet-router guidance.
|
||||||
networking.firewall.trustedInterfaces = [ "tailscale0" ];
|
networking.firewall.trustedInterfaces = [ "tailscale0" ];
|
||||||
|
|
||||||
|
# SNAT traffic from LAN machines going out through Tailscale so the remote
|
||||||
|
# peer sees it sourced from this router's Tailscale IP (100.x.x.x) rather
|
||||||
|
# than a raw LAN IP. Without this, Tailscale drops the forwarded packets
|
||||||
|
# because the source is not a recognised Tailscale address.
|
||||||
|
networking.nat = {
|
||||||
|
enable = true;
|
||||||
|
externalInterface = "tailscale0";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
_:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./enable-service.nix ];
|
imports = [ ./enable-service.nix ];
|
||||||
@@ -12,4 +12,24 @@ _:
|
|||||||
# instead of relaying through DERP.
|
# instead of relaying through DERP.
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Tailscale recommends these ethtool flags on the uplink interface to get
|
||||||
|
# full UDP GRO throughput on subnet routers (https://tailscale.com/s/ethtool-config-udp-gro).
|
||||||
|
# The interface is derived from the default route so it works regardless of
|
||||||
|
# what the NIC is named on a given host.
|
||||||
|
systemd.services.tailscale-udp-gro = {
|
||||||
|
description = "Enable UDP GRO forwarding on uplink for Tailscale subnet router";
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
path = [ pkgs.ethtool pkgs.iproute2 ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = pkgs.writeShellScript "tailscale-udp-gro" ''
|
||||||
|
NETDEV=$(ip -o route get 8.8.8.8 | cut -f 5 -d " ")
|
||||||
|
ethtool -K "$NETDEV" rx-udp-gro-forwarding on rx-gro-list off
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user