Files
nixfiles/nixos/boxes/colony/vms/whale2/default.nix
T
jackos1998andClaude Opus 5.5 6996096765
CI / Check, build and cache nixfiles (push) Successful in 1h17m9s
Update docs / update (push) Failing after 1m10s
nixos: Use BBR for TCP sent from colony and home
`estuary`'s port in ColoClue DC6 loses bursts of packets whenever the
members switch floods other members' traffic to it. CUBIC treats each
burst as congestion and takes 20-30 s to recover, longer than the gap
between floods. BBR keeps going. Between `estuary` and `river`, it
averaged 899 Mbit/s against CUBIC's 258 Mbit/s downloading from
colony, and 185 against 149 Mbit/s uploading to it.

Add a `my.network.bbr` option. Congestion control is chosen by the
sender, so enable it on the colony boxes that send data off-box
(`colony`, `shill` and its `middleman` proxy, `git`, `whale2`), and
for uploads on `castle` and the home routers. Forwarded traffic isn't
affected, so the routers only gain for their own connections and
`estuary` is left alone. BBR paces itself, so the default qdisc
stays.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 18:11:53 +00:00

185 lines
5.0 KiB
Nix

{ lib, ... }:
let
inherit (builtins) mapAttrs;
inherit (lib.my) net;
inherit (lib.my.c.colony) domain prefixes;
in
{
nixos.systems.whale2 = {
system = "x86_64-linux";
nixpkgs = "mine";
assignments = {
routing = {
name = "whale-vm-routing";
inherit domain;
ipv4.address = net.cidr.host 3 prefixes.vms.v4;
};
internal = {
name = "whale-vm";
altNames = [ "oci" ];
inherit domain;
ipv4 = {
address = net.cidr.host 2 prefixes.vip1;
mask = 32;
gateway = null;
genPTR = false;
};
ipv6 = {
iid = "::3";
address = net.cidr.host 3 prefixes.vms.v6;
};
};
oci = {
name = "whale-vm-oci";
inherit domain;
ipv4 = {
address = net.cidr.host 1 prefixes.oci.v4;
gateway = null;
};
ipv6.address = net.cidr.host 1 prefixes.oci.v6;
};
};
extraAssignments = mapAttrs (n: i: {
internal = {
name = n;
inherit domain;
ipv4.address = net.cidr.host i prefixes.oci.v4;
ipv6.address = net.cidr.host i prefixes.oci.v6;
};
}) {
valheim-oci = 2;
simpcraft-oci = 3;
simpcraft-staging-oci = 4;
enshrouded-oci = 5;
kevcraft-oci = 6;
kinkcraft-oci = 7;
graeme-oci = 8;
};
configuration = { lib, pkgs, modulesPath, config, assignments, allAssignments, ... }:
let
inherit (builtins) toJSON;
inherit (lib) mkIf mkMerge mkForce;
inherit (lib.my) networkdAssignment;
in
{
imports = [
"${modulesPath}/profiles/qemu-guest.nix"
./valheim.nix
./minecraft
# ./enshrouded.nix
];
config = mkMerge [
{
boot = {
kernelParams = [ "console=ttyS0,115200n8" ];
};
fileSystems = {
"/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
"/nix" = {
device = "/dev/disk/by-label/nix";
fsType = "ext4";
};
"/persist" = {
device = "/dev/disk/by-label/persist";
fsType = "ext4";
neededForBoot = true;
};
"/var/lib/containers" = {
device = "/dev/disk/by-label/oci";
fsType = "xfs";
options = [ "pquota" ];
};
};
services = {
fstrim = lib.my.c.colony.fstrimConfig;
netdata.enable = true;
};
virtualisation = {
podman = {
enable = true;
};
oci-containers = {
backend = "podman";
};
containers.containersConf.settings.network = {
network_backend = "netavark";
firewall_driver = mkForce "none";
};
};
environment = {
etc = {
"containers/networks/colony.json".text = toJSON {
name = "colony";
id = "0000000000000000000000000000000000000000000000000000000000000001";
driver = "bridge";
network_interface = "oci";
ipv6_enabled = true;
internal = false;
dns_enabled = false;
subnets = [
{
subnet = prefixes.oci.v4;
gateway = net.cidr.host 1 prefixes.oci.v4;
}
{
subnet = prefixes.oci.v6;
gateway = net.cidr.host 1 prefixes.oci.v6;
}
];
};
};
};
systemd.network = {
links = {
"10-vms" = {
matchConfig.MACAddress = "52:54:00:d5:d9:c6";
linkConfig.Name = "vms";
};
};
networks = {
"80-vms" = mkMerge [
(networkdAssignment "vms" assignments.routing)
(networkdAssignment "vms" assignments.internal)
];
};
};
my = {
secrets.key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBTIj1jVdknXLNNroMJfgy7S2cSUC/qgFdnaUopEUzZ";
server.enable = true;
network.bbr = true;
firewall = {
tcp.allowed = [ 19999 ];
trustedInterfaces = [ "oci" ];
extraRules = ''
table inet filter {
chain forward {
# Trust that the outer firewall has done the filtering!
iifname vms oifname oci accept
}
}
'';
};
};
}
];
};
};
}