Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| docker_notes:docker-dns [2024-07-21 Sun wk29 16:22] – [reference] baumkp | docker_notes:docker-dns [2025-12-17 Wed wk51 07:39] (current) – [bind9 config files] baumkp | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| =====Linux setup to forward packets===== | =====Linux setup to forward packets===== | ||
| + | <color # | ||
| + | |||
| The main router must be set to forward packets! | The main router must be set to forward packets! | ||
| - | The ability to forward packets | + | It would seem that as of Debian 13 the ''/ |
| - | *net.ipv4.ip_forward = 1 | + | |
| - | *net.ipv4.conf.all.proxy_arp = 1 | + | The command '' |
| - | * '' | + | |
| - | After applying these changes reboot or apply setting using '' | + | ++++sudo vim /etc/sysctl.d/ |
| + | < | ||
| + | net.ipv4.conf.all.proxy_arp = 1 | ||
| + | net.ipv6.conf.all.forwarding=1</ | ||
| + | ++++ | ||
| + | After applying these changes reboot or apply setting using '' | ||
| + | * '' | ||
| + | |||
| + | The boot systemctl reads the following configuration files to adjust kernel parameters at boot: | ||
| + | */ | ||
| + | */ | ||
| + | */ | ||
| + | */ | ||
| + | */ | ||
| + | |||
| ====References==== | ====References==== | ||
| + | *[[https:// | ||
| *[[https:// | *[[https:// | ||
| + | *[[http:// | ||
| + | *[[https:// | ||
| + | *[[https:// | ||
| + | *[[https:// | ||
| + | *[[https:// | ||
| + | *[[https:// | ||
| =====Bind9 Controls===== | =====Bind9 Controls===== | ||
| - | *''/ | + | *''/ |
| *'' | *'' | ||
| - | *'' | + | *'' |
| *'' | *'' | ||
| *'' | *'' | ||
| Line 36: | Line 60: | ||
| =====bind9 Docker setup===== | =====bind9 Docker setup===== | ||
| + | |||
| + | ====bind9 config files==== | ||
| + | I am basically running a caching and forwarding local DNS. The caching and forwarding should allow improved overall DNS performance. | ||
| + | |||
| + | I breakdown the ''/ | ||
| + | |||
| + | ++++/ | ||
| + | < | ||
| + | // This is the primary configuration file for the BIND DNS server named. | ||
| + | // | ||
| + | // Please read / | ||
| + | // structure of BIND configuration files in Debian, *BEFORE* you customize | ||
| + | // this configuration file. | ||
| + | // | ||
| + | // If you are just adding zones, please do that in / | ||
| + | |||
| + | include "/ | ||
| + | include "/ | ||
| + | include "/ | ||
| + | ++++ | ||
| + | |||
| + | ++++/ | ||
| + | < | ||
| + | 192.168.1/ | ||
| + | 127.0.0.1; | ||
| + | localhost; | ||
| + | localnets; | ||
| + | ::1; | ||
| + | fe80::/64; | ||
| + | 2404: | ||
| + | }; | ||
| + | |||
| + | tls quad9-tls { remote-hostname " | ||
| + | tls cloudflare-tls { remote-hostname " | ||
| + | tls google-tls { remote-hostname " | ||
| + | |||
| + | options { | ||
| + | |||
| + | directory "/ | ||
| + | |||
| + | auth-nxdomain no; # conform to RFC1035 | ||
| + | |||
| + | // dnssec-validation auto; //set to auto by default | ||
| + | //bind now uses dnssec by default | ||
| + | |||
| + | recursion yes; | ||
| + | allow-recursion { | ||
| + | trusted; | ||
| + | }; | ||
| + | | ||
| + | /* forwarders { | ||
| + | //quad9 with basic malware blocking, no ECS | ||
| + | 9.9.9.9; | ||
| + | 149.112.112.112; | ||
| + | 2620: | ||
| + | 2620:fe::9; | ||
| + | // | ||
| + | //1.1.1.1; | ||
| + | //1.0.0.1; | ||
| + | // | ||
| + | 1.1.1.2; | ||
| + | 1.0.0.2; | ||
| + | 2620: | ||
| + | 2620: | ||
| + | //Opendns basic | ||
| + | 208.67.222.222; | ||
| + | 208.67.220.220; | ||
| + | 2620: | ||
| + | 2620: | ||
| + | }; */ | ||
| + | |||
| + | forwarders port 853 { | ||
| + | 9.9.9.9 tls quad9-tls; | ||
| + | 149.112.112.112 tls quad9-tls; | ||
| + | 2620:fe::fe tls quad9-tls; | ||
| + | 2620:fe::9 tls quad9-tls; | ||
| + | |||
| + | 1.1.1.1 tls cloudflare-tls; | ||
| + | 1.0.0.1 tls cloudflare-tls; | ||
| + | 2606: | ||
| + | 2606: | ||
| + | |||
| + | 8.8.8.8 tls google-tls; | ||
| + | 8.8.4.4 tls google-tls; | ||
| + | 2001: | ||
| + | 2001: | ||
| + | }; | ||
| + | |||
| + | allow-query { | ||
| + | trusted; | ||
| + | }; | ||
| + | |||
| + | allow-transfer { | ||
| + | trusted; | ||
| + | }; | ||
| + | | ||
| + | //listen-on { any; }; | ||
| + | // | ||
| + | |||
| + | }; | ||
| + | |||
| + | logging { | ||
| + | channel bind.log { | ||
| + | file "/ | ||
| + | severity notice; | ||
| + | print-category yes; | ||
| + | print-severity yes; | ||
| + | print-time yes; | ||
| + | }; | ||
| + | | ||
| + | category queries { bind.log; }; | ||
| + | category default { bind.log; }; | ||
| + | category config { bind.log; }; | ||
| + | }; | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | ++++/ | ||
| + | < | ||
| + | // | ||
| + | // | ||
| + | // }; | ||
| + | |||
| + | zone " | ||
| + | type master; | ||
| + | file "/ | ||
| + | allow-transfer { trusted; }; | ||
| + | also-notify { 192.168.1.2; | ||
| + | // allow-update { key rndc-key; }; | ||
| + | }; | ||
| + | |||
| + | zone " | ||
| + | type master; | ||
| + | file "/ | ||
| + | allow-transfer { trusted; }; | ||
| + | also-notify { 192.168.1.2; | ||
| + | // allow-update { key rndc-key; }; | ||
| + | }; | ||
| + | </ | ||
| + | ++++ | ||
| + | |||
| + | ++++/ | ||
| + | < | ||
| + | type hint; | ||
| + | file " | ||
| + | }; | ||
| + | |||
| + | zone " | ||
| + | type master; | ||
| + | file " | ||
| + | allow-update { none; }; | ||
| + | notify no; | ||
| + | }; | ||
| + | |||
| + | zone " | ||
| + | type master; | ||
| + | file " | ||
| + | allow-update { none; }; | ||
| + | notify no; | ||
| + | }; </ | ||
| + | ++++ | ||
| + | |||
| + | ++++NOT USED, as not running a recursive DNS: / | ||
| + | < | ||
| + | // recursive DNS resolver. If you want to run an authoritative nameserver | ||
| + | // instead, see / | ||
| + | // | ||
| + | // BIND supports using the same daemon as both authoritative nameserver and | ||
| + | // recursive resolver; it supports this because it is the oldest and original | ||
| + | // nameserver and so was designed before it was realized that combining these | ||
| + | // functions is inadvisable. | ||
| + | // | ||
| + | // In actual fact, combining these functions is a very bad idea. It is thus | ||
| + | // recommended that you run a given instance of BIND as either an authoritative | ||
| + | // nameserver or recursive resolver, not both. The example configuration herein | ||
| + | // provides a starting point for running a recursive resolver. | ||
| + | // | ||
| + | // | ||
| + | // *** IMPORTANT *** | ||
| + | // You should note that running an open DNS resolver (that is, a resolver which | ||
| + | // answers queries from any globally routable IP) makes the resolver vulnerable | ||
| + | // to abuse in the form of reflected DDoS attacks. | ||
| + | // | ||
| + | // These attacks are now widely prevalent on the open internet. Even if | ||
| + | // unadvertised, | ||
| + | // global IPv4 address space. | ||
| + | // | ||
| + | // In one case the traffic generated using such an attack reached 300 Gb/s (!). | ||
| + | // | ||
| + | // It is therefore imperative that you take care to configure the resolver to | ||
| + | // only answer queries from IP address space you trust or control. See the | ||
| + | // " | ||
| + | // | ||
| + | // Bear in mind that with these attacks, the " | ||
| + | // be the intended target of a DDoS attack, so this only protects other networks | ||
| + | // from attack, not your own; ideally therefore you should firewall DNS traffic | ||
| + | // at the borders of your network to eliminate spoofed traffic. | ||
| + | // | ||
| + | // This is a complex issue and some level of understanding of these attacks is | ||
| + | // advisable before you attempt to configure a resolver. | ||
| + | |||
| + | options { | ||
| + | directory "/ | ||
| + | |||
| + | // Specify a list of CIDR masks which should be allowed to issue recursive | ||
| + | // queries to the DNS server. Do NOT specify 0.0.0.0/0 here; see above. | ||
| + | allow-recursion { | ||
| + | 127.0.0.1/ | ||
| + | }; | ||
| + | |||
| + | // If you want this resolver to itself resolve via means of another recursive | ||
| + | // resolver, uncomment this block and specify the IP addresses of the desired | ||
| + | // upstream resolvers. | ||
| + | // | ||
| + | // 123.123.123.123; | ||
| + | // 123.123.123.123; | ||
| + | //}; | ||
| + | |||
| + | // By default the resolver will attempt to perform recursive resolution itself | ||
| + | // if the forwarders are unavailable. If you want this resolver to fail outright | ||
| + | // if the upstream resolvers are unavailable, | ||
| + | //forward only; | ||
| + | | ||
| + | // Configure the IPs to listen on here. | ||
| + | listen-on { 127.0.0.1; }; | ||
| + | listen-on-v6 { none; }; | ||
| + | |||
| + | // If you have problems and are behind a firewall: | ||
| + | // | ||
| + | |||
| + | pid-file "/ | ||
| + | |||
| + | // Removing this block will cause BIND to revert to its default behaviour | ||
| + | // of allowing zone transfers to any host (!). There is no need to allow zone | ||
| + | // transfers when operating as a recursive resolver. | ||
| + | allow-transfer { none; }; | ||
| + | }; | ||
| + | |||
| + | // Briefly, a zone which has been declared delegation-only will be effectively | ||
| + | // limited to containing NS RRs for subdomains, but no actual data beyond its | ||
| + | // own apex (for example, its SOA RR and apex NS RRset). This can be used to | ||
| + | // filter out " | ||
| + | // authoritative name servers whose undelegated (in-zone) data is of no | ||
| + | // interest. | ||
| + | // See http:// | ||
| + | |||
| + | //zone " | ||
| + | //zone " | ||
| + | |||
| + | zone " | ||
| + | type hint; | ||
| + | file " | ||
| + | }; | ||
| + | |||
| + | zone " | ||
| + | type master; | ||
| + | file " | ||
| + | allow-update { none; }; | ||
| + | notify no; | ||
| + | }; | ||
| + | |||
| + | zone " | ||
| + | type master; | ||
| + | file " | ||
| + | allow-update { none; }; | ||
| + | notify no; | ||
| + | }; | ||
| + | </ | ||
| + | ++++ | ||
| ====bind9 docker image==== | ====bind9 docker image==== | ||
| I use the [[https:// | I use the [[https:// | ||
| Line 130: | Line 423: | ||
| ++++ | ++++ | ||
| =====DNS over TLS (DoT)===== | =====DNS over TLS (DoT)===== | ||
| - | It looks like Bind9 is still working on support for DNS over TLS (DoT). It may work on the current developer release 9.19. | + | DNS over TLS encrypts the DNS data so others can not see the specific DNS query and response. |
| + | |||
| + | It looks like Bind9 is still working on support for DNS over TLS (DoT) for forwarders. It may work on the current developer release 9.19. | ||
| *quad9 TLS config data: | *quad9 TLS config data: | ||
| Line 137: | Line 432: | ||
| *'' | *'' | ||
| *'' | *'' | ||
| + | |||
| + | |||
| ====reference==== | ====reference==== | ||
| Line 143: | Line 440: | ||
| *[[https:// | *[[https:// | ||
| *[[https:// | *[[https:// | ||
| - | | + | |
| - | *[[https:// | + | *[[https:// |
| - | *[[https:// | + | *[[https:// |
| *QUAD9 | *QUAD9 | ||
| *[[https:// | *[[https:// | ||
| Line 152: | Line 449: | ||
| *[[https:// | *[[https:// | ||
| * | * | ||
| + | =====Testing DNS===== | ||
| + | My local recursive servers are '' | ||
| + | *Using '' | ||
| + | *'' | ||
| + | *'' | ||
| + | *'' | ||
| + | *'' | ||
| + | *Using '' | ||
| + | *'' | ||
| + | *'' | ||
| + | *'' | ||
| + | *'' | ||
| + | *Using '' | ||
| + | *'' | ||
| + | *'' | ||
| + | *'' | ||
| + | *'' | ||
| + | *Note that bind9 needs to be setup to allow-transfer from the requesting ip address, I include my LAN address range in the bind9 acl. | ||
| + | |||
| + | \\ | ||
| + | To find the version of bind9 used, anywhere from the LAN: | ||
| + | *'' | ||
| + | *'' | ||
| + | =====Public DNS Provideders===== | ||
| + | See internal webpage [[https:// | ||
| + | |||
| + | |||
| + | =====DDNS===== | ||
| + | DDNS (Dynamic DNS) is used to update the DNS server with the DHCP assignments. | ||
| + | |||
| + | To further complicate matters I have 2 Bind9 servers in a master-slave configuration across to separate computers on my LAN as well as 2 separate Kea DHCP servers in a primary-secondary back-up configuration also on 2 separate computers on my LAN. This has worked really well for me. If one DNS or DHCP server are not functional my LAN operates well, previously without backup is the DNS or DHCP servers were not operational the LAN would loose functionality. | ||
| + | |||
| + | *Kea read the Docs: [[https:// | ||
| + | *[[https:// | ||
| + | *[[https:// | ||
| + | *Pre Kea - Using ISC DHCP Server | ||
| + | *[[https:// | ||
| + | *[[https:// | ||
| =====References===== | =====References===== | ||
| | | ||