BIND: Domain Name Server
Sep 24, 07 by Juan Lebrijo about blog, DNS
Domain Name System, is the service which we due the prety domain names in the actual internet, instead of the uglies IP numbers. Bind is the software more used too implement this service, and we sil show how We intall it in a Debian Etch distro.Our initial conditions:
  • Fixed IP provided by the ISP (ej. 85.48.162.99). In Spain, in the post date I recomend Orange as the ISP whith the Fixed IP Service cheapest (2 €/mes).
  • Domain name (ej. lebrijo.com) brought to a Register Company. I recomend http://www.domiteca.com, in this post date they give me a very efficient service, but they are not the cheapest in Spain.
To study in Depth: Origin http://www.isc.org/index.pl?/sw/bind/ Repository http://www.isc.org/index.pl?/sw/bind/ Package apt 9.3.4 Documentation (Spanich) http://bulma.net/body.phtml?nIdNoticia=1334 Documentation (English) admin. Guide: http://www.isc.org/index.pl?/sw/bind/ http://www.isc.org/index.pl?/sw/bind/ http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ network-dns.html Files Configuration: /etc/bind/named.conf.options Zones Config: /etc/bind/named.conf Local Config: /etc/bind/named.conf.local Manage daemon: /etc/init.d/bind9 Ports 53 TCP/UDP

Previous actions

If we are going to mount a serve rin that direction, we have to ask the register to meke a zone delegation (lebrijo.com) into our fixed IP (85.48.162.99). Then everybody who ask for something.lebrijo.com comes to our server to ask; or, at least, all the super-servers take the information from our sone file in our server, and they reply good to de question ¿Where is something.lebrijo.com?. The register must know where is managing the zone zona lebrijo.com. We write our DNS.
domiteca.PNG 104 KB
We can see four names refered to the same machine, The perfect action is having primary and secondary servers, they can fall down....., but we have a poor budget, and we have an alone server. The second action is opening our firewall, and/or NATing our router to deflect the petitions to the port 85.48.162.99:53 to our server with private IP 192.168.1.23:53.

Instalation

Installing, quickly on Debian
elite:~# apt-get install bind9
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
dnsutils ya está en su versión más reciente.
Paquetes sugeridos:
  bind9-doc
Se instalarán los siguientes paquetes NUEVOS:
  bind9
0 actualizados, 1 se instalarán, 0 para eliminar y 6 no actualizados.
Necesito descargar 441kB de archivos.
Se utilizarán 901kB de espacio de disco adicional después de desempaquetar.
Add your zones to the file /etc/bind/named.conf
zone "lebrijo.com" {
      type master;
      file "/etc/bind/db.lebrijo.com";
};

zone "0.168.192.in-addr.arpa" {
 type master;
 file "/etc/bind/db.192.168.0";
};
Create a file to direct zone db.lebrijo.com:
;
; BIND data file for zone lebrijo.com
;

$TTL 3600        ; 1 hour
@    IN      SOA      ns1.lebrijo.com. root.lebrijo.com. (
                                2007083001      ; Serial
                                10800           ; Refresh
                                3600            ; Retry
                                604800          ; Expire
                                86400           ; Minimum TTL
                        )
; Servidores DNS
                IN      NS      ns1.lebrijo.com.
                IN      NS      ns2.lebrijo.com.
                IN      NS      ns3.lebrijo.com.
                IN      NS      ns4.lebrijo.com.

; Servidores de correo
                IN      MX      0	correo.lebrijo.com.
                IN      A       85.48.162.99

; Nombres de Máquina
localhost       IN      A       127.0.0.1
ns1             IN      A       85.48.162.99
ns2             IN      A       85.48.162.99
ns3             IN      A       85.48.162.99
ns4             IN      A       85.48.162.99
correo          IN      A       85.48.162.99
ntp             IN      A       85.48.162.99

; Webs servidas
www             IN      A       85.48.162.99
blog            IN      A       85.48.162.99
curriculum      IN      CNAME   www
We can see various things:
  • Four DNS servers to the same machine.
  • MX is the tag for email servers. We must put any relay, but we are poor.
  • We must redirect to our own IP. All machines and services.
  • At least we put our published webs.

Operation

The server (or every one acts as client) we must add the first line on /etc/resolv.conf:
nameserver 85.48.162.99
To restart services:
/etc/init.d/bind9 restart
/etc/init.d/networking restart
When you want to push the zones on the root servers, because you are adding regiters or changing configurations:
  • Change the Serial tag in zone file (db.lebrijo.com), this is the fiel which the root server use to know the last version. The number is (in convention) date an version, but it can be an incremental number.
2007083001      ; Serial
  • And you meke a reload to charge the new zones.
  • /etc/init.d/bind9 reload
    NTP: Time Service in our network
    Sep 21, 07 by Juan Lebrijo about blog, NTP
    Network Time Protocol, is a protocol to synchronize the time clocks of every operating system over TCP(UDP)/IP. Here I am going to explain shortly how it is installed in a server and clients, over Debian Etch operating system. installation:
    elite:~# apt-get install ntp ntpdate ntp-server ntp-simple
    Leyendo lista de paquetes... Hecho
    Creando árbol de dependencias... Hecho
    Paquetes sugeridos:
      ntp-doc
    Se instalarán los siguientes paquetes NUEVOS:
      ntp ntp-server ntp-simple ntpdate
    0 actualizados, 4 se instalarán, 0 para eliminar y 3 no actualizados.
    Necesito descargar 449kB de archivos.
    Se utilizarán 1098kB de espacio de disco adicional después de desempaquetar.
    Let modyfy following aspects in config file, /etc/ntp.conf:
    • Uncomment the line: logfile /var/log/ntpd. If we want to log the service.
    • Add root our root server. It is optional, the pool configured is totally operative:
    server chronos.bulma.net
    server es.pool.ntp.org
    server ntp.obspm.fr
    server ntp.cs.strath.ac.uk
    server europe.pool.ntp.org
    server pool.ntp.org
    We can manage the NTP daemon with the script: /etc/init.d/ntp restart I want to warn you in follow three points, when you first getting up the service:
    • It takes log time to sinchronize (~30min in my server), during this time not runs.
    • If we want the service as server, it do not serve the time until its synchrnization.
    • Maybe we must open our firewall in 123 TCP/UDP port. Or making NAT in output server, it depends on our network configuration.
    We can test it with the following tools:
    • ntpq –pn: Show what servers it synchronioze with.
    • ntptrace –n: Show which serves the time to our server, our server stratum etc.
    • tail -f /var/log/ntpd: NTP log.
    Evaluating the service in a client, with Windows XP Service Pack 2, we could doit in "Time and date properties", her we can set our favorite server:
    ntp.PNG 5.74 KB
    If you want to study in depth about NTP, you can learn more in the links on the table: Origin http://www.ntp.org/ Repository http://www.ntp.org/downloads.html Package apt - 4.2.0a Documentation (Spanish) http://weblog.benetjoandarder.cat/descarregues/NTPv1.0.pdf http://bulma.net/body.phtml?nIdNoticia=1947 http://bulma.net/impresión.phtml?nIdNoticia=1778 Documentation (English) http://www.ntp.org/documentation.html Files Configuration: /etc/ntp.conf Daemon: /etc/init.d/ntp-server Log: /var/log/ntpd Port 123 TCP/UDP
    NTP: Servicio de reloj
    Sep 21, 07 by Juan Lebrijo about blog, Services, NTP
    Network Time Protocol, es un protocolo que sirve para sincronizar relojes de los sistemas operativos sobre TCP(UDP)/IP. Este artículo trata de explicar muy brevemente como se instala y se utiliza servidor y cliente sobre un Debian Etch. Instalación:
    elite:~# apt-get install ntp ntpdate ntp-server ntp-simple
    Leyendo lista de paquetes... Hecho
    Creando árbol de dependencias... Hecho
    Paquetes sugeridos:
      ntp-doc
    Se instalarán los siguientes paquetes NUEVOS:
      ntp ntp-server ntp-simple ntpdate
    0 actualizados, 4 se instalarán, 0 para eliminar y 3 no actualizados.
    Necesito descargar 449kB de archivos.
    Se utilizarán 1098kB de espacio de disco adicional después de desempaquetar.
    En el fichero de configuración /etc/ntp.conf, cambiamos:
    • Descomentamos la línea: logfile /var/log/ntpd. Si deseamos apuntar las consultas que se hacen a nuestro servidor, sincronizaciones con otros, etc.
    • Añadimos los servidores padre, esto es opcional, por que con los pool que vienen configurados, ya sincroniza bien:
    server chronos.bulma.net
    server es.pool.ntp.org
    server ntp.obspm.fr
    server ntp.cs.strath.ac.uk
    server europe.pool.ntp.org
    server pool.ntp.org
    Para conrtolar el demonio del servidor tenemos el script: /etc/init.d/ntp restart AL probar ya el funcionamiento del servidor quiero daros algunos avisos:
    • Tarda un buen rato en sincronizarse (~30min), hasta entonces sigue como si no funcionara
    • Si lo abrimos como servidor (quitando las restricciones) no servirá la hora hasta que no se sincronice con otros.
    • Es posible que haya que abrir el firewall: Puerto 123 TCP/UDP. Ó hacer NAT en el router de salida, depende de como sea vuestro sistema.
    Para hacer comprobaciones tenemos las herramientas:
    • ntpq –pn: Muestra con que servidores esta calculando la sincronización.
    • ntptrace –n: Muestra los servidores origen de nuestra hora, el stratum en el que estamos etc.
    • tail -f /var/log/ntpd: Monitorizamos el log de ntp.
    Podemos evaluar el servidor con cualquier cliente, por ejemplo en el XP con Service Pack 2 (mínimo), tenemos en las propiedades de la hora la posibilidad de sincronizar con un servidor:
    ntp.PNG 5.74 KB
    Si quereis profundizar más en el tema os remito a los enlaces de la ficha: Origen http://www.ntp.org/ Repositorio http://www.ntp.org/downloads.html Paquete apt - 4.2.0a Documentación (Castellano) http://weblog.benetjoandarder.cat/descarregues/NTPv1.0.pdf http://bulma.net/body.phtml?nIdNoticia=1947 http://bulma.net/impresión.phtml?nIdNoticia=1778 Documentación (Inglés) http://www.ntp.org/documentation.html Ficheros Configuración: /etc/ntp.conf Control demonio: /etc/init.d/ntp-server Log: /var/log/ntpd Puertos 123 TCP/UDP