forked from Drift/pvv-nixos-config
Merge pull request 'Fix Ildkule/Openstack networking' (!75) from fix-openstack-networking into main
Reviewed-on: Drift/pvv-nixos-config#75
This commit is contained in:
commit
78456063ba
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, values, ... }:
|
{ config, pkgs, lib, values, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
|
@ -19,27 +19,28 @@
|
||||||
boot.tmp.cleanOnBoot = true;
|
boot.tmp.cleanOnBoot = true;
|
||||||
zramSwap.enable = true;
|
zramSwap.enable = true;
|
||||||
|
|
||||||
networking.hostName = "ildkule"; # Define your hostname.
|
# Openstack Neutron and systemd-networkd are not best friends, use something else:
|
||||||
|
systemd.network.enable = lib.mkForce false;
|
||||||
|
networking = let
|
||||||
|
hostConf = values.hosts.ildkule;
|
||||||
|
in {
|
||||||
|
hostName = "ildkule";
|
||||||
|
tempAddresses = "disabled";
|
||||||
|
useDHCP = lib.mkForce true;
|
||||||
|
|
||||||
# Main connection, using the global/floatig IP, for communications with the world
|
search = values.defaultNetworkConfig.domains;
|
||||||
systemd.network.networks."30-ntnu-global" = values.openstackGlobalNetworkConfig // {
|
nameservers = values.defaultNetworkConfig.dns;
|
||||||
matchConfig.Name = "ens4";
|
defaultGateway.address = hostConf.ipv4_internal_gw;
|
||||||
|
|
||||||
# Add the global addresses in addition to the local address learned from DHCP
|
interfaces."ens4" = {
|
||||||
addresses = [
|
ipv4.addresses = [
|
||||||
{ addressConfig.Address = "${values.hosts.ildkule.ipv4_global}/32"; }
|
{ address = hostConf.ipv4; prefixLength = 32; }
|
||||||
{ addressConfig.Address = "${values.hosts.ildkule.ipv6_global}/128"; }
|
{ address = hostConf.ipv4_internal; prefixLength = 24; }
|
||||||
];
|
];
|
||||||
};
|
ipv6.addresses = [
|
||||||
|
{ address = hostConf.ipv6; prefixLength = 64; }
|
||||||
# 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
|
# List packages installed in system profile
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
"::1"
|
"::1"
|
||||||
values.hosts.ildkule.ipv4
|
values.hosts.ildkule.ipv4
|
||||||
values.hosts.ildkule.ipv6
|
values.hosts.ildkule.ipv6
|
||||||
values.hosts.ildkule.ipv4_global
|
|
||||||
values.hosts.ildkule.ipv6_global
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
38
values.nix
38
values.nix
|
@ -30,11 +30,10 @@ in rec {
|
||||||
ipv6 = pvv-ipv6 168;
|
ipv6 = pvv-ipv6 168;
|
||||||
};
|
};
|
||||||
ildkule = {
|
ildkule = {
|
||||||
ipv4 = "10.212.25.209";
|
ipv4 = "129.241.153.213";
|
||||||
ipv6 = "2001:700:300:6025:f816:3eff:feee:812d";
|
ipv4_internal = "192.168.12.209";
|
||||||
|
ipv4_internal_gw = "192.168.12.1";
|
||||||
ipv4_global = "129.241.153.213";
|
ipv6 = "2001:700:300:6026:f816:3eff:fe58:f1e8";
|
||||||
ipv6_global = "2001:700:300:6026:f816:3eff:fe58:f1e8";
|
|
||||||
};
|
};
|
||||||
bicep = {
|
bicep = {
|
||||||
ipv4 = pvv-ipv4 209;
|
ipv4 = pvv-ipv4 209;
|
||||||
|
@ -66,32 +65,11 @@ in rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultNetworkConfig = {
|
defaultNetworkConfig = {
|
||||||
networkConfig.IPv6AcceptRA = "no";
|
dns = [ "129.241.0.200" "129.241.0.201" "2001:700:300:1900::200" "2001:700:300:1900::201" ];
|
||||||
gateway = [ hosts.gateway ];
|
|
||||||
dns = [ "129.241.0.200" "129.241.0.201" ];
|
|
||||||
domains = [ "pvv.ntnu.no" "pvv.org" ];
|
domains = [ "pvv.ntnu.no" "pvv.org" ];
|
||||||
|
gateway = [ hosts.gateway ];
|
||||||
|
|
||||||
|
networkConfig.IPv6AcceptRA = "no";
|
||||||
DHCP = "no";
|
DHCP = "no";
|
||||||
};
|
};
|
||||||
|
|
||||||
openstackGlobalNetworkConfig = {
|
|
||||||
networkConfig.IPv6AcceptRA = "yes";
|
|
||||||
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";
|
|
||||||
|
|
||||||
# Only use this network for link-local networking, not global/default routes
|
|
||||||
dhcpV4Config.UseRoutes = "no";
|
|
||||||
routes = [
|
|
||||||
{ routeConfig = { Destination = "10.0.0.0/8"; Gateway = "_dhcp4"; }; }
|
|
||||||
];
|
|
||||||
|
|
||||||
linkConfig.RequiredForOnline = "no";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue