Updated networking config
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user