diff --git a/config/waybar/config.json b/config/waybar/config.json index b650568b..16bfd797 100644 --- a/config/waybar/config.json +++ b/config/waybar/config.json @@ -54,7 +54,7 @@ "network": { "format": " {ipaddr}", "format-disconnected": " ", - "interface": "enp7s0", + "interface": "enp10s0", "tooltip-format": "{ifname} via {gwaddr}" }, diff --git a/lib/networking.nix b/lib/networking.nix index 3592c211..e5a398b4 100644 --- a/lib/networking.nix +++ b/lib/networking.nix @@ -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 diff --git a/system/default.nix b/system/default.nix index bbf287de..7d4ea4d5 100644 --- a/system/default.nix +++ b/system/default.nix @@ -46,11 +46,11 @@ with mylib.networking; { }; networking.hosts = { - "192.168.86.42" = ["nixinator"]; - "192.168.86.69" = ["proxmox"]; - "192.168.86.100" = ["truenas"]; - "192.168.86.102" = ["opnsense"]; - "192.168.86.105" = ["servenix"]; + "192.168.86.50" = ["nixinator"]; + "192.168.86.4" = ["proxmox"]; + "192.168.86.20" = ["truenas"]; + "192.168.86.5" = ["opnsense"]; + "192.168.86.25" = ["servenix"]; }; # Enable flakes diff --git a/system/modules/systemd-networkd/default.nix b/system/modules/systemd-networkd/default.nix index e0c0d73d..b3e29fc2 100644 --- a/system/modules/systemd-networkd/default.nix +++ b/system/modules/systemd-networkd/default.nix @@ -60,7 +60,7 @@ in { networking = { # Gets inherited from flake in nixos mylib and passed through the module option hostName = cfg.hostname; # Define your hostname. - enableIPv6 = true; + enableIPv6 = false; # Disable a lot of stuff not needed for systemd-networkd networkmanager.enable = false; diff --git a/system/nixinator/default.nix b/system/nixinator/default.nix index 6cc035bb..a026667c 100644 --- a/system/nixinator/default.nix +++ b/system/nixinator/default.nix @@ -29,6 +29,17 @@ }; systemd-networkd = { + networks = { + # This should override the default network 50-ether + "10-ether-2_5G" = mylib.networking.mkStaticSystemdNetwork { + interface = "enp10s0"; + ip = ["192.168.86.50/24"]; + router = ["192.168.86.5"]; + nameserver = ["192.168.86.25"]; + }; + # "10-ether-1G" = mylib.networking.mkStaticSystemdNetwork {...}; + }; + wireguard-tunnels = { wg0-de-115 = ( mylib.networking.mkWireguardService