|
| 1 | +# /etc/unbound/unbound.conf |
| 2 | +# |
| 3 | +# Unbound configuration file for Debian. |
| 4 | +# |
| 5 | +# See the unbound.conf(5) man page. |
| 6 | +# |
| 7 | +# See /usr/share/doc/unbound/examples/unbound.conf for a commented |
| 8 | +# reference config file. |
| 9 | +# |
| 10 | +# The following line includes additional configuration files from the |
| 11 | +# /etc/unbound/unbound.conf.d directory. |
| 12 | +include-toplevel: "/etc/unbound/unbound.conf.d/*.conf" |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +server: |
| 17 | + verbosity: 1 |
| 18 | + #logfile: "/var/unbound/etc/unbound.log" |
| 19 | + #logfile: "/var/log/unbound.log" |
| 20 | + use-syslog: yes #overrides logfile setting above |
| 21 | + log-queries: yes |
| 22 | + log-replies: yes |
| 23 | + log-tag-queryreply: yes |
| 24 | + port: 53 |
| 25 | + do-ip4: yes |
| 26 | + do-ip6: no |
| 27 | + do-udp: yes |
| 28 | + do-tcp: yes |
| 29 | + directory: "/etc/unbound" |
| 30 | + #chroot: "/var/unbound" |
| 31 | + interface: {{ host_ip }} |
| 32 | + interface: 127.0.0.1 |
| 33 | + |
| 34 | + access-control: 0.0.0.0/0 refuse |
| 35 | + access-control: ::0/0 refuse |
| 36 | + access-control: {{ network_addr }}/24 allow |
| 37 | + access-control: 127.0.0.0/8 allow_snoop |
| 38 | + hide-identity: yes |
| 39 | + hide-version: yes |
| 40 | + harden-glue: yes |
| 41 | + root-hints: "/var/lib/unbound/root.hints" |
| 42 | + auto-trust-anchor-file: "/var/lib/unbound/root.key" |
| 43 | + val-clean-additional: yes |
| 44 | + |
| 45 | + tls-cert-bundle: "/etc/ssl/certs/ca-certificates.crt" |
| 46 | + |
| 47 | + prefetch: yes |
| 48 | + |
| 49 | + minimal-responses: yes |
| 50 | + qname-minimisation: yes |
| 51 | + rrset-roundrobin: yes |
| 52 | + ssl-upstream: yes |
| 53 | + use-caps-for-id: yes |
| 54 | + harden-dnssec-stripped: yes |
| 55 | + cache-min-ttl: 3600 |
| 56 | + cache-max-ttl: 86400 |
| 57 | + |
| 58 | + private-address: 192.168.0.0/16 |
| 59 | + private-address: 172.16.0.0/12 |
| 60 | + private-address: 10.0.0.0/8 |
| 61 | + |
| 62 | + private-address: 0.0.0.0/8 |
| 63 | + private-address: 100.64.0.0/10 |
| 64 | + private-address: 127.0.0.0/8 |
| 65 | + private-address: 169.254.0.0/16 |
| 66 | + private-address: 172.16.0.0/12 |
| 67 | + private-address: 192.0.0.0/24 |
| 68 | + private-address: 192.0.2.0/24 |
| 69 | + private-address: 192.88.99.0/24 |
| 70 | + private-address: 198.18.0.0/15 |
| 71 | + private-address: 198.51.100.0/24 |
| 72 | + private-address: 203.0.113.0/24 |
| 73 | + private-address: 224.0.0.0/4 |
| 74 | + private-address: 240.0.0.0/4 |
| 75 | + private-address: 255.255.255.255/32 |
| 76 | + |
| 77 | + |
| 78 | +# number of threads to create. 1 disables threading. This should equal the number |
| 79 | +# of CPU cores in the machine. Our example machine has 4 CPU cores. |
| 80 | + num-threads: 4 |
| 81 | + |
| 82 | +## Unbound Optimization and Speed Tweaks ### |
| 83 | + |
| 84 | +# the number of slabs to use for cache and must be a power of 2 times the |
| 85 | +# number of num-threads set above. more slabs reduce lock contention, but |
| 86 | +# fragment memory usage. |
| 87 | + msg-cache-slabs: 8 |
| 88 | + rrset-cache-slabs: 8 |
| 89 | + infra-cache-slabs: 8 |
| 90 | + key-cache-size: 32m |
| 91 | + key-cache-slabs: 8 |
| 92 | + |
| 93 | +# Increase the memory size of the cache. Use roughly twice as much rrset cache |
| 94 | +# memory as you use msg cache memory. Due to malloc overhead, the total memory |
| 95 | +# usage is likely to rise to double (or 2.5x) the total cache memory. The test |
| 96 | +# box has 4gig of ram so 256meg for rrset allows a lot of room for cacheed objects. |
| 97 | + rrset-cache-size: 512m |
| 98 | + msg-cache-size: 256m |
| 99 | + |
| 100 | +# buffer size for UDP port 53 incoming (SO_RCVBUF socket option). This sets |
| 101 | +# the kernel buffer larger so that no messages are lost in spikes in the traffic. |
| 102 | + #so-rcvbuf: 1m |
| 103 | + #so-rcvbuf: 32m |
| 104 | + |
| 105 | + outgoing-range: 32768 |
| 106 | + num-queries-per-thread: 4096 |
| 107 | + infra-cache-numhosts: 100000 |
| 108 | + |
| 109 | + |
| 110 | +## Unbound Optimization and Speed Tweaks ### |
| 111 | + |
| 112 | + |
| 113 | +# Use an upstream forwarder (recursive resolver) for specific zones. |
| 114 | +# Example addresses given below are public resolvers valid as of 2014/03. |
| 115 | +# |
| 116 | +forward-zone: |
| 117 | + name: "." # use for ALL queries |
| 118 | + forward-tls-upstream: yes |
| 119 | + forward-addr: 9.9.9.9@853#dns.quad9.net |
| 120 | + forward-addr: 149.112.112.112@853#dns.quad9.net |
| 121 | + forward-addr: 1.1.1.2@853#cloudflare-dns.com |
| 122 | + forward-addr: 1.0.0.2@853#cloudflare-dns.com |
| 123 | + forward-addr: 185.228.168.9@853#security-filter-dns.cleanbrowsing.org |
| 124 | + forward-addr: 185.228.169.9@853#security-filter-dns.cleanbrowsing.org |
| 125 | + forward-addr: 176.103.130.130@853#dns.adguard.com |
| 126 | + forward-addr: 176.103.130.131@853#dns.adguard.com |
| 127 | + #forward-addr: 45.90.28.0#b978e6.dns1.nextdns.io |
| 128 | + #forward-addr: 45.90.30.0#b978e6.dns2.nextdns.io |
| 129 | + |
| 130 | + |
| 131 | + #forward-addr: 185.222.222.222@853 # dns.sb primary |
| 132 | + #forward-addr: 185.184.222.222@853 # dns.sb secondary |
| 133 | + #forward-addr: 8.8.8.8@853 # google primary |
| 134 | + #forward-addr: 8.8.4.4@853 # google secondary |
0 commit comments