nixos: dns ipv6 support

This commit is contained in:
Vivian 2021-11-21 20:26:08 +01:00
parent b965765312
commit a967b6ab05
2 changed files with 9 additions and 2 deletions

View file

@ -2,6 +2,7 @@
{
hostname = "edgerouter";
ip = "10.42.42.1";
ip6 = "2001:41f0:9639:1:b6fb:e4ff:fe53:9c0";
mac = "B4:FB:E4:53:9C:0A";
nix = false;
}
@ -9,6 +10,7 @@
hostname = "nuc";
ip = "10.42.42.42";
mac = "1C:69:7A:62:30:88";
ip6 = "";
nix = false;
}
{
@ -20,6 +22,7 @@
{
hostname = "home-assistant";
ip = "10.42.42.8";
ip6 = "2001:41f0:9639:1:bfe7:3fd9:75de:cbee";
mac = "74:40:be:48:85:a4";
nix = false;
}

View file

@ -1,8 +1,12 @@
{ config, pkgs, hosts, ... }:
let
localdomain = "olympus";
ipv6Hosts = builtins.filter (builtins.hasAttr ip6) hosts;
localData = { hostname, ip, ... }: ''"${hostname}.${localdomain}. A ${ip}"'';
local6Data = { hostname, ip6, ... }: ''"${hostname}.${localdomain}. AAAA ${ip6}"'';
ptrData = { hostname, ip, ... }: ''"${ip} ${hostname}.${localdomain}"'';
ptr6Data = { hostname, ip6, ... }: ''"${ip6} ${hostname}.${localdomain}"'';
in {
imports = [ ];
@ -32,8 +36,8 @@ in {
interface = [ "0.0.0.0" "::0" ];
local-zone = ''"${localdomain}." transparent'';
local-data = map localData hosts;
local-data-ptr = map ptrData hosts;
local-data = (map localData hosts) ++ (map local6Data ipv6Hosts);
local-data-ptr = (map ptrData hosts);
access-control = [
"127.0.0.1/32 allow_snoop"