lunes, 6 de febrero de 2012

LINUX: configuración DNS doble vista

Editar el archivo /etc/named.conf
Editar el bloque:
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

Por lo siguiente:
view lan {
        match-clients      { 127.0.0.1; 192.168.100.0/24; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

Se agrega el siguiente bloque
view wan {
        match-clients      { any; };
        match-destinations { any; };
        recursion no;
        include "/etc/named.wan.zones";
};



Asi queda el archivo:
[root@gcepedar ~]# tail -20 /etc/named.conf
view lan {
        match-clients      { 127.0.0.1; 192.168.100.0/24; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

view wan {
        match-clients      { any; };
        match-destinations { any; };
        recursion no;
        include "/etc/named.wan.zones";
};
[root@gcepedar ~]#

Crear el archivo /etc/named.wan.zones con la siguiente info:
[root@gcepedar etc]# vi /etc/named.wan.zones
[root@gcepedar etc]# cat /etc/named.wan.zones
zone "gcepeda.cl" IN {
        type master;
        file "gcepeda.wan.zone";
};
[root@gcepedar etc]#

Crear el archivo gcepeda.wan.zone
[root@gcepedar named]# vi /var/named/gcepeda.wan.zone
[root@gcepedar named]# cat /var/named/gcepeda.wan.zone
@               IN SOA  ns.gcepeda.cl.       root (
                                        2011082301      ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum


                IN NS           ns
                IN MX 0 mail
ns              IN A 200.3.2.14
mail            IN A 200.3.2.14
www             IN A 200.3.2.14


[root@gcepedar named]#

Agregar la ip 200.3.2.14 a la eth0:0
[root@gcepedar named]# ifconfig eth0:0 200.3.2.14
[root@gcepedar named]# ifconfig eth0:0
eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:CC:97:DA
          inet addr:200.3.2.14  Bcast:200.3.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:67 Base address:0x2000


[root@gcepedar named]#

Cambiar el usuario.grupo de los archivos creados para que sean ejecutables por el usuario named:
[root@gcepedar named]# chown named.named /etc/named.wan.zones
[root@gcepedar named]# chown named.named gcepeda.wan.zone

Reiniciar servicio named
[root@gcepedar named]# /etc/init.d/named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]
[root@gcepedar named]#

Verificar en syslog:
[root@gcepedar ~]# tail -f /var/log/messages | grep 2011082301
Aug 23 13:11:08 gcepedar named[4141]: zone gcepeda.cl/IN/wan: loaded serial 2011082301
[root@gcepedar ~]#

Verificar con dig:
Usando la ip LAN
[root@gcepedar named]# 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: 11276
;; 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. 2011082202 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: 6 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Aug 23 13:13:49 2011
;; MSG SIZE  rcvd: 139

Usando la ip WAN
[root@gcepedar named]# dig -t any gcepeda.cl @200.3.2.14


; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> -t any gcepeda.cl @200.3.2.14
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55432
;; flags: qr aa rd; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 2


;; QUESTION SECTION:
;gcepeda.cl.                    IN      ANY


;; ANSWER SECTION:
gcepeda.cl.             86400   IN      SOA     ns.gcepeda.cl. root.gcepeda.cl. 2011082301 10800 900 604800 86400
gcepeda.cl.             86400   IN      NS      ns.gcepeda.cl.
gcepeda.cl.             86400   IN      MX      0 mail.gcepeda.cl.


;; ADDITIONAL SECTION:
ns.gcepeda.cl.          86400   IN      A       200.3.2.14
mail.gcepeda.cl.        86400   IN      A       200.3.2.14


;; Query time: 5 msec
;; SERVER: 200.3.2.14#53(200.3.2.14)
;; WHEN: Tue Aug 23 13:14:14 2011
;; MSG SIZE  rcvd: 139


[root@gcepedar named]#

No hay comentarios:

Publicar un comentario