feat: IPv6 (#192)

* feat: custom ipv6 routes for all hosts
* fix: ipv6 - k3s+cilium
This commit is contained in:
Ryan Yin
2025-06-08 19:12:55 +08:00
committed by GitHub
parent 10924e67e1
commit 77ed0378d1
20 changed files with 278 additions and 24 deletions

View File

@@ -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