From 47956fe278d0e169e5ecbee442303737ea7226f1 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 20:03:59 +0000 Subject: host: make sure nginx gets to bind to 172.16.0.1 With networkd, fcbr0 only got its address while it had carrier, i.e. while a VM was running, so nginx failed with "bind() to 172.16.0.1:443 failed (99: Cannot assign requested address)" and gave up after a few restarts. Configure fcbr0 without carrier, and let nginx retry without start limit until the address is there. --- host.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'host.nix') diff --git a/host.nix b/host.nix index d034ef3..7b1f0d5 100644 --- a/host.nix +++ b/host.nix @@ -147,6 +147,10 @@ in { fcbr0.ipv4.addresses = [{ address = "172.16.0.1"; prefixLength = 24; }]; }; networking.bridges.fcbr0.interfaces = tapNames; + # With networkd, fcbr0 would only get its address while it has carrier, + # i.e. while a VM runs, so nginx couldn't bind to it before. (Unused + # with scripted networking, which assigns it regardless.) + systemd.network.networks."40-fcbr0".networkConfig.ConfigureWithoutCarrier = true; # Only rejects; for anything else the host's own forward chain decides. networking.nftables.enable = true; @@ -197,11 +201,13 @@ in { ]; # nginx binds to 172.16.0.1, so it has to wait for fcbr0's address - # (network-addresses-fcbr0.service with scripted networking; else - # Restart= gets it there). On reload, sniConfig regenerates the map and + # (network-addresses-fcbr0.service with scripted networking; with + # networkd, nothing to order after, so it keeps restarting, without start + # limit, until the address is there). On reload, sniConfig regenerates the map and # nginx re-reads its config on SIGHUP; if that fails, it keeps the old. systemd.services.fcbr0-sni = { wantedBy = [ "multi-user.target" ]; + startLimitIntervalSec = 0; after = [ "network.target" "network-addresses-fcbr0.service" "systemd-tmpfiles-setup.service" ]; serviceConfig = { ExecStartPre = sniConfig; -- cgit v1.3.1