homelab/nixos/hosts/dns/dnsmasq.nix
plasmagoat a90630ecb6
All checks were successful
Hello World / test (push) Successful in 12s
dump
2025-07-05 11:12:20 +02:00

63 lines
1.5 KiB
Nix

{
services.dnsmasq = {
enable = true;
alwaysKeepRunning = true;
settings = {
domain = "lab";
expand-hosts = true;
domain-needed = true;
# interface = "eth0"; # Replace with your real interface
bind-interfaces = true;
local = [
"/lab/"
"/procopius.dk/"
];
bogus-priv = true;
no-resolv = true;
# no-hosts = true; # Prevent 127.0.0.2 etc from leaking in
server = [
"8.8.8.8"
"8.8.4.4"
"1.1.1.1"
"1.0.0.1"
];
# Static DNS entry: map hostname to IP (without DHCP)
address = [
# Static IPs
"/dns.lab/192.168.1.53"
"/traefik.lab/192.168.1.80"
# "/proxmox-01.lab/192.168.1.205"
# "/nas-01.lab/192.168.1.226"
"/mail.procopius.dk/213.32.245.247"
# Split Horizon DNS
"/procopius.dk/192.168.1.80"
"/.procopius.dk/192.168.1.80"
];
cache-size = 10000;
dhcp-authoritative = true;
dhcp-range = "192.168.1.100,192.168.1.254,12h";
dhcp-host = "bc:24:11:58:f5:da,dns,192.168.1.53";
# "Use 192.168.1.53 as your DNS server."
dhcp-option = [
"option:router,192.168.1.1" # router
"option:dns-server,192.168.1.53" # DNS server (this VM)
];
log-queries = true;
localise-queries = true;
log-async = true;
# log-facility = "/var/log/dnsmasq/dnsmasq.log";
};
};
services.prometheus.exporters.dnsmasq.enable = true;
services.prometheus.exporters.dnsmasq.openFirewall = true;
}