You are on page 1of 14

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

MONTAR UN SERVIDOR DNS EN DEBIAN CON EL PAQUETE BIND9 (versin 2.0)


Fuente original: DNS COMO de Nicolai Langfeldt, Jamie Norrish y otros. Traduccin de Pedro Pablo Fbrega (pfabrega@arrakis.es) Se puede encontrar en: http://cauchy.bdat.net/dns/bind-9/DNS-HOWTO-9-es/ Primeramente debemos comprobar que hemos instalado el paquete bind9 que es el encargado de implantar el servidor DNS. En este caso, tendremos un directorio /etc/bind donde se encontrarn los ficheros necesarios. Si no est instalado este paquete, debemos descargarlo e instalarlo con el administrador de paquetes. 1. Comandos tiles. El comando nslookup nos sirve para comprobar cmo se realiza la resolucin DNS, indicndonos cul es el resultado de las consultas a nuestros servidores. Tras ejecutar nslookup, nos aparece una consola en la que podremos explicar el tipo de consulta (set q=any o set q=ns), el servidor DNS a utilizar (server IP o direccin) y la mquina que estamos buscando. Abandonamos la consola con exit. Por ejemplo, sin utilizar servidor DNS local: root@PortatilDaniel:/etc# nslookup Note: nslookup is deprecated and may be removed from future releases. Consider using the `dig' or `host' programs instead. Run nslookup with the `-sil[ent]' option to prevent this message from appearing. > set q=ns > . Indica que la consulta desea Server: 80.58.0.33 conocer los DNS y sus IP's Address: 80.58.0.33#53 Non-authoritative answer: . nameserver = A.ROOT-SERVERS.NET. . nameserver = H.ROOT-SERVERS.NET. . nameserver = C.ROOT-SERVERS.NET. . nameserver = G.ROOT-SERVERS.NET. . nameserver = F.ROOT-SERVERS.NET. . nameserver = B.ROOT-SERVERS.NET. . nameserver = J.ROOT-SERVERS.NET. . nameserver = K.ROOT-SERVERS.NET. . nameserver = L.ROOT-SERVERS.NET. . nameserver = M.ROOT-SERVERS.NET. . nameserver = I.ROOT-SERVERS.NET. . nameserver = E.ROOT-SERVERS.NET. . nameserver = D.ROOT-SERVERS.NET. Consulta los servidores que cubran el dominio raz .

Authoritative answers can be found from: A.ROOT-SERVERS.NET internet address = 198.41.0.4 H.ROOT-SERVERS.NET internet address = 128.63.2.53 C.ROOT-SERVERS.NET internet address = 192.33.4.12
1 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

G.ROOT-SERVERS.NET internet address = 192.112.36.4 F.ROOT-SERVERS.NET internet address = 192.5.5.241 B.ROOT-SERVERS.NET internet address = 192.228.79.201 J.ROOT-SERVERS.NET internet address = 192.58.128.30 K.ROOT-SERVERS.NET internet address = 193.0.14.129 L.ROOT-SERVERS.NET internet address = 198.32.64.12 M.ROOT-SERVERS.NET internet address = 202.12.27.33 I.ROOT-SERVERS.NET internet address = 192.36.148.17 E.ROOT-SERVERS.NET internet address = 192.203.230.10 D.ROOT-SERVERS.NET internet address = 128.8.10.90 > server c.RooT-ServerS.net Indicamos el servidor DNS Default server: c.RooT-ServerS.net a usar mediante su Address: 192.33.4.12#53 nombre o IP (no es Serv. para com? (punto al > set q=ns sensible a maysculas final) > com. Server: Address: c.RooT-ServerS.net 192.33.4.12#53

Non-authoritative answer: *** Can't find com.: No answer Authoritative answers can be found from: com nameserver = A.GTLD-SERVERS.NET. com nameserver = B.GTLD-SERVERS.NET. com nameserver = C.GTLD-SERVERS.NET. com nameserver = D.GTLD-SERVERS.NET. com nameserver = E.GTLD-SERVERS.NET. com nameserver = F.GTLD-SERVERS.NET. com nameserver = G.GTLD-SERVERS.NET. com nameserver = H.GTLD-SERVERS.NET. com nameserver = I.GTLD-SERVERS.NET. com nameserver = J.GTLD-SERVERS.NET. com nameserver = K.GTLD-SERVERS.NET. com nameserver = L.GTLD-SERVERS.NET. com nameserver = M.GTLD-SERVERS.NET. A.GTLD-SERVERS.NET internet address A.GTLD-SERVERS.NET has AAAA address B.GTLD-SERVERS.NET internet address B.GTLD-SERVERS.NET has AAAA address C.GTLD-SERVERS.NET internet address D.GTLD-SERVERS.NET internet address E.GTLD-SERVERS.NET internet address F.GTLD-SERVERS.NET internet address G.GTLD-SERVERS.NET internet address H.GTLD-SERVERS.NET internet address I.GTLD-SERVERS.NET internet address J.GTLD-SERVERS.NET internet address K.GTLD-SERVERS.NET internet address L.GTLD-SERVERS.NET internet address M.GTLD-SERVERS.NET internet address > set q=ns > google.com.
2 de 14.

= 192.5.6.30 2001:503:a83e::2:30 = 192.33.14.30 2001:503:231d::2:30 = 192.26.92.30 = 192.31.80.30 = 192.12.94.30 = 192.35.51.30 = 192.42.93.30 = 192.54.112.30 = 192.43.172.30 = 192.48.79.30 = 192.52.178.30 = 192.41.162.30 = 192.55.83.30

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

Server: Address:

c.RooT-ServerS.net 192.33.4.12#53

Non-authoritative answer: *** Can't find google.com.: No answer Authoritative answers can be found from: com nameserver = A.GTLD-SERVERS.NET. com nameserver = B.GTLD-SERVERS.NET. com nameserver = C.GTLD-SERVERS.NET. com nameserver = D.GTLD-SERVERS.NET. com nameserver = E.GTLD-SERVERS.NET. com nameserver = F.GTLD-SERVERS.NET. com nameserver = G.GTLD-SERVERS.NET. com nameserver = H.GTLD-SERVERS.NET. com nameserver = I.GTLD-SERVERS.NET. com nameserver = J.GTLD-SERVERS.NET. com nameserver = K.GTLD-SERVERS.NET. com nameserver = L.GTLD-SERVERS.NET. com nameserver = M.GTLD-SERVERS.NET. A.GTLD-SERVERS.NET internet address A.GTLD-SERVERS.NET has AAAA address B.GTLD-SERVERS.NET internet address B.GTLD-SERVERS.NET has AAAA address C.GTLD-SERVERS.NET internet address D.GTLD-SERVERS.NET internet address E.GTLD-SERVERS.NET internet address F.GTLD-SERVERS.NET internet address G.GTLD-SERVERS.NET internet address H.GTLD-SERVERS.NET internet address I.GTLD-SERVERS.NET internet address J.GTLD-SERVERS.NET internet address K.GTLD-SERVERS.NET internet address L.GTLD-SERVERS.NET internet address > set q=any > server 192.12.94.30 Default server: 192.12.94.30 Address: 192.12.94.30#53 > www.google.com. Server: 192.12.94.30 Address: 192.12.94.30#53 Non-authoritative answer: *** Can't find www.google.com.: No answer

= 192.5.6.30 2001:503:a83e::2:30 = 192.33.14.30 2001:503:231d::2:30 = 192.26.92.30 = 192.31.80.30 = 192.12.94.30 = 192.35.51.30 = 192.42.93.30 = 192.54.112.30 = 192.43.172.30 = 192.48.79.30 = 192.52.178.30 = 192.41.162.30 Deseamos saberlo todo en la consulta. Servidor DNS a utilizar. Consulta (ojo el punto final)

Authoritative answers can be found from: google.com nameserver = ns1.google.com. google.com nameserver = ns2.google.com. google.com nameserver = ns3.google.com. google.com nameserver = ns4.google.com. ns1.google.com internet address = 216.239.32.10 ns2.google.com internet address = 216.239.34.10 ns3.google.com internet address = 216.239.36.10
3 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

ns4.google.com >exit

internet address = 216.239.38.10

En ocasiones este tipo de consultas las haremos usando el comando dig. root@PortatilDaniel:/etc# dig www.google.es. Resolucin directa.

; <<>> DiG 9.2.4rc5 <<>> www.google.es. ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50075 ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.google.es. ;; ANSWER SECTION: www.google.es. www.google.com. www.l.google.com. www.l.google.com. ;; ;; ;; ;;

IN

327187 792 98 98

IN IN IN IN

CNAME CNAME A A

www.google.com. www.l.google.com. 66.102.9.104 66.102.9.99

Query time: 516 msec SERVER: 80.58.0.33#53(80.58.0.33) WHEN: Mon Apr 25 19:13:56 2005 MSG SIZE rcvd: 111 Resolucin inversa.

root@PortatilDaniel:/etc# dig -x 66.102.9.104

; <<>> DiG 9.2.4rc5 <<>> -x 66.102.9.104 ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 41708 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;104.9.102.66.in-addr.arpa.

IN

PTR

;; AUTHORITY SECTION: 9.102.66.in-addr.arpa. 222 IN SOA admin.google.com. 2005033001 21600 3600 1038800 86400 ;; ;; ;; ;; Query time: 87 msec SERVER: 80.58.0.33#53(80.58.0.33) WHEN: Mon Apr 25 19:14:36 2005 MSG SIZE rcvd: 103

ns1.google.com. dns-

Tambin es til el comando ps -e, con el que conocemos todos los procesos que se encuentran en ejecucin en un determinado momento. Si deseamos finalizar alguno, escribiremos kill -9 <PID>. root@PortatilDaniel:/etc# ps -e PID TTY TIME CMD 1 ? 00:00:04 init
4 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

2 ? 00:00:00 keventd 3 ? 00:00:00 ksoftirqd_CPU0 4 ? 00:00:00 kswapd 5 ? 00:00:00 bdflush 6 ? 00:00:00 kupdated 88 ? 00:00:00 khubd 97 ? 00:00:00 knodemgrd_0 458 ? 00:00:00 portmap 3705 ? 00:00:00 soffice.bin 3708 ? 00:00:00 soffice.bin 3744 ? 00:00:00 soffice.bin 6367 ? 00:00:00 named 6368 ? 00:00:00 named 6369 ? 00:00:00 named 6370 ? 00:00:00 named 6371 ? 00:00:00 named 6377 pts/1 00:00:00 ps root@PortatilDaniel:/etc# kill -9 6367 Para comprobar los ltimos acontecimientos registrados en el log del sistema podemos consultar el archivo syslog (cat /var/log/syslog) pero es muy extenso. Para comprobar slo los ltimos acontecimientos registrados escribiremos tail -f /var/log/syslog 2. Archivos y directorios importantes. En /etc/bind se encuentran los ficheros de configuracin DNS. El ms importante el named.conf donde configuramos las zonas de bsqueda (tanto inversas como directas). Aqu indicaremos en que ficheros se encuentran los archivos donde guardamos la configuracin de cada zona. El fichero /etc/resolv.conf contiene los servidores DNS a utilizar y el dominio de bsqueda donde nos encontramos. A lo sumo permitimos tres DNS. En el caso de que nos encontremos en fichero del servidor DNS que estamos configurando, su aspecto ser similar a ste: search linux.bogus Si hacemos ping pepe, en realidad ser: nameserver 127.0.0.1 ping pepe.linux.bogus nameserver 80.58.0.33 Si nuestra mquina es DNS pondremos su IP. Si no, pondremos el/los DNS de nuestra LAN y/o Proveedor de Servicios de Internet (ISP). named.conf Define las zonas de bsqueda directa e inversa y que ficheros contienen los datos de estas zonas.

5 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

db.root Datos de los servidores raz.

db.127 Datos de la zona inversa 127.0.0.1

db.pepe.santac Datos de pepe.santac la zona ...

3. Configuracin de un servidor DNS de slo cacheo. En el archivo named.conf vamos a aadir las siguientes lneas: zone "0.0.127.in-addr.arpa" { type master; file "/etc/bind/db.127.0.0"; }; named.conf incluye dos lneas que dicen as (NO LAS MODIFIQUES): include "/etc/bind/named.conf.options"; include "/etc/bind/named.conf.local"; Nos indican los ficheros de configuracin adicional. OJO: Ten mucho cuidado con colocar los puntos tal y como vienen aqu. El fichero db.127.0.0 define la zona de bsqueda inversa y colgar de donde indique la clausula options de este fichero named.conf: En caso de no indicar expresamente la ruta absoluta de los ficheros en la opcin file, stos colgarn de donde nos indique la lnea directory "/var/cache/bind"; named.conf.options.1 Ahora, vamos a crear el archivo que contiene la informacin de esa zona de configuracin inversa: / etc/bind/db.127.0.0 Copia y pega directamente esto, poniendo un especial cuidado a los puntos. $TTL 3D @ IN SOA ns.linux.bogus. hostmaster.linux.bogus. ( 1 ; Serial 8H ; Refresh 2H ; Retry 4W ; Expire 1D) ; Minimum TTL ns.linux.bogus. localhost.

NS PTR

Modifica /etc/resolv.conf para que tenga un aspecto similar a ste: nameserver 127.0.0.1 nameserver 80.58.0.33 Pon los DNS de tu ISP

1 MUY IMPORTANTE. SIEMPRE QUE MODIFIQUES FICHEROS DE CONFIGURACIN, REALIZA UNA COPIA DE SEGURIDAD DE LOS MISMOS PREVIAMENTE.
6 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

Arranca el demonio named que se encarga de resolver las consultas de DNS y comprueba que todo ha ido bien: root@PortatilDaniel:/etc/bind# named root@PortatilDaniel:/etc/bind# tail -f /var/log/syslog Apr 25 19:57:09 PortatilDaniel named[8763]: couldn't add command channel 127.0.0.1#953: permission denied Apr 25 19:57:09 PortatilDaniel named[8763]: none:0: open: / etc/bind/rndc.key: permission denied Apr 25 19:57:09 PortatilDaniel named[8763]: couldn't add command channel :: 1#953: permission denied Apr 25 19:57:09 PortatilDaniel named[8763]: zone 0.in-addr.arpa/IN: loaded serial 1 Apr 25 19:57:09 PortatilDaniel named[8763]: zone 127.in-addr.arpa/IN: loaded serial 1 Apr 25 19:57:09 PortatilDaniel named[8763]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1 Apr 25 19:57:09 PortatilDaniel named[8763]: zone 255.in-addr.arpa/IN: loaded serial 1 Apr 25 19:57:09 PortatilDaniel named[8763]: zone linux.bogus/IN: loaded serial 199802151 Apr 25 19:57:09 PortatilDaniel named[8763]: zone localhost/IN: loaded serial 1 Apr 25 19:57:09 PortatilDaniel named[8763]: running En el caso de que hubiramos cometido algn error sintctico en la configuracin de los ficheros, nos lo habra indicado en esta salida. Comprobaremos que todo funciona usando dig o nslookup: root@PortatilDaniel:/etc/bind# dig -x 127.0.0.1 ; <<>> DiG 9.2.4rc5 <<>> -x 127.0.0.1 ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25489 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;1.0.0.127.in-addr.arpa. ;; ANSWER SECTION: 1.0.0.127.in-addr.arpa. 259200 ;; AUTHORITY SECTION: 0.0.127.in-addr.arpa. ;; ADDITIONAL SECTION: ns.linux.bogus.

IN

PTR

IN

PTR

localhost.

259200

IN

NS

ns.linux.bogus.

259200

IN

192.168.196.2

;; Query time: 2 msec ;; SERVER: 127.0.0.1#53(127.0.0.1)


7 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

;; WHEN: Mon Apr 25 19:59:23 2005 ;; MSG SIZE rcvd: 107 Como vers a continuacin, la primera vez que solicitamos una consulta, la respuesta la obtenemos del DNS de nuestro ISP. La vez siguiente, es nuestra mquina local la que nos da la respuesta. Puedes comprobar que los tiempos de respuesta se reducen drsticamente gracias a la cach (hacer esto es til cuando nuestra conexin a Internet es lenta). root@PortatilDaniel:/etc/bind# dig www.terra.es ; <<>> DiG 9.2.4rc5 <<>> www.terra.es ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 22090 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.terra.es. ;; ANSWER SECTION: www.terra.es. ;; ;; ;; ;;

IN

27446

IN

213.4.130.210

Query time: 139 msec SERVER: 80.58.0.33#53(80.58.0.33) WHEN: Mon Apr 25 20:00:22 2005 MSG SIZE rcvd: 46

root@PortatilDaniel:/etc/bind# dig www.terra.es ; <<>> DiG 9.2.4rc5 <<>> www.terra.es ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52060 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0 ;; QUESTION SECTION: ;www.terra.es. ;; ANSWER SECTION: www.terra.es. ;; AUTHORITY SECTION: terra.es. terra.es. ;; ;; ;; ;;

IN

28797

IN

213.4.130.210

28797 28797

IN IN

NS NS

dns1.terra.es. dns2.terra.es.

Query time: 2 msec SERVER: 127.0.0.1#53(127.0.0.1) WHEN: Mon Apr 25 20:00:25 2005 MSG SIZE rcvd: 84

Para matar al demonio named, pide una lista de los procesos en ejecucin. Vers que hay varias copias de named ejecutndose. Mata la primera de ellas.

8 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

root@PortatilDaniel:/etc/bind# ps -e PID TTY TIME CMD 1 ? 00:00:04 init 2 ? 00:00:00 keventd 3 ? 00:00:00 ksoftirqd_CPU0 4 ? 00:00:00 kswapd 5 ? 00:00:00 bdflush ........... ........... 8393 pts/1 00:00:01 kwrite 8400 ? 00:00:00 kdeinit 8761 ? 00:00:00 named 8762 ? 00:00:00 named 8763 ? 00:00:00 named 8764 ? 00:00:00 named 8765 ? 00:00:00 named 9221 pts/0 00:00:00 ps root@PortatilDaniel:/etc/bind# kill -9 8761 4. Configuracin de un servidor DNS para nuestra red local. Supongamos que deseamos dar cobertura a la zona asi1.santac. Adems, nuestras IP's son del tipo 172.23.X.X. Para ello hemos de seguir los siguientes pasos: 4.1. Modificar el fichero /etc/resolv.conf En la mquina que har de servidor DNS pondremos: search asi1.santac nameserver 127.0.0.1 nameserver 80.58.0.33 En los clientes de DNS pondremos: search asi1.santac nameserver <IP del servidor DNS> nameserver 80.58.0.33 4.2. Aadir una zona directa y dos inversas a /etc/bind/named.conf //Aadido por m para configurar asi1.santc zone "0.0.127.in-addr.arpa"{ type master; file "/etc/bind/db.127.0.0"; };

//Aadido por m para configurar asi1.santc zone "asi1.santac" { notify no; type master; file "/etc/bind/asi1.santc"; };

OJO: SIN PUNTO AL FINAL

9 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

//Aadido por m para configurar asi1.santc zone "23.172.in-addr.arpa"{ type master; file "/etc/bind/db.23.172"; }; 4.3. Crear las zona de resolucin directa e inversa. a) Archivo /etc/bind9/db.asi1.santc OJO con los puntos al final de los ; Fichero de zona para asi1.santac. nombres de dominio. ; ; El fichero de zona completo ; $TTL 3D @ IN SOA ns.asi1.santc. hostmaster.asi1.santc. ( 200504251 ; serie, fecha de hoy + serie de hoy 8H ; refresco, segundos 2H ; reintento, segundos 4W ; expira, segundos 1D ) ; mnimo, segundos ; TXT "asi1.santac., sus consutas DNS en ASI1 de Santa Catalina" NS ns ; Direccin Inet del servidor de nombres MX 10 mail.asi1.santac. ; Relay de correo primario MX 20 mail.friend.santac. ; Relay de correo secundario ; localhost A 127.0.0.1 ns A 172.23.240.4 mail A 172.23.250.251

gw

A TXT

172.23.30.1 "El router"

gw-casa TXT sobremesa A TXT

A 172.23.0.1 "El enrutador de mi casa" 172.23.30.2 "El ordenador sobremesa de mis casa" HINFO "AMD XP 1300" "WindowsXP"

portatildaniel A 172.23.240.4 TXT "Ordenador porttil de Daniel" HINFO "Pentium 4 2.4 Ghz" "Knoppix" www CNAME ns

mail
10 de 14.

172.23.250.252

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

MX 10 mail MX 20 mail.friend.bogus. Con esto ya funcionara la zona de bsqueda directa. Mralo: root@PortatilDaniel:~# named root@PortatilDaniel:~# tail -f /var/log/syslog Apr 25 20:39:51 PortatilDaniel named[11417]: zone 0.in-addr.arpa/IN: loaded serial 1 Apr 25 20:39:51 PortatilDaniel named[11417]: zone 127.in-addr.arpa/IN: loaded serial 1 Apr 25 20:39:51 PortatilDaniel named[11417]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1 Apr 25 20:39:51 PortatilDaniel named[11417]: zone 172.23.in-addr.arpa/IN: loading master file /etc/bind/db.172.23: file not found Apr 25 20:39:51 PortatilDaniel named[11417]: zone 255.in-addr.arpa/IN: loaded serial 1 Apr 25 20:39:51 PortatilDaniel named[11417]: zone localhost/IN: loaded serial 1 Apr 25 20:39:51 PortatilDaniel named[11417]: zone asi1.santac/IN: loaded serial 200504251 Apr 25 20:39:51 PortatilDaniel named[11417]: running Apr 25 20:39:51 PortatilDaniel named[11417]: zone 0.0.127.in-addr.arpa/IN: sending notifies (serial 1) Apr 25 20:39:51 PortatilDaniel named[11417]: received notify for zone '0.0.127.in-addr.arpa' oot@PortatilDaniel:~# ping ns.asi1.santac PING ns.asi1.santac (172.23.240.4): 56 data bytes 64 bytes from 172.23.240.4: icmp_seq=0 ttl=64 time=0.0 ms 64 bytes from 172.23.240.4: icmp_seq=1 ttl=64 time=0.0 ms 64 bytes from 172.23.240.4: icmp_seq=2 ttl=64 time=0.0 ms --- ns.asi1.santac ping statistics --3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 0.0/0.0/0.0 ms Equivale a www.asi1.santac. gracias a root@PortatilDaniel:~# ping www PING ns.asi1.santac (172.23.240.4): 56 que tenemos el dominio en resolv.conf data bytes 64 bytes from 172.23.240.4: icmp_seq=0 ttl=64 time=0.0 ms 64 bytes from 172.23.240.4: icmp_seq=1 ttl=64 time=0.0 ms --- ns.asi1.santac ping statistics --2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 0.0/0.0/0.0 ms OJO: Con puntos al final. b) Archivo /etc/bind9/db.127.0.0 $TTL 3D @ IN SOA ns.asi1.santc. hostmaster.asi1.santac. ( 1 ; Serial 8H ; Refresh 2H ; Retry 4W ; Expire 1D) ; Minimum TTL
11 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

1 c) Archivo /etc/bind9/db.23.172 $TTL 3D @ IN SOA

NS PTR

ns.asi1.santac. localhost

OJO: Con puntos al final.

ns.asi1.santac. hostmaster.asi1.santac. ( 199802151 ; Serial, todays date + todays serial 8H ; Refresco 2H ; Reintento 4W ; Expira 1D) ; Minimo TTL ;Esta linea es obligatoria si deseamos que funcione la ;resolucin inversa @ IN NS ns.asi1.santac. ;Los dos bloques punto decimal se ;ponen en orden inverso 1.30 PTR gw.asi1.santac. 4.240 PTR ns.asi1.santac. 251.250 PTR mail.asi1.santac. 2.30 PTR sobremesa.asi1.santac. 252.250 PTR mail.asi1.santac. Tras reiniciar named podemos comprobar que funcionan todas las zonas: root@PortatilDaniel:/etc/bind# dig -x 172.23.250.252 ; <<>> DiG 9.2.4rc5 <<>> -x 172.23.250.252 ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28276 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;252.250.23.172.in-addr.arpa.

IN

PTR

;; ANSWER SECTION: 252.250.23.172.in-addr.arpa. 259200 IN ;; AUTHORITY SECTION: 23.172.in-addr.arpa. ;; ADDITIONAL SECTION: ns.asi1.santac. ;; ;; ;; ;;

PTR

mail.asi1.santac.

259200

IN

NS

ns.asi1.santac.

259200

IN

172.23.240.4

Query time: 2 msec SERVER: 127.0.0.1#53(127.0.0.1) WHEN: Sun May 15 18:30:24 2005 MSG SIZE rcvd: 108

root@PortatilDaniel:/etc/bind# dig gw ; <<>> DiG 9.2.4rc5 <<>> gw.asi1.santac


12 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

;; ;; ;; ;;

global options: printcmd Got answer: ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5995 flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION: ;gw.asi1.santac. ;; ANSWER SECTION: gw.asi1.santac. ;; AUTHORITY SECTION: asi1.santac. ;; ADDITIONAL SECTION: ns.asi1.santac. ;; ;; ;; ;;

IN

259200

IN

172.23.30.1

259200

IN

NS

ns.asi1.santac.

259200

IN

172.23.240.4

Query time: 2 msec SERVER: 127.0.0.1#53(127.0.0.1) WHEN: Sun May 15 18:35:51 2005 MSG SIZE rcvd: 81

5. Cmo montar un subdominio. Supongamos ahora que deseamos montar el subdominio redes.asi1.santac. y que queremos que la resolucin de nombres sea realizada por un servidor de direccin IP 172.23.250.5. En la configuracin de named.conf de ns.asi1.santac. debemos aadir la siguiente zona: //Aadido por m para envviar las peticiones de //un subdominio a su controlador dns zone "redes.asi1.santac" { type slave; file "db.redes"; masters { 172.23.240.5; }; }; En la mquina 172.23.240.5 debemos configurar el servicio DNS, incluyendo la zona redes.asi1.santac. y el fichero db.redes. con el mismo procedimiento que hemos seguidos en el punto 4. Podramos poner varios servidores DNS para esta zona (aadiendo sus IP's en el campo masters), configurando cada uno de ellos como un nuevo DNS. //Aadido por m para envviar las peticiones de //un subdominio a su controlador dns zone "redes.asi1.santac" { type slave; file "db.redes"; masters {
13 de 14.

ASI1.

REDES DE REA LOCAL.


Servidor DNS con BIND 9 en Debian.

IES Santa Catalina. Daniel Abril Ruiz. Abril de 2005.

172.23.240.5; 167.34.45.3; 124.56.23.6; }; };

14 de 14.

You might also like