improve network config

This commit is contained in:
Christoph Cullmann 2023-10-24 21:47:13 +02:00
parent d26a580ec8
commit 6d6f1ee2e8
3 changed files with 30 additions and 28 deletions

View file

@ -67,22 +67,6 @@ in
# allow all firmware # allow all firmware
hardware.enableAllFirmware = true; hardware.enableAllFirmware = true;
# use systemd-networkd
networking.useDHCP = false;
systemd.network = {
enable = true;
networks."10-wan" = {
networkConfig = {
# start a DHCP Client for IPv4 Addressing/Routing
DHCP = "ipv4";
# accept Router Advertisements for Stateless IPv6 Autoconfiguraton (SLAAC)
IPv6AcceptRA = true;
};
# make routing on this interface a dependency for network-online.target
linkConfig.RequiredForOnline = "routable";
};
};
# ensure firewall is up, allow ssh and http in # ensure firewall is up, allow ssh and http in
networking.firewall.enable = true; networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [ 22 ];

View file

@ -14,12 +14,21 @@
/data/nixos/common.nix /data/nixos/common.nix
]; ];
# host name
networking.hostName = "mini";
# main network interface
systemd.network.networks."10-wan".matchConfig.Name = "eno1";
# amd graphics # amd graphics
hardware.opengl.extraPackages = with pkgs; [ amdvlk rocm-opencl-icd rocm-opencl-runtime ]; hardware.opengl.extraPackages = with pkgs; [ amdvlk rocm-opencl-icd rocm-opencl-runtime ];
# use systemd-networkd, fixed IPv4, dynamic IPv6
networking.hostName = "mini";
networking.useDHCP = false;
networking.nameservers = [ "192.168.13.1" ];
systemd.network = {
enable = true;
networks."10-wan" = {
matchConfig.Name = "eno1";
address = [ "192.168.13.100/24" ];
routes = [ { routeConfig.Gateway = "192.168.13.1"; } ];
networkConfig.IPv6AcceptRA = true;
linkConfig.RequiredForOnline = "routable";
};
};
} }

View file

@ -14,12 +14,21 @@
/data/nixos/common.nix /data/nixos/common.nix
]; ];
# host name
networking.hostName = "neko";
# main network interface
systemd.network.networks."10-wan".matchConfig.Name = "enp10s0";
# intel graphics # intel graphics
hardware.opengl.extraPackages = with pkgs; [ intel-media-driver intel-compute-runtime ]; hardware.opengl.extraPackages = with pkgs; [ intel-media-driver intel-compute-runtime ];
# use systemd-networkd, fixed IPv4, dynamic IPv6
networking.hostName = "neko";
networking.useDHCP = false;
networking.nameservers = [ "192.168.13.1" ];
systemd.network = {
enable = true;
networks."10-wan" = {
matchConfig.Name = "enp10s0";
address = [ "192.168.13.171/24" ];
routes = [ { routeConfig.Gateway = "192.168.13.1"; } ];
networkConfig.IPv6AcceptRA = true;
linkConfig.RequiredForOnline = "routable";
};
};
} }