mirror of
https://github.com/mdlayher/homelab.git
synced 2024-12-15 17:50:54 +00:00
nixos/lib/vargen: update for new addressing
Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
parent
d20e529556
commit
f80f0b5742
2 changed files with 33 additions and 39 deletions
|
@ -18,21 +18,9 @@ import (
|
|||
//go:generate /usr/bin/env bash -c "go run main.go > ../vars.json"
|
||||
|
||||
func main() {
|
||||
// LLA is always the same.
|
||||
lla := prefix("fe80::/64")
|
||||
|
||||
// The primary subnet: all servers and network infrastructure live here.
|
||||
var (
|
||||
// TODO: renumber to "0"?
|
||||
enp2s0 = subnet{
|
||||
Name: "enp2s0",
|
||||
IPv4: prefix("192.168.1.0/24"),
|
||||
IPv6: ipv6Prefixes{
|
||||
GUA: prefix("2600:6c4a:7880:3200::/64"),
|
||||
LLA: lla,
|
||||
ULA: prefix("fd9e:1a04:f01d::/64"),
|
||||
},
|
||||
}
|
||||
enp2s0 = newSubnet("enp2s0", 0)
|
||||
|
||||
lan0 = newSubnet("lan0", 10)
|
||||
iot0 = newSubnet("iot0", 66)
|
||||
|
@ -198,11 +186,17 @@ type ipv6Addresses struct {
|
|||
}
|
||||
|
||||
func newSubnet(iface string, vlan int) subnet {
|
||||
gua := prefix(fmt.Sprintf("2600:6c4a:7880:32%02x::/64", vlan))
|
||||
gua := prefix(fmt.Sprintf("2600:6c4a:7880:13%02x::/64", vlan))
|
||||
|
||||
// A hack to continue using 192.168.1.0/24 for the management network.
|
||||
v4Subnet := vlan
|
||||
if vlan == 0 {
|
||||
v4Subnet = 1
|
||||
}
|
||||
|
||||
return subnet{
|
||||
Name: iface,
|
||||
IPv4: prefix(fmt.Sprintf("192.168.%d.0/24", vlan)),
|
||||
IPv4: prefix(fmt.Sprintf("192.168.%d.0/24", v4Subnet)),
|
||||
IPv6: ipv6Prefixes{
|
||||
GUA: gua,
|
||||
LLA: prefix("fe80::/64"),
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"server_ipv4": "192.168.110.5",
|
||||
"server_ipv6": "2600:6c4a:7880:326e:92e2:baff:fe5b:9980",
|
||||
"desktop_ipv6": "2600:6c4a:7880:326e:92e2:baff:fe23:1a3a",
|
||||
"server_ipv6": "2600:6c4a:7880:136e:92e2:baff:fe5b:9980",
|
||||
"desktop_ipv6": "2600:6c4a:7880:136e:92e2:baff:fe23:1a3a",
|
||||
"hosts": {
|
||||
"servers": [
|
||||
{
|
||||
"name": "servnerr-3",
|
||||
"ipv4": "192.168.110.5",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:326e:92e2:baff:fe5b:9980",
|
||||
"gua": "2600:6c4a:7880:136e:92e2:baff:fe5b:9980",
|
||||
"ula": "fd9e:1a04:f01d:110:92e2:baff:fe5b:9980",
|
||||
"lla": "fe80::92e2:baff:fe5b:9980"
|
||||
},
|
||||
|
@ -18,7 +18,7 @@
|
|||
"name": "nerr-3",
|
||||
"ipv4": "192.168.110.6",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:326e:92e2:baff:fe23:1a3a",
|
||||
"gua": "2600:6c4a:7880:136e:92e2:baff:fe23:1a3a",
|
||||
"ula": "fd9e:1a04:f01d:110:92e2:baff:fe23:1a3a",
|
||||
"lla": "fe80::92e2:baff:fe23:1a3a"
|
||||
},
|
||||
|
@ -28,7 +28,7 @@
|
|||
"name": "theatnerr-1",
|
||||
"ipv4": "192.168.10.10",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:320a:96de:80ff:fe6c:eef",
|
||||
"gua": "2600:6c4a:7880:130a:96de:80ff:fe6c:eef",
|
||||
"ula": "fd9e:1a04:f01d:10:96de:80ff:fe6c:eef",
|
||||
"lla": "fe80::96de:80ff:fe6c:eef"
|
||||
},
|
||||
|
@ -38,7 +38,7 @@
|
|||
"name": "monitnerr-1",
|
||||
"ipv4": "192.168.10.11",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:320a:dea6:32ff:fe1e:6694",
|
||||
"gua": "2600:6c4a:7880:130a:dea6:32ff:fe1e:6694",
|
||||
"ula": "fd9e:1a04:f01d:10:dea6:32ff:fe1e:6694",
|
||||
"lla": "fe80::dea6:32ff:fe1e:6694"
|
||||
},
|
||||
|
@ -48,7 +48,7 @@
|
|||
"name": "monitnerr-2",
|
||||
"ipv4": "192.168.10.12",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:320a:dea6:32ff:fe7e:b6fe",
|
||||
"gua": "2600:6c4a:7880:130a:dea6:32ff:fe7e:b6fe",
|
||||
"ula": "fd9e:1a04:f01d:10:dea6:32ff:fe7e:b6fe",
|
||||
"lla": "fe80::dea6:32ff:fe7e:b6fe"
|
||||
},
|
||||
|
@ -60,7 +60,7 @@
|
|||
"name": "switch-livingroom01",
|
||||
"ipv4": "192.168.1.2",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3200:f29f:c2ff:fe0b:28ca",
|
||||
"gua": "2600:6c4a:7880:1300:f29f:c2ff:fe0b:28ca",
|
||||
"ula": "fd9e:1a04:f01d:0:f29f:c2ff:fe0b:28ca",
|
||||
"lla": "fe80::f29f:c2ff:fe0b:28ca"
|
||||
},
|
||||
|
@ -70,7 +70,7 @@
|
|||
"name": "switch-office01",
|
||||
"ipv4": "192.168.1.3",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3200:f29f:c2ff:fece:7ee1",
|
||||
"gua": "2600:6c4a:7880:1300:f29f:c2ff:fece:7ee1",
|
||||
"ula": "fd9e:1a04:f01d:0:f29f:c2ff:fece:7ee1",
|
||||
"lla": "fe80::f29f:c2ff:fece:7ee1"
|
||||
},
|
||||
|
@ -80,7 +80,7 @@
|
|||
"name": "switch-office02",
|
||||
"ipv4": "192.168.1.4",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3200:c6ad:34ff:feba:4082",
|
||||
"gua": "2600:6c4a:7880:1300:c6ad:34ff:feba:4082",
|
||||
"ula": "fd9e:1a04:f01d:0:c6ad:34ff:feba:4082",
|
||||
"lla": "fe80::c6ad:34ff:feba:4082"
|
||||
},
|
||||
|
@ -90,7 +90,7 @@
|
|||
"name": "ap-livingroom02",
|
||||
"ipv4": "192.168.1.5",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3200:7683:c2ff:fe7a:c615",
|
||||
"gua": "2600:6c4a:7880:1300:7683:c2ff:fe7a:c615",
|
||||
"ula": "fd9e:1a04:f01d:0:7683:c2ff:fe7a:c615",
|
||||
"lla": "fe80::7683:c2ff:fe7a:c615"
|
||||
},
|
||||
|
@ -100,7 +100,7 @@
|
|||
"name": "keylight",
|
||||
"ipv4": "192.168.66.10",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3242:3e6a:9dff:fe12:c4dc",
|
||||
"gua": "2600:6c4a:7880:1342:3e6a:9dff:fe12:c4dc",
|
||||
"ula": "fd9e:1a04:f01d:66:3e6a:9dff:fe12:c4dc",
|
||||
"lla": "fe80::3e6a:9dff:fe12:c4dc"
|
||||
},
|
||||
|
@ -114,7 +114,7 @@
|
|||
"internal_domain": false,
|
||||
"ipv4": "192.168.30.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:321e::1",
|
||||
"gua": "2600:6c4a:7880:131e::1",
|
||||
"ula": "fd9e:1a04:f01d:30::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -124,7 +124,7 @@
|
|||
"internal_domain": true,
|
||||
"ipv4": "192.168.1.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3200::1",
|
||||
"gua": "2600:6c4a:7880:1300::1",
|
||||
"ula": "fd9e:1a04:f01d::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -134,7 +134,7 @@
|
|||
"internal_domain": false,
|
||||
"ipv4": "192.168.9.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3209::1",
|
||||
"gua": "2600:6c4a:7880:1309::1",
|
||||
"ula": "fd9e:1a04:f01d:9::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -144,7 +144,7 @@
|
|||
"internal_domain": false,
|
||||
"ipv4": "192.168.66.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3242::1",
|
||||
"gua": "2600:6c4a:7880:1342::1",
|
||||
"ula": "fd9e:1a04:f01d:66::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -154,7 +154,7 @@
|
|||
"internal_domain": false,
|
||||
"ipv4": "192.168.2.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3202::1",
|
||||
"gua": "2600:6c4a:7880:1302::1",
|
||||
"ula": "fd9e:1a04:f01d:2::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -164,7 +164,7 @@
|
|||
"internal_domain": true,
|
||||
"ipv4": "192.168.10.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:320a::1",
|
||||
"gua": "2600:6c4a:7880:130a::1",
|
||||
"ula": "fd9e:1a04:f01d:10::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -174,7 +174,7 @@
|
|||
"internal_domain": true,
|
||||
"ipv4": "192.168.110.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:326e::1",
|
||||
"gua": "2600:6c4a:7880:136e::1",
|
||||
"ula": "fd9e:1a04:f01d:110::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -182,7 +182,7 @@
|
|||
"wan0": {
|
||||
"name": "enp1s0",
|
||||
"internal_domain": false,
|
||||
"ipv4": "24.176.57.23",
|
||||
"ipv4": "174.81.250.254",
|
||||
"ipv6": {
|
||||
"gua": "",
|
||||
"ula": "",
|
||||
|
@ -194,7 +194,7 @@
|
|||
"internal_domain": false,
|
||||
"ipv4": "192.168.20.1",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3214::1",
|
||||
"gua": "2600:6c4a:7880:1314::1",
|
||||
"ula": "fd9e:1a04:f01d:20::1",
|
||||
"lla": "fe80::1"
|
||||
}
|
||||
|
@ -216,7 +216,7 @@
|
|||
"name": "wg0",
|
||||
"ipv4": "192.168.20.0/24",
|
||||
"ipv6": {
|
||||
"gua": "2600:6c4a:7880:3214::/64",
|
||||
"gua": "2600:6c4a:7880:1314::/64",
|
||||
"ula": "fd9e:1a04:f01d:20::/64",
|
||||
"lla": "fe80::/64"
|
||||
}
|
||||
|
@ -227,7 +227,7 @@
|
|||
"public_key": "VWRsPtbdGtcNyaQ+cFAZfZnYL05uj+XINQS6yQY5gQ8=",
|
||||
"allowed_ips": [
|
||||
"192.168.20.10/32",
|
||||
"2600:6c4a:7880:3214::a/128",
|
||||
"2600:6c4a:7880:1314::a/128",
|
||||
"fd9e:1a04:f01d:20::a/128",
|
||||
"fe80::a/128"
|
||||
]
|
||||
|
@ -237,7 +237,7 @@
|
|||
"public_key": "UvwWyMQ1ckLEG82Qdooyr0UzJhqOlzzcx90DXuwMTDA=",
|
||||
"allowed_ips": [
|
||||
"192.168.20.11/32",
|
||||
"2600:6c4a:7880:3214::b/128",
|
||||
"2600:6c4a:7880:1314::b/128",
|
||||
"fd9e:1a04:f01d:20::b/128",
|
||||
"fe80::b/128"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue