Antes de empezar debes saber
Servidor DNS elemental
- Lo que tenemos:
192.168.0.1 192.168.0.2 ____ ____ | | | ! | | | | /====\---------------/====\ yoda kenobi
Dos maquinas en la misma red (192.168.0.0) y en el mismo dominio (star.org) ambas con debian e ip estatica.
- Lo que deseamos:
dns.star.org www.star.org 192.168.0.1 192.168.0.2 ____ ____ | | | ! | | | | /====\---------------/====\ yoda kenobi
Acceder a yoda y a kenobi (desde cualquiera de los dos) usando nombres de dominio en vez de direcciones ip.
- Instalación del servidor dns (yoda)
# apt-get install bind9
- Archivos de configuración de bind (yoda)
/etc/bind/named.conf.options
options { directory "/var/cache/bind"; auth-nxdomain no; # conform to RFC1035 };/etc/bind/named.conf.local
zone "star.org"{ type master; file "/etc/bind/db.star.org"; }; zone "0.168.192.in-addr.arpa"{ type master; file "/etc/bind/db.192.168.0"; };/etc/bind/named.conf
include "/etc/bind/named.conf.options"; zone "." { type hint; file "/etc/bind/db.root"; }; zone "localhost" { type master; file "/etc/bind/db.local"; }; zone "127.in-addr.arpa" { type master; file "/etc/bind/db.127"; }; zone "0.in-addr.arpa" { type master; file "/etc/bind/db.0"; }; zone "255.in-addr.arpa" { type master; file "/etc/bind/db.255"; }; include "/etc/bind/named.conf.local";/etc/bind/db.star.org
@ IN SOA dns.star.org. root.dns.star.org. ( 2005060800 ; serial 3600 ; refresh 900 ; retry 1209600 ; expire 43200 ; default_ttl ) @ IN NS dns.star.org. dns IN A 192.168.0.1 www IN A 192.168.0.2/etc/bind/db.192.168.0
@ IN SOA dns.star.org. root.dns.star.org. ( 1999090900 ; serial 3600 ; refresh 900 ; retry 1209600 ; expire 43200 ; default_ttl ) @ IN NS dns.star.org. 1 IN PTR dns.star.org. 2 IN PTR www.star.org.
- Instalación del servidor web (kenobi)
# apt-get install apache
Comprobar el funcionamiento del dns
- Primero reiniciamos los daemons (servicios) respectivos para estar seguros que todo anda bien.
- En yoda:
# /etc/init.d/networking restart # /etc/init.d/bind9 restart
En kenobi:# /etc/init.d/networking restart # /etc/init.d/apache restart
- En yoda:
- Paquetes requeridos: bind9-host y mozilla-firefox
- Desde cualquier maquina ejecute en el shell: (resultados debajo de cada comando)
$ host dns.star.org dns.star.org has address 192.168.0.1
$ host 192.168.0.1 1.0.168.192.in-addr.arpa domain name pointer dns.star.org.
$ host www.star.org www.star.org has address 192.168.0.2
$ host 192.168.0.2 2.0.168.192.in-addr.arpa domain name pointer www.star.org.
$ firefox www.star.org ### Carga la pag del servidor apache de kenobi ###
Apendices
- Archivos de configuración de red para el servidor dns (yoda):
/etc/network/interfaces
auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0/etc/resolv.conf
search star.org nameserver 192.168.0.1
/etc/host.conf
order bind multi on
- Archivos de configuración de red para el servidor web (kenobi):
/etc/network/interfaces
auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.0.2 netmask 255.255.255.0/etc/resolv.conf
domain digitalfredy.org nameserver 192.168.0.1
/etc/host.conf
order bind multi on
