1

Updated networking config

This commit is contained in:
2023-09-10 12:30:26 +02:00
parent a8b77989b4
commit 176561e357
5 changed files with 58 additions and 7 deletions

View File

@ -34,6 +34,46 @@
};
};
mkStaticSystemdNetwork = {interface, ip, router, nameserver}: {
# name = "enp0s31f6"; # Network interface name?
enable = true;
# See man systemd.link, man systemd.netdev, man systemd.network
matchConfig = {
# This corresponds to the [MATCH] section
Name = interface; # Match ethernet interface
};
# Static IP + DNS + Gateway
address = ip;
gateway = router;
dns = nameserver;
# routes = [
# {
# routeConfig.Gateway = (lib.head router);
# }
# ];
# See man systemd.network
networkConfig = {
# This corresponds to the [NETWORK] section
DHCP = "no";
# TODO: What does this all do?
# IPv6AcceptRA = true;
# MulticastDNS = "yes"; # Needed?
# LLMNR = "no"; # Needed?
# LinkLocalAddressing = "no"; # Needed?
};
linkConfig = {
# This corresponds to the [LINK] section
# RequiredForOnline = "routable";
RequiredForOnline = "no"; # Don't make nixos-rebuild wait for systemd-networkd-wait-online.service
};
};
mkNetworkNamespace = name: ''
${pkgs.iproute}/bin/ip netns add ${name} # Create the Namespace
${pkgs.iproute}/bin/ip -n ${name} link set lo up # Enable the Loopback device