1

Fix network wait-online by setting routable correctly

This commit is contained in:
2024-05-30 10:52:38 +02:00
parent a208ddbea0
commit c3bcd8969c
4 changed files with 18 additions and 5 deletions

View File

@ -5,7 +5,7 @@
lib,
...
}: rec {
mkSystemdNetwork = interface: {
mkSystemdNetwork = interface: routable: {
# name = "enp0s31f6"; # Network interface name?
enable = true;
@ -30,7 +30,7 @@
linkConfig = {
# This corresponds to the [LINK] section
# RequiredForOnline = "routable";
RequiredForOnline = "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
RequiredForOnline = if routable then "routable" else "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
};
};
@ -39,6 +39,7 @@
ip,
router,
nameserver,
routable,
}: {
# name = "enp0s31f6"; # Network interface name?
enable = true;
@ -75,7 +76,7 @@
linkConfig = {
# This corresponds to the [LINK] section
# RequiredForOnline = "routable";
RequiredForOnline = "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
RequiredForOnline = if routable then "routable" else "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
};
};

View File

@ -30,7 +30,7 @@ with mylib.networking; {
networks = {
# Default wildcard ethernet network for all hosts
"50-ether" = mkSystemdNetwork "enp*";
"50-ether" = mkSystemdNetwork "enp*" false;
};
allowedTCPPorts = [

View File

@ -23,7 +23,18 @@ in {
# Main Networks
systemd.network = {
enable = true;
wait-online.anyInterface = true; # Don't wait for all networks to be configured, as e.g. wg0 will only be upon manual activation
wait-online.timeout = 10;
# Don't wait for all networks to be configured, as e.g. wg0 will only be upon manual activation
wait-online.anyInterface = true;
# TODO: Apparently anyInterface doesn't work?
# wait-online.ignoredInterfaces = [
# "wg0"
# "wlp7s0"
# "enp5s0"
# ];
networks = cfg.networks;
};

View File

@ -36,6 +36,7 @@
ip = ["192.168.86.50/24"];
router = ["192.168.86.5"];
nameserver = ["192.168.86.26"];
routable = true;
};
# "10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {...};
};