Темы
Дополнительные материалы
Dnscrypt — Проксирование dns-трафика
BIND — DNS-сервер
- Все физические интерфейсы прослушиваются dnscrypt-proxy
Код: Выделить всё
tcp 0 0 195.0.1.3:53 0.0.0.0:* LISTEN 20059/dnscrypt-proxy tcp6 0 0 2000:2cc0:13b1:3333::53 :::* LISTEN 20059/dnscrypt-proxy udp 0 0 195.0.1.3:53 0.0.0.0:* 20059/dnscrypt-proxy udp6 0 0 2000:2cc0:13b1:3333::53 :::* 20059/dnscrypt-proxy - DNS-Сервер висит на loopback
Код: Выделить всё
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 6238/named udp 0 0 127.0.0.1:53 0.0.0.0:* 6238/named tcp6 0 0 ::1:53 :::* LISTEN 6238/named udp6 0 0 ::1:53 :::* 6238/named - dnscrypt-proxy прокидывает трафик DNS на loopback
cat /etc/dnscrypt-proxy/forwarding-rules.txtКод: Выделить всё
## Перенаправляем на DNS-сервер 127.0.0.1 запросы для локальных зон free-adm.ru 127.0.0.1:53 1.0.195.in-addr.arpa 127.0.0.1:53 test.ru 127.0.0.1:53 10.in-addr.arpa 127.0.0.1:53 free-adm6.ru [::1]:53 3.3.3.3.1.b.3.1.0.c.c.2.0.0.0.2.ip6.arpa [::1]:53 - Конфигурация DNS-сервера выдлядит следущим образом
Код: Выделить всё
cat /etc/named.conf // named.conf // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // See /usr/share/doc/bind*/sample/ for example named configuration files. // Список доверенных серверов дя передачи зон acl "trusted-dns" { 195.0.1.1; 195.0.1.8; }; acl "ZoneTransfer" { 195.0.1/24; }; acl "def-client" { localhost; 127/8; ::1; }; acl "networks" { 195.0.1/24; 10/8; 2000:2cc0:13b1:3333::/64; }; acl "IP-ADDR" { 127.0.0.1; }; acl "IP-ADDR6" { ::1; }; options { listen-on port 53 { IP-ADDR; }; listen-on-v6 port 53 { IP-ADDR6; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; memstatistics-file "/var/named/data/named_mem_stats.txt"; allow-query { def-client; networks; }; recursion yes; dnssec-enable yes; dnssec-validation yes; //dnssec-lookaside auto; empty-zones-enable no; /* Path to ISC DLV key */ bindkeys-file "/etc/named.root.key"; managed-keys-directory "/var/named/dynamic"; pid-file "/run/named/named.pid"; session-keyfile "/run/named/session.key"; version "Bind DNS Server"; //14418MB max-cache-size 10m; // maximum cache size of 10MB //cleaning-interval 15; // clean cache every 15 minutes }; include "/etc/named.root.key"; // вид для localhost. Просмотр всех зон view "default" { // 127/8; localhost; - Для разрешения имён этим хостом match-clients { def-client; }; match-destinations { IP-ADDR; IP-ADDR6;}; // Наш сервер рекурсивен для localhost allow-recursion { def-client; }; zone "free-adm.ru" IN { type master; file "masters/free-adm.ru.zone"; }; zone "1.0.195.IN-ADDR.ARPA" IN { type master; file "masters/1.0.195.zone"; }; zone "test.ru" IN { type master; file "masters/test.ru.zone"; }; zone "10.IN-ADDR.ARPA" IN { type master; file "masters/10.zone"; }; // zone "google.loc" IN { type forward; forward only; forwarders { 195.0.1.51; }; }; zone "free-adm6.ru" IN { type master; file "masters/free-adm6.ru.zone"; // allow-transfer { ZoneTransfer; }; }; zone "3.3.3.3.1.b.3.1.0.c.c.2.0.0.0.2.ip6.arpa" IN { type master; file "masters/33331b310cc20002zone"; allow-transfer { ZoneTransfer; }; }; include "/etc/named.rfc1912.zones"; zone "." IN { type hint; file "named.ca"; }; // Зона блокировки нежелательных ресурсов response-policy { zone "rpz.zone" policy given; }; zone "rpz.zone" { type master; file "masters/rpz.zone"; allow-update { none; }; }; }; # Вид для внешних зон view "external" { match-clients { networks; }; match-destinations { IP-ADDR; IP-ADDR6;}; // сначала запрещаем передачу зон для вида, а затем для нужных зон разрешаем allow-transfer { none; }; allow-recursion { networks; }; zone "free-adm.ru" IN { type master; file "masters/free-adm.ru.zone"; allow-transfer { ZoneTransfer; }; }; zone "1.0.195.IN-ADDR.ARPA" IN { type master; file "masters/1.0.195.zone"; allow-transfer { ZoneTransfer; }; }; zone "free-adm6.ru" IN { type master; file "masters/free-adm6.ru.zone"; // allow-transfer { ZoneTransfer; }; }; zone "3.3.3.3.1.b.3.1.0.c.c.2.0.0.0.2.ip6.arpa" IN { type master; file "masters/33331b310cc20002zone"; allow-transfer { ZoneTransfer; }; }; zone "." IN { type hint; file "named.ca"; }; // Зона блокировки нежелательных ресурсов /* response-policy { zone "rpz.zone" policy given; }; zone "rpz.zone" { type master; file "masters/rpz.zone"; allow-update { none; }; }; */ }; /* ########################################################################### Use with the following in named.conf, adjusting the allow list as needed: */ key "rndc-key" { algorithm hmac-md5; secret "secret_key"; }; controls { inet 195.0.1.3 port 953 allow { 195.0.1.3; } keys { "rndc-key"; }; };