From c0473aae3762e9f7b75eddee15c647ad981b0a32 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 28 Jul 2024 19:25:52 +0200 Subject: [PATCH 1/5] Ildkule: Remove ens3, add global/floating ipv4 addr --- hosts/ildkule/configuration.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hosts/ildkule/configuration.nix b/hosts/ildkule/configuration.nix index 99e14bf..494e17b 100644 --- a/hosts/ildkule/configuration.nix +++ b/hosts/ildkule/configuration.nix @@ -21,9 +21,16 @@ networking.hostName = "ildkule"; # Define your hostname. systemd.network.networks."30-all" = values.defaultNetworkConfig // { - matchConfig.Name = "en*"; + matchConfig.Name = "ens4"; DHCP = "yes"; - gateway = [ ]; + addresses = [ + { + addressConfig.Address = "129.241.153.213/32"; + } + { + addressConfig.Address = "192.168.12.209/24"; + } + ]; }; # List packages installed in system profile -- 2.44.2 From 6c2211b7f956bfacdd3fa60a8b8526421976cce1 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 28 Jul 2024 19:30:16 +0200 Subject: [PATCH 2/5] Ildkule: Configure both networks with proper routes --- hosts/ildkule/configuration.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/hosts/ildkule/configuration.nix b/hosts/ildkule/configuration.nix index 494e17b..1ef0c15 100644 --- a/hosts/ildkule/configuration.nix +++ b/hosts/ildkule/configuration.nix @@ -20,17 +20,36 @@ zramSwap.enable = true; networking.hostName = "ildkule"; # Define your hostname. - systemd.network.networks."30-all" = values.defaultNetworkConfig // { + + # Main connection for incoming and outgoing connections to the world, using the global ("floating") IP + systemd.network.networks."30-ntnu-global" = values.defaultNetworkConfig // { matchConfig.Name = "ens4"; DHCP = "yes"; + gateway = [ ]; addresses = [ { + # Add the global address in addition to the local address learned from DHCP addressConfig.Address = "129.241.153.213/32"; } + ]; + }; + + # Secondary connection only for use within the university network + systemd.network.networks."40-ntnu-internal" = values.defaultNetworkConfig // { + matchConfig.Name = "ens3"; + DHCP = "yes"; + gateway = [ ]; + routes = [ { - addressConfig.Address = "192.168.12.209/24"; + routeConfig.Destination = "10.0.0.0/8"; } ]; + linkConfig.RequiredForOnline = "no"; + dhcpV4Config = { + # Do not use this interface as a default / global route + # Note: This does not remove the link-local route 192.168.11.0/24, as it is added by the kernel itself + UseRoutes = "no"; + }; }; # List packages installed in system profile -- 2.44.2 From 381d5b67348e24abf30eff64aab014cd90b77f42 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 28 Jul 2024 20:31:02 +0200 Subject: [PATCH 3/5] Values: Make generic network configs for openstack guests --- hosts/ildkule/configuration.nix | 28 ++++++---------------------- values.nix | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/hosts/ildkule/configuration.nix b/hosts/ildkule/configuration.nix index 1ef0c15..12ceaa2 100644 --- a/hosts/ildkule/configuration.nix +++ b/hosts/ildkule/configuration.nix @@ -21,35 +21,19 @@ networking.hostName = "ildkule"; # Define your hostname. - # Main connection for incoming and outgoing connections to the world, using the global ("floating") IP - systemd.network.networks."30-ntnu-global" = values.defaultNetworkConfig // { + # Main connection, using the global/floatig IP, for communications with the world + systemd.network.networks."30-ntnu-global" = values.openstackGlobalNetworkConfig // { matchConfig.Name = "ens4"; - DHCP = "yes"; - gateway = [ ]; + + # Add the global address in addition to the local address learned from DHCP addresses = [ - { - # Add the global address in addition to the local address learned from DHCP - addressConfig.Address = "129.241.153.213/32"; - } + { addressConfig.Address = "${values.hosts.ildkule.ipv4_global}/32"; } ]; }; # Secondary connection only for use within the university network - systemd.network.networks."40-ntnu-internal" = values.defaultNetworkConfig // { + systemd.network.networks."40-ntnu-internal" = values.openstackLocalNetworkConfig // { matchConfig.Name = "ens3"; - DHCP = "yes"; - gateway = [ ]; - routes = [ - { - routeConfig.Destination = "10.0.0.0/8"; - } - ]; - linkConfig.RequiredForOnline = "no"; - dhcpV4Config = { - # Do not use this interface as a default / global route - # Note: This does not remove the link-local route 192.168.11.0/24, as it is added by the kernel itself - UseRoutes = "no"; - }; }; # List packages installed in system profile diff --git a/values.nix b/values.nix index 0c68b65..ba335a3 100644 --- a/values.nix +++ b/values.nix @@ -73,4 +73,27 @@ in rec { DHCP = "no"; }; + openstackGlobalNetworkConfig = { + networkConfig.IPv6AcceptRA = "no"; + dns = [ "129.241.0.200" "129.241.0.201" ]; + domains = [ "pvv.ntnu.no" "pvv.org" ]; + DHCP = "yes"; + }; + + openstackLocalNetworkConfig = { + networkConfig.IPv6AcceptRA = "no"; + dns = [ "129.241.0.200" "129.241.0.201" ]; + domains = [ "pvv.ntnu.no" "pvv.org" ]; + DHCP = "yes"; + routes = [ + { + routeConfig.Destination = "10.0.0.0/8"; + } + ]; + linkConfig.RequiredForOnline = "no"; + dhcpV4Config = { + # Only use this network for link-local networking, no global/default routes + UseRoutes = "no"; + }; + }; } -- 2.44.2 From 4b3d3709b58e14e2e6080eac0ccdabddfa71e8af Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Mon, 29 Jul 2024 15:09:42 +0200 Subject: [PATCH 4/5] Openstack: Add ipv6, clean up config --- hosts/ildkule/configuration.nix | 8 +++++++- values.nix | 14 ++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/hosts/ildkule/configuration.nix b/hosts/ildkule/configuration.nix index 12ceaa2..276af5a 100644 --- a/hosts/ildkule/configuration.nix +++ b/hosts/ildkule/configuration.nix @@ -25,15 +25,21 @@ systemd.network.networks."30-ntnu-global" = values.openstackGlobalNetworkConfig // { matchConfig.Name = "ens4"; - # Add the global address in addition to the local address learned from DHCP + # Add the global addresses in addition to the local address learned from DHCP addresses = [ { addressConfig.Address = "${values.hosts.ildkule.ipv4_global}/32"; } + { addressConfig.Address = "${values.hosts.ildkule.ipv6_global}/128"; } ]; }; # Secondary connection only for use within the university network systemd.network.networks."40-ntnu-internal" = values.openstackLocalNetworkConfig // { matchConfig.Name = "ens3"; + # Add the ntnu-internal addresses in addition to the local address learned from DHCP + addresses = [ + { addressConfig.Address = "${values.hosts.ildkule.ipv4}/32"; } + { addressConfig.Address = "${values.hosts.ildkule.ipv6}/128"; } + ]; }; # List packages installed in system profile diff --git a/values.nix b/values.nix index ba335a3..d16694d 100644 --- a/values.nix +++ b/values.nix @@ -74,7 +74,7 @@ in rec { }; openstackGlobalNetworkConfig = { - networkConfig.IPv6AcceptRA = "no"; + networkConfig.IPv6AcceptRA = "yes"; dns = [ "129.241.0.200" "129.241.0.201" ]; domains = [ "pvv.ntnu.no" "pvv.org" ]; DHCP = "yes"; @@ -85,15 +85,13 @@ in rec { dns = [ "129.241.0.200" "129.241.0.201" ]; domains = [ "pvv.ntnu.no" "pvv.org" ]; DHCP = "yes"; + + # Only use this network for link-local networking, not global/default routes + dhcpV4Config.UseRoutes = "no"; routes = [ - { - routeConfig.Destination = "10.0.0.0/8"; - } + { routeConfig.Destination = "10.0.0.0/8"; } ]; + linkConfig.RequiredForOnline = "no"; - dhcpV4Config = { - # Only use this network for link-local networking, no global/default routes - UseRoutes = "no"; - }; }; } -- 2.44.2 From 77fa7897561ec01548d4a90b9b06923a39ab61c7 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Mon, 29 Jul 2024 15:22:47 +0200 Subject: [PATCH 5/5] Openstack: fix broken ntnu-internal route --- values.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/values.nix b/values.nix index d16694d..2e11f4f 100644 --- a/values.nix +++ b/values.nix @@ -89,7 +89,7 @@ in rec { # Only use this network for link-local networking, not global/default routes dhcpV4Config.UseRoutes = "no"; routes = [ - { routeConfig.Destination = "10.0.0.0/8"; } + { routeConfig = { Destination = "10.0.0.0/8"; Gateway = "_dhcp4"; }; } ]; linkConfig.RequiredForOnline = "no"; -- 2.44.2