mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-05 20:41:40 +02:00
feat: IPv6 (#192)
* feat: custom ipv6 routes for all hosts * fix: ipv6 - k3s+cilium
This commit is contained in:
@@ -33,7 +33,6 @@ in {
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
|
||||
# Add ipv4 address to the bridge.
|
||||
systemd.network.networks."10-${iface}" = {
|
||||
matchConfig.Name = [iface];
|
||||
networkConfig = {
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#############################################################
|
||||
let
|
||||
hostName = "aquamarine"; # Define your hostname.
|
||||
|
||||
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
|
||||
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
|
||||
ipv4WithMask = "${ipv4}/24";
|
||||
in {
|
||||
imports =
|
||||
(mylib.scanPaths ./.)
|
||||
@@ -43,9 +47,36 @@ in {
|
||||
|
||||
networking = {
|
||||
inherit hostName;
|
||||
inherit (myvars.networking) defaultGateway nameservers;
|
||||
inherit (myvars.networking.hostsInterface.${hostName}) interfaces;
|
||||
|
||||
# we use networkd instead
|
||||
networkmanager.enable = false;
|
||||
useDHCP = false;
|
||||
};
|
||||
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
|
||||
systemd.network.networks."10-${iface}" = {
|
||||
matchConfig.Name = [iface];
|
||||
networkConfig = {
|
||||
Address = [ipv4WithMask];
|
||||
DNS = nameservers;
|
||||
DHCP = "ipv6"; # enable DHCPv6 only, so we can get a GUA.
|
||||
IPv6AcceptRA = true; # for Stateless IPv6 Autoconfiguraton (SLAAC)
|
||||
LinkLocalAddressing = "ipv6";
|
||||
};
|
||||
routes = [
|
||||
{
|
||||
Destination = "0.0.0.0/0";
|
||||
Gateway = defaultGateway;
|
||||
}
|
||||
{
|
||||
Destination = "::/0";
|
||||
Gateway = defaultGateway6;
|
||||
GatewayOnLink = true; # it's a gateway on local link.
|
||||
}
|
||||
];
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#############################################################
|
||||
let
|
||||
hostName = "kana"; # Define your hostname.
|
||||
|
||||
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
|
||||
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
|
||||
ipv4WithMask = "${ipv4}/24";
|
||||
in {
|
||||
imports = mylib.scanPaths ./.;
|
||||
|
||||
@@ -30,9 +34,36 @@ in {
|
||||
|
||||
networking = {
|
||||
inherit hostName;
|
||||
inherit (myvars.networking) defaultGateway nameservers;
|
||||
inherit (myvars.networking.hostsInterface.${hostName}) interfaces;
|
||||
|
||||
# we use networkd instead
|
||||
networkmanager.enable = false;
|
||||
useDHCP = false;
|
||||
};
|
||||
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
|
||||
systemd.network.networks."10-${iface}" = {
|
||||
matchConfig.Name = [iface];
|
||||
networkConfig = {
|
||||
Address = [ipv4WithMask];
|
||||
DNS = nameservers;
|
||||
DHCP = "ipv6"; # enable DHCPv6 only, so we can get a GUA.
|
||||
IPv6AcceptRA = true; # for Stateless IPv6 Autoconfiguraton (SLAAC)
|
||||
LinkLocalAddressing = "ipv6";
|
||||
};
|
||||
routes = [
|
||||
{
|
||||
Destination = "0.0.0.0/0";
|
||||
Gateway = defaultGateway;
|
||||
}
|
||||
{
|
||||
Destination = "::/0";
|
||||
Gateway = defaultGateway6;
|
||||
GatewayOnLink = true; # it's a gateway on local link.
|
||||
}
|
||||
];
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
#############################################################
|
||||
let
|
||||
hostName = "ruby"; # Define your hostname.
|
||||
|
||||
inherit (myvars.networking) defaultGateway defaultGateway6 nameservers;
|
||||
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
|
||||
ipv4WithMask = "${ipv4}/24";
|
||||
in {
|
||||
imports = mylib.scanPaths ./.;
|
||||
|
||||
@@ -32,9 +36,36 @@ in {
|
||||
|
||||
networking = {
|
||||
inherit hostName;
|
||||
inherit (myvars.networking) defaultGateway nameservers;
|
||||
inherit (myvars.networking.hostsInterface.${hostName}) interfaces;
|
||||
|
||||
# we use networkd instead
|
||||
networkmanager.enable = false;
|
||||
useDHCP = false;
|
||||
};
|
||||
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
|
||||
systemd.network.networks."10-${iface}" = {
|
||||
matchConfig.Name = [iface];
|
||||
networkConfig = {
|
||||
Address = [ipv4WithMask];
|
||||
DNS = nameservers;
|
||||
DHCP = "ipv6"; # enable DHCPv6 only, so we can get a GUA.
|
||||
IPv6AcceptRA = true; # for Stateless IPv6 Autoconfiguraton (SLAAC)
|
||||
LinkLocalAddressing = "ipv6";
|
||||
};
|
||||
routes = [
|
||||
{
|
||||
Destination = "0.0.0.0/0";
|
||||
Gateway = defaultGateway;
|
||||
}
|
||||
{
|
||||
Destination = "::/0";
|
||||
Gateway = defaultGateway6;
|
||||
GatewayOnLink = true; # it's a gateway on local link.
|
||||
}
|
||||
];
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
|
||||
kubeletExtraArgs = [
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
|
||||
"--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
|
||||
];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
|
||||
kubeletExtraArgs = [
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
|
||||
"--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
|
||||
];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
|
||||
kubeletExtraArgs = [
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
|
||||
"--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
|
||||
];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
|
||||
kubeletExtraArgs = [
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
|
||||
"--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
|
||||
];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
|
||||
kubeletExtraArgs = [
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
|
||||
"--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
|
||||
];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "prod-cluster-1.writefor.fun";
|
||||
|
||||
kubeletExtraArgs = [
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.20.0.0/16,fdfd:cafe:00:0003::/64"
|
||||
"--service-cidr=172.21.0.0/16,fdfd:cafe:00:8003::/112"
|
||||
];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -20,6 +20,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "test-cluster-1.writefor.fun";
|
||||
|
||||
# kubeletExtraArgs = [
|
||||
# # IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
# "--cluster-cidr=172.18.0.0/16,fdfd:cafe:00:0002::/64"
|
||||
# "--service-cidr=172.19.0.0/16,fdfd:cafe:00:8002::/112"
|
||||
# ];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "test-cluster-1.writefor.fun";
|
||||
|
||||
# kubeletExtraArgs = [
|
||||
# # IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
# "--cluster-cidr=172.18.0.0/16,fdfd:cafe:00:0002::/64"
|
||||
# "--service-cidr=172.19.0.0/16,fdfd:cafe:00:8002::/112"
|
||||
# ];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
# use my own domain & kube-vip's virtual IP for the API server
|
||||
# so that the API server can always be accessed even if some nodes are down
|
||||
masterHost = "test-cluster-1.writefor.fun";
|
||||
|
||||
# kubeletExtraArgs = [
|
||||
# # IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# # IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# # IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
# "--cluster-cidr=172.18.0.0/16,fdfd:cafe:00:0002::/64"
|
||||
# "--service-cidr=172.19.0.0/16,fdfd:cafe:00:8002::/112"
|
||||
# ];
|
||||
};
|
||||
in {
|
||||
imports =
|
||||
|
||||
@@ -29,6 +29,12 @@
|
||||
# when cpu-manager's static policy is enabled
|
||||
# the memory we reserved here is also for the kernel, since kernel's memory is not accounted in pods
|
||||
"--system-reserved=cpu=1,memory=2Gi,ephemeral-storage=2Gi"
|
||||
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.16.0.0/16,fdfd:cafe:00:0001::/64"
|
||||
"--service-cidr=172.17.0.0/16,fdfd:cafe:00:8001::/112"
|
||||
];
|
||||
nodeLabels = [
|
||||
"node-purpose=kubevirt"
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
# when cpu-manager's static policy is enabled
|
||||
# the memory we reserved here is also for the kernel, since kernel's memory is not accounted in pods
|
||||
"--system-reserved=cpu=1,memory=2Gi,ephemeral-storage=2Gi"
|
||||
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.16.0.0/16,fdfd:cafe:00:0001::/64"
|
||||
"--service-cidr=172.17.0.0/16,fdfd:cafe:00:8001::/112"
|
||||
];
|
||||
nodeLabels = [
|
||||
"node-purpose=kubevirt"
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
# when cpu-manager's static policy is enabled
|
||||
# the memory we reserved here is also for the kernel, since kernel's memory is not accounted in pods
|
||||
"--system-reserved=cpu=1,memory=2Gi,ephemeral-storage=2Gi"
|
||||
|
||||
# IPv4 Private CIDR(full) - 172.16.0.0/12
|
||||
# IPv4 Pod CIDR(full) - fdfd:cafe:00:0000::/64 ~ fdfd:cafe:00:7fff::/64
|
||||
# IPv4 Service CIDR(full) - fdfd:cafe:00:8000::/64 ~ fdfd:cafe:00:ffff::/64
|
||||
"--cluster-cidr=172.16.0.0/16,fdfd:cafe:00:0001::/64"
|
||||
"--service-cidr=172.17.0.0/16,fdfd:cafe:00:8001::/112"
|
||||
];
|
||||
nodeLabels = [
|
||||
"node-purpose=kubevirt"
|
||||
|
||||
Reference in New Issue
Block a user