feat(access): int to more hosts

This commit is contained in:
arcnmx 2024-03-24 11:43:44 -07:00
parent f2fddc1001
commit c61220b641
11 changed files with 99 additions and 8 deletions

View file

@ -30,7 +30,7 @@
default = null; default = null;
}; };
address4 = mkOption { address4 = mkOption {
type = nullOr (either (enum [ "auto" ]) str); type = nullOr (either (enum [ "dhcp" ]) str);
default = null; default = null;
}; };
gateway4 = mkOption { gateway4 = mkOption {
@ -80,7 +80,7 @@
]; ];
slaac.postfix = mkOptionDefault (mapNullable eui64 config.macAddress); slaac.postfix = mkOptionDefault (mapNullable eui64 config.macAddress);
gateway4 = mkMerge [ gateway4 = mkMerge [
(mkIf (system.proxmox.node.name == "reisen" && config.bridge == "vmbr0" && config.address4 != null && config.address4 != "auto") (mkAlmostOptionDefault "10.1.1.1")) (mkIf (system.proxmox.node.name == "reisen" && config.bridge == "vmbr0" && config.address4 != null && config.address4 != "dhcp") (mkAlmostOptionDefault "10.1.1.1"))
]; ];
networkd.networkSettings = { networkd.networkSettings = {
name = mkAlmostOptionDefault config.name; name = mkAlmostOptionDefault config.name;
@ -100,7 +100,7 @@
}) })
]; ];
address = mkMerge [ address = mkMerge [
(mkIf (! elem config.address4 [ null "auto" ]) [ config.address4 ]) (mkIf (! elem config.address4 [ null "dhcp" ]) [ config.address4 ])
(mkIf (! elem config.address6 [ null "auto" "dhcp" ]) [ config.address6 ]) (mkIf (! elem config.address6 [ null "auto" "dhcp" ]) [ config.address6 ])
]; ];
gateway = mkMerge [ gateway = mkMerge [
@ -108,7 +108,7 @@
(mkIf (config.gateway6 != null) [ config.gateway6 ]) (mkIf (config.gateway6 != null) [ config.gateway6 ])
]; ];
DHCP = mkAlmostOptionDefault ( DHCP = mkAlmostOptionDefault (
if config.address4 == "auto" && config.address6 == "dhcp" then "yes" if config.address4 == "dhcp" && config.address6 == "dhcp" then "yes"
else if config.address6 == "dhcp" then "ipv6" else if config.address6 == "dhcp" then "ipv6"
else if config.address4 == "dhcp" then "ipv4" else if config.address4 == "dhcp" then "ipv4"
else "no" else "no"

View file

@ -15,6 +15,7 @@ _: {
macAddress = "BC:24:11:C4:66:AA"; macAddress = "BC:24:11:C4:66:AA";
networkd.networkSettings.linkConfig.RequiredForOnline = false; networkd.networkSettings.linkConfig.RequiredForOnline = false;
}; };
net2.internal.enable = true;
}; };
}; };
} }

View file

@ -10,6 +10,7 @@ _: {
name = "ens18"; name = "ens18";
macAddress = "BC:24:11:3D:39:91"; macAddress = "BC:24:11:3D:39:91";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -11,6 +11,7 @@ _: {
address4 = "10.1.1.41/24"; address4 = "10.1.1.41/24";
address6 = "auto"; address6 = "auto";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -11,6 +11,7 @@ _: {
address4 = "10.1.1.48/24"; address4 = "10.1.1.48/24";
address6 = "auto"; address6 = "auto";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -9,9 +9,10 @@ _: {
net0 = { net0 = {
mdns.enable = true; mdns.enable = true;
macAddress = "BC:24:11:C4:66:AB"; macAddress = "BC:24:11:C4:66:AB";
address4 = "auto"; address4 = "dhcp";
address6 = "auto"; address6 = "auto";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -12,6 +12,7 @@ _: {
address4 = "10.1.1.45/24"; address4 = "10.1.1.45/24";
address6 = "auto"; address6 = "auto";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -11,6 +11,7 @@ _: {
address4 = "10.1.1.39/24"; address4 = "10.1.1.39/24";
address6 = "auto"; address6 = "auto";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -11,6 +11,7 @@ _: {
address4 = "10.1.1.38/24"; address4 = "10.1.1.38/24";
address6 = "auto"; address6 = "auto";
}; };
net1.internal.enable = true;
}; };
}; };
} }

View file

@ -70,6 +70,14 @@ EOT
gateway = "10.1.1.1" gateway = "10.1.1.1"
} }
} }
ip_config {
ipv6 {
address = "${cidrhost(local.reisen_int_prefix6, local.proxmox_tewi_vm_id - local.reisen_int_offset)}/64"
}
ipv4 {
address = "${cidrhost(local.reisen_int_prefix4, local.proxmox_tewi_vm_id - local.reisen_int_offset)}/24"
}
}
} }
startup { startup {
@ -82,6 +90,11 @@ EOT
name = "eth0" name = "eth0"
mac_address = "BC:24:11:CC:66:57" mac_address = "BC:24:11:CC:66:57"
} }
network_interface {
name = "eth9"
mac_address = "BC:24:19:CC:66:57"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
template_file_id = var.proxmox_container_template template_file_id = var.proxmox_container_template
@ -225,6 +238,14 @@ EOT
gateway = "10.1.1.1" gateway = "10.1.1.1"
} }
} }
ip_config {
ipv6 {
address = "${cidrhost(local.reisen_int_prefix6, local.proxmox_reimu_vm_id - local.reisen_int_offset)}/64"
}
ipv4 {
address = "${cidrhost(local.reisen_int_prefix4, local.proxmox_reimu_vm_id - local.reisen_int_offset)}/24"
}
}
} }
startup { startup {
@ -237,6 +258,11 @@ EOT
name = "eth0" name = "eth0"
mac_address = "BC:24:11:C4:66:A8" mac_address = "BC:24:11:C4:66:A8"
} }
network_interface {
name = "eth9"
mac_address = "BC:24:19:C4:66:A8"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
template_file_id = var.proxmox_container_template template_file_id = var.proxmox_container_template
@ -300,7 +326,15 @@ EOT
} }
} }
# empty block required if additional interfaces are added, but causes state sync issues # empty block required if additional interfaces are added, but causes state sync issues
# ip_config {} ip_config {}
ip_config {
ipv6 {
address = "${cidrhost(local.reisen_int_prefix6, local.proxmox_aya_vm_id - local.reisen_int_offset)}/64"
}
ipv4 {
address = "${cidrhost(local.reisen_int_prefix4, local.proxmox_aya_vm_id - local.reisen_int_offset)}/24"
}
}
} }
startup { startup {
@ -317,6 +351,11 @@ EOT
name = "eth1" name = "eth1"
mac_address = "BC:24:11:C4:66:AA" mac_address = "BC:24:11:C4:66:AA"
} }
network_interface {
name = "eth9"
mac_address = "BC:24:19:C4:66:A9"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
template_file_id = var.proxmox_container_template template_file_id = var.proxmox_container_template
@ -378,6 +417,14 @@ EOT
gateway = "10.1.1.1" gateway = "10.1.1.1"
} }
} }
ip_config {
ipv6 {
address = "${cidrhost(local.reisen_int_prefix6, local.proxmox_utsuho_vm_id - local.reisen_int_offset)}/64"
}
ipv4 {
address = "${cidrhost(local.reisen_int_prefix4, local.proxmox_utsuho_vm_id - local.reisen_int_offset)}/24"
}
}
} }
startup { startup {
@ -390,6 +437,11 @@ EOT
name = "eth0" name = "eth0"
mac_address = "BC:24:11:C4:66:A6" mac_address = "BC:24:11:C4:66:A6"
} }
network_interface {
name = "eth9"
mac_address = "BC:24:19:C4:66:A6"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
template_file_id = var.proxmox_container_template template_file_id = var.proxmox_container_template
@ -459,6 +511,10 @@ EOT
bridge = "vmbr0" bridge = "vmbr0"
mac_address = "BC:24:11:3D:39:91" mac_address = "BC:24:11:3D:39:91"
} }
network_device {
mac_address = "BC:24:19:3D:39:91"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
type = "l26" type = "l26"
@ -504,6 +560,14 @@ EOT
address = "dhcp" address = "dhcp"
} }
} }
ip_config {
ipv6 {
address = "${cidrhost(local.reisen_int_prefix6, local.proxmox_litterbox_vm_id - local.reisen_int_offset)}/64"
}
ipv4 {
address = "${cidrhost(local.reisen_int_prefix4, local.proxmox_litterbox_vm_id - local.reisen_int_offset)}/24"
}
}
} }
startup { startup {
@ -516,6 +580,11 @@ EOT
name = "eth0" name = "eth0"
mac_address = "BC:24:11:C4:66:AB" mac_address = "BC:24:11:C4:66:AB"
} }
network_interface {
name = "eth9"
mac_address = "BC:24:19:C4:66:AB"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
template_file_id = var.proxmox_container_template template_file_id = var.proxmox_container_template
@ -627,7 +696,16 @@ EOT
address = "auto" address = "auto"
} }
ipv4 { ipv4 {
address = "dhcp" address = "10.1.1.48/24"
gateway = "10.1.1.1"
}
}
ip_config {
ipv6 {
address = "${cidrhost(local.reisen_int_prefix6, local.proxmox_keycloak_vm_id - local.reisen_int_offset)}/64"
}
ipv4 {
address = "${cidrhost(local.reisen_int_prefix4, local.proxmox_keycloak_vm_id - local.reisen_int_offset)}/24"
} }
} }
} }
@ -642,6 +720,11 @@ EOT
name = "eth0" name = "eth0"
mac_address = "BC:24:11:C4:66:AC" mac_address = "BC:24:11:C4:66:AC"
} }
network_interface {
name = "eth9"
mac_address = "BC:24:19:C4:66:AC"
bridge = proxmox_virtual_environment_network_linux_bridge.internal.name
}
operating_system { operating_system {
template_file_id = var.proxmox_container_template template_file_id = var.proxmox_container_template