Verificar si el servicio esta activo
[root@gcepedar ~]# /etc/init.d/named status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped
Activar servicio named para que parta siempre
[root@gcepedar ~]# chkconfig named on
Reiniciar servicio named
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
Verificar el DNS en la maquina.
[root@gcepedar ~]# dig -t any google.cl @127.0.0.1
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> -t any google.cl @127.0.0.1
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64797
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 4, ADDITIONAL: 2
;; QUESTION SECTION:
;google.cl. IN ANY
;; ANSWER SECTION:
google.cl. 86400 IN SOA ns1.google.com. dns-admin.google.com. 1460057 21600 3600 1209600 300
google.cl. 10800 IN MX 10 google.com.s9b1.psmtp.com.
google.cl. 10800 IN MX 10 google.com.s9b2.psmtp.com.
google.cl. 10800 IN MX 10 google.com.s9a1.psmtp.com.
google.cl. 10800 IN MX 10 google.com.s9a2.psmtp.com.
google.cl. 300 IN TXT "v=spf1 -all"
google.cl. 300 IN A 74.125.67.103
google.cl. 300 IN A 74.125.67.104
google.cl. 300 IN A 74.125.67.105
google.cl. 300 IN A 74.125.67.106
google.cl. 300 IN A 74.125.67.147
google.cl. 300 IN A 74.125.67.99
google.cl. 345600 IN NS ns1.google.com.
google.cl. 345600 IN NS ns2.google.com.
google.cl. 345600 IN NS ns3.google.com.
google.cl. 345600 IN NS ns4.google.com.
;; AUTHORITY SECTION:
google.cl. 345600 IN NS ns4.google.com.
google.cl. 345600 IN NS ns1.google.com.
google.cl. 345600 IN NS ns2.google.com.
google.cl. 345600 IN NS ns3.google.com.
;; ADDITIONAL SECTION:
ns1.google.com. 345600 IN A 216.239.32.10
ns2.google.com. 345600 IN A 216.239.34.10
;; Query time: 988 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Aug 22 12:16:57 2011
;; MSG SIZE rcvd: 497
[root@gcepedar ~]#
Configurar el DNS MASTER agregando el dominio "gcepeda.cl"
1. Editar el archivo: /etc/named.rfc1912.zones
Agregar al final del archivo
zone "gcepeda.cl" IN {
type master;
file "gcepeda.zone";
allow-update { none; };
};
Ejemplo:
[root@gcepedar ~]# tail /etc/named.rfc1912.zones
file "named.zero";
allow-update { none; };
};
zone "gcepeda.cl" IN {
type master;
file "gcepeda.zone";
allow-update { none; };
};
[root@gcepedar ~]#
2. Editar el archivo de zona
[root@gcepedar ~]# vi /var/named/gcepeda.zone
[root@gcepedar ~]# cat /var/named/gcepeda.zone
$TTL 30
@ IN SOA ns.gcepeda.cl. root (
2011082201 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS ns
IN MX 0 mail
ns IN A 192.168.100.170
mail IN A 192.168.100.170
www IN A 192.168.100.170
[root@gcepedar ~]#
Cuando se le pone "$TTL 30" significa que el archivo de master se revisa cada 30 segundos.
Para verificar:
Reiniciar el servicio named:
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@gcepedar ~]#
Verificar en el syslog que se haya recargado el serial que esta en el archivo gcepeda.zone: 2011082201
[root@gcepedar ~]# tail -20 /var/log/messages | grep "zone gcepeda.cl"
Aug 22 12:48:00 gcepedar named[4061]: zone gcepeda.cl/IN/localhost_resolver: loaded serial 2011082201
[root@gcepedar ~]#
SOA: start of autority
Verificar usando dig
[root@gcepedar ~]# dig -t any gcepeda.cl @127.0.0.1
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> -t any gcepeda.cl @127.0.0.1
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4576
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 2
;; QUESTION SECTION:
;gcepeda.cl. IN ANY
;; ANSWER SECTION:
gcepeda.cl. 30 IN SOA ns.gcepeda.cl. root.gcepeda.cl. 2011082201 10800 900 604800 86400
gcepeda.cl. 30 IN NS ns.gcepeda.cl.
gcepeda.cl. 30 IN MX 0 mail.gcepeda.cl.
;; ADDITIONAL SECTION:
ns.gcepeda.cl. 30 IN A 192.168.100.170
mail.gcepeda.cl. 30 IN A 192.168.100.170
;; Query time: 5 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Aug 22 12:48:12 2011
;; MSG SIZE rcvd: 139
[root@gcepedar ~]#
Configurar ROUND-ROBIN
AL final del archivo, donde esta el bloque www, hay que repetir segun las ips que se asignen
[root@gcepedar ~]# tail /var/named/gcepeda.zone
1W ; expiry
1D ) ; minimum
IN NS ns
IN MX 0 mail
ns IN A 192.168.100.170
mail IN A 192.168.100.170
www IN A 192.168.100.170
www IN A 192.168.100.171
www IN A 192.168.100.172
[root@gcepedar ~]#
Reiniciar el servicio named
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@gcepedar ~]#
Comprobar los dns agregados:
[root@gcepedar ~]# watch -n0 -d host www.gcepeda.cl 127.0.0.1
[root@gcepedar ~]# host www.gcepeda.cl 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:
www.gcepeda.cl has address 192.168.100.171
www.gcepeda.cl has address 192.168.100.172
www.gcepeda.cl has address 192.168.100.170
[root@gcepedar ~]#
Con la plantilla se renombra a named.conf y se reinicia el servicio named
Si se reinstala el paquete o se reinicia el servicio, la configuracion es tomada desde named.conf.
[root@gcepedar ~]# mv /etc/named.caching-nameserver.conf /etc/named.conf
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@gcepedar ~]#
Configuracion de una ip slave para el dominio de mi maquina
Editar el archivo /etc/named.rfc1912.zones
Se agrega la linea "allow-transfer { 192.168.100.142; };"
Donde la ip 192.168.100.142 es el backup
zone "gcepeda.cl" IN {
type master;
file "gcepeda.zone";
allow-transfer { 192.168.100.142; };
};
Configuracion de un dominio Backup o secundario.
Editar el archivo /etc/named.rfc1912.zones
Se agrega el siguiente bloque, donde la ip 192.168.100.142 es master y el dominio es mostr0.cl
zone "mostr0.cl" IN {
type slave;
file "mostr0.cl.zone";
masters { 192.168.100.142; };
};
Reiniciar servicio named
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@gcepedar ~]#
Autorizar al directorio /var/named para que se escriba el archivo.
[root@gcepedar ~]# chmod 770 /var/named/
Reiniciar named
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
El archvivo mostr0.cl.zone ya esta en /var/named
[root@gcepedar ~]# l /var/named/mostr0.cl.zone
-rw-r--r-- 1 named named 425 Aug 22 14:11 /var/named/mostr0.cl.zone
Contenido del archivo mostr0.cl.zone
[root@gcepedar ~]# cat /var/named/mostr0.cl.zone
$ORIGIN .
$TTL 300 ; 5 minutes
mostr0.cl IN SOA ns.mostr0.cl. root.mostr0.cl. (
2011082203 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS ns.mostr0.cl.
MX 0 mail.mostr0.cl.
$ORIGIN mostr0.cl.
mail A 192.168.100.142
ns A 192.168.100.142
www A 192.168.100.142
A 192.168.100.143
A 192.168.100.144
[root@gcepedar ~]#
Para comprobar:
Detener el servicio named e intentar con la ip slave
[root@gcepedar ~]# /etc/init.d/named stop
Stopping named: [ OK ]
Ver el dominio master "gcepeda.cl" desde la ip backup
[root@gcepedar ~]# watch -n0 -d host www.gcepeda.cl 192.168.100.142
Using domain server:
Name: 192.168.100.142
Address: 192.168.100.142#53
Aliases:
www.gcepeda.cl has address 192.168.100.171
www.gcepeda.cl has address 192.168.100.172
www.gcepeda.cl has address 192.168.100.170
[root@gcepedar ~]#
Habilitar el servicio named
[root@gcepedar ~]# /etc/init.d/named start
Starting named: [ OK ]
Ver el dominio secundario "mostr0.cl"
[root@gcepedar ~]# watch -n0 -d host www.mostr0.cl 127.0.0.1
Using domain server:
Name: 127.0.0.1
Address: 127.0.0.1#53
Aliases:
www.mostr0.cl has address 192.168.100.144
www.mostr0.cl has address 192.168.100.142
www.mostr0.cl has address 192.168.100.143
[root@gcepedar ~]#
No hay comentarios:
Publicar un comentario