viernes, 24 de mayo de 2013

instalar DNS

1º Instalación de bind9 en Ubuntu Server 12.10
sudo aptitude install bind9
instalado correctamente ----- OK
2º Entro en el diretorio /etc/bind/
Indicar que lo hago como superusuario root
cd /etc/bind
una vez dentro del directorio . Edito el fichero NAMED.CONF.LOCAL
/etc/bind# gedit named.conf.local
Pego:
//
// Do any local configuration here
//
// Consider adding The 1918 zone here, if they are not used in your
// organization
//iclude "/etc/bind/zones.rfc1918";
zone "seas-linux.es" {
type master;
file "/etc/bind/db.seas-linux.es";
};
Es importante el “file”, ya que hace referencia al fichero de configuración que importamos.
Guardo.
3º Ahora creo el fichero de configuración a partir de uno ya creado (db.local) poniendo:
/etc/bind# cp db.local db. seas-linux.es
4º Ahora editamos dicho fichero
/etc/bind# gedit /etc/bind/ db.seas-linux.es
Pego:
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA seas-linux.es. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS seas-linux.es.
@ IN A 192.168.1.4
Guardo.
5º Ahora reiniciamos el proceso bind con el siguiente comando
sudo /etc/init.d/bind9 restart
resultado:
stopping domain name service....bind9
waiting for pid 1828 to die …... OK
Starting domain name service....bind9 Ok
6º Ahora editamos el fichero de configuración resolv.cof para que el ordenador utilice este servidor DNS que he configurado:
sudo gedit /etc/resolv.conf
nameserver 127.0.0.1 – sólo dejo esta línea
Si este es el servidor, deberemos hacer lo mismo con el resto de ordenadores de la red local pero en lugar de poner 127.0.0.1 tendremos que poner la IP privada del Servidor esta es la – Mia 192.168.1.4 --- Vuestra xxx.xxx.xxx
Hecho esto ya tengo todo listo para empezar la bateria de pruebas y comprobar que lo hemos hecho todo bien.
7º Pruebas realizadas.
root@seas; # host seas-linux.es
resultado:
seas-linux.es has address 192.168.1.4
8º Ahora vamos a configurar el servidor DNS para que resuelva dominios a la inversa, poniendo la
dirección IP y que nos diga a que dominio pertenece dicha dirección IP.
Editamos el fichero:
/etc/bind# gedit /etc/bind/named.conf.local
zone "192.in-addr.arpa" {
type master;
file "/etc/bind/db.192";
};
Guardo.
9º Copiamos el archivo de configuración por defecto para editarlo. A partir del archivo db.127
creamos el db.192
/etc/bind# cp db.127 db.192
Una vez creado este fichero lo editamos lo editamos con la siguiente información cambiando el localhost y la última línea.
/etc/bind# gedit db.192
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA seas-linux.es. root.seas-linux.es. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS seas-linux.es.
168.1.4 IN PTR seas-linux.es.
Guardamos..
10º Hecho estos pasos, reiniciamos de nuevo nuestro proceso bind9
/etc/bind# sudo /etc/init.d/bind9 restart
stopping domain name service....bind9
waiting for pid 1828 to die …... OK
Starting domain name service....bind9 Ok
11º Hacemos varias pruebas y comprobamos que todo funciona correctamente.
a) root@seas:/root# host seas-linux.es
resutado:
seas-linux.es has address 192.168.1.4
* root@seas:~# host 127.0.0.1
resultado:
1.0.0.127.in-addr.arpa domain name pointer localhost.
* root@seas:~# host www.telefonica.net
resultado
www.telefonica.net has address 213.4.130.95
b) root@seas:/root# nslookup
> seas-linux.es
resultado:
> seas-linux.es
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: seas-linux.es
Address: 192.168.1.4
c) root@seas:/root# ping seas-linux.es
resultado:
PING seas-linux.es (192.168.1.4) 56(84) bytes of data.
64 bytes from 192.168.1.4: icmp_req=1 ttl=64 time=0.038 ms
64 bytes from 192.168.1.4: icmp_req=2 ttl=64 time=0.043 ms
64 bytes from 192.168.1.4: icmp_req=3 ttl=64 time=0.044 ms
64 bytes from 192.168.1.4: icmp_req=4 ttl=64 time=0.042 ms
64 bytes from 192.168.1.4: icmp_req=5 ttl=64 time=0.045 ms
64 bytes from 192.168.1.4: icmp_req=6 ttl=64 time=0.044 ms
64 bytes from 192.168.1.4: icmp_req=7 ttl=64 time=0.044 ms
64 bytes from 192.168.1.4: icmp_req=8 ttl=64 time=0.047 ms
64 bytes from 192.168.1.4: icmp_req=9 ttl=64 time=0.048 ms
--- seas-linux.es ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 8001ms
rtt min/avg/max/mdev = 0.038/0.043/0.048/0.009
d) root@seas:/root# ping www.google.es
resultado:
PING www.google.es (173.194.34.248) 56(84) bytes of data.
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=1 ttl=56 time=75.3 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=2 ttl=56 time=76.2 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=3 ttl=56 time=76.8 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=4 ttl=56 time=76.5 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=5 ttl=56 time=77.1 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=6 ttl=56 time=76.5 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=7 ttl=56 time=76.6 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=8 ttl=56 time=77.0 ms
64 bytes from mad01s09-in-f24.1e100.net (173.194.34.248): icmp_req=9 ttl=56 time=76.8 ms
e) root@seas:~# nslookup
> www.google.es
resultado:
> www.google.es
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: www.google.es
Address: 173.194.34.216
Name: www.google.es
Address: 173.194.34.223
Name: www.google.es
Address: 173.194.34.215
d) root@seas:/root# host www.google.es
resultado:
www.google.es has address 173.194.34.248
www.google.es has address 173.194.34.247
www.google.es has IPv6 address 2a00:1450:4003:803::1018
f) oot@seas:/root# dig seas-linux.es
resultado:
; <<>> DiG 9.8.1-P1 <<>> seas-linux.es
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49140
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;seas-linux.es. IN A
;; ANSWER SECTION:
seas-linux.es. 604800 IN A 192.168.1.4
;; AUTHORITY SECTION:
seas-linux.es. 604800 IN NS seas-linux.es.
;; Query time: 4 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Feb 22 14:14:47 2013
;; MSG SIZE rcvd: 61
g) root@seas:/root# dig -x192.168.1.4
resultado:
; <<>> DiG 9.8.1-P1 <<>> -x192.168.1.4
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 57289
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;4.1.168.192.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
192.in-addr.arpa. 604800 IN SOA seas-linux.es. root.seas-linux.es. 1 604800 86400 2419200 604800
;; Query time: 3 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Feb 22 14:17:12 2013
;; MSG SIZE rcvd: 96
h) oot@seas:/root# dig www.google.es
resultado:
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21068
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 13, ADDITIONAL: 0
;; QUESTION SECTION:
;www.google.es. IN A
;; ANSWER SECTION:
www.google.es. 163 IN A 173.194.34.216
www.google.es. 163 IN A 173.194.34.223
www.google.es. 163 IN A 173.194.34.215
;; AUTHORITY SECTION:
. 517979 IN NS h.root-servers.net.
. 517979 IN NS k.root-servers.net.
. 517979 IN NS a.root-servers.net.
. 517979 IN NS b.root-servers.net.
. 517979 IN NS i.root-servers.net.
. 517979 IN NS m.root-servers.net.
. 517979 IN NS g.root-servers.net.
. 517979 IN NS e.root-servers.net.
. 517979 IN NS f.root-servers.net.
. 517979 IN NS l.root-servers.net.
. 517979 IN NS c.root-servers.net.
. 517979 IN NS j.root-servers.net.
. 517979 IN NS d.root-servers.net.
;; Query time: 90 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Feb 22 14:19:01 2013
;; MSG SIZE rcvd: 290
i) oot@seas:/root# dig -x212.106.221.24
resultado:
; <<>> DiG 9.8.1-P1 <<>> -x212.106.221.24
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38001
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 6, ADDITIONAL: 0
;; QUESTION SECTION:
;24.221.106.212.in-addr.arpa. IN PTR
;; ANSWER SECTION:
24.221.106.212.in-addr.arpa. 23344 IN PTR 24.221.106.212.dynamic.jazztel.es.
;; AUTHORITY SECTION:
212.in-addr.arpa. 172800 IN NS pri.authdns.ripe.net.
212.in-addr.arpa. 172800 IN NS sec1.apnic.net.
212.in-addr.arpa. 172800 IN NS tinnie.arin.net.
212.in-addr.arpa. 172800 IN NS sns-pb.isc.org.
212.in-addr.arpa. 172800 IN NS sec3.apnic.net.
212.in-addr.arpa. 172800 IN NS ns3.nic.fr.
;; Query time: 3572 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Feb 22 14:20:49 2013
;; MSG SIZE rcvd: 248

No hay comentarios:

Publicar un comentario