1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

feat: switch to DHCP based networking for microvms using mDNS for resolution

This commit is contained in:
oddlama 2023-05-26 00:38:05 +02:00
parent 0e3d881887
commit e37601b486
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
8 changed files with 85 additions and 202 deletions

View file

@ -6,7 +6,7 @@
inherit (config.lib.net) cidr;
lanCidrv4 = "192.168.100.0/24";
lanCidrv6 = "fd00::/64";
lanCidrv6 = "fd10::/64";
in {
networking.hostId = config.repo.secrets.local.networking.hostId;
@ -63,6 +63,7 @@ in {
IPForward = "yes";
IPv6PrivacyExtensions = "yes";
IPv6SendRA = true;
MulticastDNS = true;
};
# Announce a static prefix
ipv6Prefixes = [
@ -83,13 +84,6 @@ in {
};
linkConfig.RequiredForOnline = "routable";
};
# Remaining macvtap interfaces should not be touched.
"90-macvtap-no-ll" = {
matchConfig.Kind = "macvtap";
networkConfig.LinkLocalAddressing = "no";
linkConfig.ActivationPolicy = "manual";
linkConfig.Unmanaged = "yes";
};
};
# TODO mkForce nftables
@ -165,7 +159,7 @@ in {
interface = "lan-self";
subnet = lanCidrv4;
pools = [
{pool = "${cidr.host 40 lanCidrv4} - ${cidr.host (-6) lanCidrv4}";}
{pool = "${cidr.host 20 lanCidrv4} - ${cidr.host (-6) lanCidrv4}";}
];
option-data = [
{
@ -184,10 +178,6 @@ in {
extra.microvms.networking = {
baseMac = config.repo.secrets.local.networking.interfaces.lan.mac;
macvtapInterface = "lan";
static = {
baseCidrv4 = lanCidrv4;
baseCidrv6 = lanCidrv6;
};
wireguard.openFirewallRules = ["lan-to-local"];
};
}