From 0c74f51c2f45c447ebe1bc0282935f62bdd098c4 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 28 Jul 2024 19:30:16 +0200 Subject: [PATCH] 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