DNS Recursivo Slave

De Gigafull
Revisão de 17h12min de 1 de março de 2023 por Admin (discussão | contribs) (Criou página com '<big>'''Requisitos'''</big><br> SO: Ubuntu Server 22.04.2 LTS<br> Memória: 4Gb<br> Disco: 40Gb<br> CPU: 2vCPU<br> <big>'''Firewall Entrada'''</big><br> TCP 22 - Confiáveis<...')
(dif) ← Edição anterior | Revisão atual (dif) | Versão posterior → (dif)
Ir para navegação Ir para pesquisar

Requisitos
SO: Ubuntu Server 22.04.2 LTS
Memória: 4Gb
Disco: 40Gb
CPU: 2vCPU

Firewall Entrada
TCP 22 - Confiáveis
TCP/UDP 53 - Somente hosts clientes de consultas

Pacotes Essenciais

apt-get install net-tools -y
apt-get install vim -y
apt-get install nmap -y

Instalação bind9

apt-get install bind9 dnsutils -y

Configurar consultas localmente

echo "nameserver 127.0.0.1" > /etc/resolv.conf
echo "nameserver ::1" >> /etc/resolv.conf

Testes de funcionamento

dig @localhost google.com.br 
dig @127.0.0.1 google.com.br 
dig @::1 google.com.br +short
host google.com.br

Localizando erros de consulta

dig @localhost google.com.br +trace

Configurando Recursivo (Slave)

vim /etc/bind/named.conf.options
acl autorizados {
       127.0.0.1/32;
       ::1/128;
       192.168.0.0/16;
       172.16.0.0/12;
       100.64.0.0/10;
       10.0.0.0/8;
       45.80.48.0/22;
       2804:f123::/32;
       df00::/8;
       2001:db8::/32;
       fe80::/64;
}; 

options {
   directory "/var/cache/bind";
   dnssec-validation auto;
   auth-nxdomain no;
   listen-on { any; };
   listen-on-v6 { any; };
   minimal-responses yes;
   max-ncache-ttl 300;
   allow-recursion { autorizados; };
   allow-query-cache { autorizados; };
   //allow-query { autorizados; }; //Se apenas for recursivo
   allow-query { any; };
   allow-transfer { none; };
   masterfile-format text;
   version "RR DNS Server";
};
logging {

   channel security_file {
       file "/var/log/named/security.log" versions 3 size 30m;
       severity dynamic;
       print-time yes;
   };

   channel file_log {
       file "/var/log/named/bind.log" versions 3 size 1m;
       severity info;
       #severity debug 3;
       print-time yes;
       print-severity yes;
       print-category yes;
   };

   channel dnssec_log {
       file "/var/log/named/dnssec.log" versions 3 size 1m;
       severity warning;
       print-time yes;
   };

   category security { security_file; };
   category default { file_log; };
   category dnssec { dnssec_log; };
   category lame-servers { null; };
   category edns-disabled { null; };
   category resolver { null; };
   category unmatched { null; };

};

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";


Checando as configurações do arquivo

named-checkconf /etc/bind/named.conf.options

Mostra todas configurações

named-checkconf -p

Reiniciar o bind9

systemctl restart bind9
systemctl status bind9
systemctl enable bind9

Criar diretório onde ira ficar os LOGs

mkdir /var/log/named/
chown bind. /var/log/named/
systemctl restart bind9