User Tools

Site Tools


informatica:linux:bind

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
informatica:linux:bind [2010/11/20 16:42] – creado 95.20.4.69informatica:linux:bind [2015/04/13 20:19] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 bind, dns, dig, lookup bind, dns, dig, lookup
 +
  
 ===== Instalación ===== ===== Instalación =====
  
-  sudo aptitude update && sudo aptitude install bind9+  sudo aptitude updatesudo aptitude install bind9
  
 ===== Configuración ===== ===== Configuración =====
  
-{code} +**/etc/bind/named.conf**
-sudo mv /etc/bind/named.conf.old+
  
 +<code>
 +sudo mv /etc/bind/named.conf /etc/bind/named.conf.old
 sudo vim /etc/bind/named.conf sudo vim /etc/bind/named.conf
 +</code>
  
 +<code>
 // //
 // Do any local configuration here // Do any local configuration here
Line 33: Line 37:
         file "/etc/bind/db.192";         file "/etc/bind/db.192";
 }; };
-{code}+ 
 +options { 
 +        directory "/var/cache/bind"; 
 + 
 +        // If there is a firewall between you and nameservers you want 
 +        // to talk to, you may need to fix the firewall to allow multiple 
 +        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113 
 + 
 +        // If your ISP provided one or more IP addresses for stable 
 +        // nameservers, you probably want to use them as forwarders. 
 +        // Uncomment the following block, and insert the addresses replacing 
 +        // the all-0's placeholder. 
 + 
 +        // forwarders { 
 +        //      0.0.0.0; 
 +        // }; 
 + 
 +        forwarders { 
 +        # Replace the address below with the address of your provider's DNS server 
 +        8.8.8.8; 
 +        }; 
 + 
 +        auth-nxdomain no;    # conform to RFC1035 
 +        listen-on-v6 { any; }; 
 +}; 
 +</code
 + 
 +**/etc/bind/db.example.com** 
 + 
 +<code> 
 +sudo vim /etc/bind/db.example.com 
 +</code> 
 + 
 +<code> 
 +$TTL    604800 
 +@       IN      SOA     dns.example.com. root.example.com. ( 
 +                              3         ; Serial 
 +                         604800         ; Refresh 
 +                          86400         ; Retry 
 +                        2419200         ; Expire 
 +                         604800 )       ; Negative Cache TTL 
 +
 +@       IN      NS      dns.example.com. 
 +dns      IN      A       192.168.1.16 
 +www     IN      A       192.168.1.14 
 +alias     IN      CNAME       www 
 +</code> 
 + 
 +**/etc/bind/db.192** 
 + 
 +<code> 
 +sudo vim /etc/bind/db.192 
 +</code> 
 + 
 +<code> 
 +
 +; BIND reverse data file for local loopback interface 
 +
 +$TTL    604800 
 +@       IN      SOA     dns.example.com. root.example.com. ( 
 +                              3         ; Serial 
 +                         604800         ; Refresh 
 +                          86400         ; Retry 
 +                        2419200         ; Expire 
 +                         604800 )       ; Negative Cache TTL 
 +
 +@       IN      NS      dns. 
 +16      IN      PTR     dns.example.com. 
 +14      IN      PTR     www.example.com. 
 +</code> 
 + 
 +===== Probarlo ===== 
 + 
 +1. Editar siguiente archivo: 
 + 
 +  sudo cp /etc/resolv.conf /etc/resolv.conf.bak 
 + 
 +  sudo vim /etc/resolv.conf 
 + 
 +Con el siguiente contenido: 
 + 
 +  search example.com 
 +  nameserver 192.168.1.16 
 + 
 +La ip 192.168.1.16 es la de la maquina donde esta corriendo bind 
 + 
 +3. (Opcional) Instalar paquetes: 
 + 
 +  sudo aptitude update; sudo aptitude install dnsutils 
 + 
 +4. Probar: 
 + 
 +  nslookup www.example.com 
 + 
 +Deberia devolver algo parecido a: 
 + 
 +<code> 
 +nslookup www.example.com 
 +Server: 192.168.1.16 
 +Address: 192.168.1.16#53 
 + 
 +Name: www.example.com 
 +Address: 192.168.1.14 
 +</code> 
 + 
 +Gracias al forward, por supuesto, tambien resuelve direcciones publicas: 
 + 
 +  nslookup www.gmail.com 
 + 
 +Y deberia devolver: 
 + 
 +<code> 
 +Server: 192.168.1.16 
 +Address: 192.168.1.16#53 
 + 
 +Non-authoritative answer: 
 +www.gmail.com canonical name = mail.google.com. 
 +mail.google.com canonical name = googlemail.l.google.com. 
 +Name: googlemail.l.google.com 
 +</code> 
 + 
 +===== Recargar configuración sin reiniciar ===== 
 + 
 +Tras editar los archivos de configuración: 
 + 
 +  sudo rndc reload 
 +   
 +==== Errores ==== 
 + 
 +=== Errores === 
 + 
 + 
 +  nslookup jamgo.es 
 + 
 +<code> 
 +Server: 127.0.0.1 
 +Address: 127.0.0.1#53 
 + 
 +** server can't find jamgo.es: REFUSED 
 +</code> 
 + 
 +Logs: 
 + 
 +  /var/log/syslog 
 + 
 +  Jan 22 14:28:55 dns-1 named[1082]: client 10.7.13.144#34533 (jamgo.es): query (cache) 'jamgo.es/A/IN' denied 
 + 
 +**Solucion** 
 + 
 +  sudo vim /etc/bind/named.conf 
 +   
 +Anyadir el rango de IPs que toquen: 
 + 
 +<code> 
 +# ANYADIDO 22/012015 
 +acl "trusted"
 +    10.7.13.0/24; 
 +}
 +</code> 
 + 
 +Y editar dentro de el bloque options esto: 
 + 
 +<code> 
 +options { 
 +        # ADD 
 +        allow-query { trusted; }; 
 +        allow-recursion { trusted; }; 
 +        allow-query-cache { trusted; }; 
 +}; 
 +</code> 
 + 
 +Recargar config: 
 + 
 +  sudo /etc/init.d/bind9 reload 
 +  
informatica/linux/bind.1290271370.txt.gz · Last modified: 2015/04/13 20:19 (external edit)