1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

nixos/servnerr-3: switch to systemd-networkd

Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
Matt Layher 2022-03-01 20:14:27 -05:00
parent d0d232945c
commit 3bc7b80d4e
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94
2 changed files with 68 additions and 29 deletions

View file

@ -7,38 +7,14 @@ in {
# Hardware and base system configuration. # Hardware and base system configuration.
./hardware-configuration.nix ./hardware-configuration.nix
./lib/system.nix ./lib/system.nix
./networking.nix
./storage.nix
# Service configuration. # Service configuration.
./containers.nix ./containers.nix
./prometheus.nix ./prometheus.nix
./storage.nix
]; ];
networking = {
# Host name and ID.
hostName = "servnerr-3";
hostId = "efdd2a1b";
# No local firewall.
firewall.enable = false;
# Set up a bridge interface for VMs which is tagged into a lab VLAN.
bridges.br0.interfaces = [ "enp6s0" ];
# Use DHCP for all interfaces, but force the deprecated global setting off.
useDHCP = false;
interfaces = {
# 1GbE on management.
enp5s0.useDHCP = true;
# 10GbE VLAN.
enp12s0.useDHCP = true;
# 1GbE on Lab VLAN.
br0.useDHCP = false;
};
};
boot = { boot = {
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
loader = { loader = {
@ -90,10 +66,10 @@ in {
pprof = true; pprof = true;
}; };
interfaces = lib.forEach [ "enp5s0" ] (name: { interfaces = [{
inherit name; names = [ "mgmt0" ];
monitor = true; monitor = true;
}); }];
}; };
}; };

View file

@ -0,0 +1,63 @@
{ lib, ... }:
{
networking = {
# Host name and ID.
hostName = "servnerr-3";
hostId = "efdd2a1b";
# Use systemd-networkd for configuration. Forcibly disable legacy DHCP client.
useNetworkd = true;
useDHCP = false;
# No local firewall.
firewall.enable = false;
};
systemd.network = {
enable = true;
# 1GbE management LAN.
links."10-mgmt0" = {
matchConfig.MACAddress = "1c:1b:0d:ea:83:0f";
linkConfig.Name = "mgmt0";
};
networks."10-mgmt0" = {
matchConfig.Name = "mgmt0";
networkConfig.DHCP = "ipv4";
};
# 1GbE lab LAN, attached to br0 for VMs.
links."11-lab0" = {
matchConfig.MACAddress = "1c:1b:0d:ea:83:11";
linkConfig.Name = "lab0";
};
netdevs."11-br0".netdevConfig = {
Name = "br0";
Kind = "bridge";
};
# TODO(mdlayher): enable after reconfiguring switch.
networks."11-br0" = {
enable = false;
matchConfig.Name = "br0";
networkConfig.DHCP = "ipv4";
};
networks."11-lab0" = {
enable = false;
matchConfig.Name = "lab0";
networkConfig.Bridge = "br0";
};
# 10GbE LAN.
links."12-tengb0" = {
matchConfig.MACAddress = "90:e2:ba:5b:99:80";
linkConfig.Name = "tengb0";
};
networks."12-tengb0" = {
# TODO(mdlayher): enable after setting up switch.
enable = false;
matchConfig.Name = "tengb0";
networkConfig.DHCP = "ipv4";
};
};
}