DNS Server usando MySQL: MyDNS (Parte II)
por adminContinuacion del post DNS Server usando MySQL: MyDNS (Parte I)
Con la columna active , podremos activar o desactivar zonas mas adelante, y la columna xfer será usada por las transferencias de zona (lo cual no será necesario porque usaremos la replicación de bases de datos MySQL para exportar los datos al servidor DNS secundario).
Ahora creamos el archivo de configuración de MyDNS /etc/mydns.conf ejecutando este comando:
cd /tmp/mydns-1.0.0/
make conf
Editamos el archivo /etc/mydns.conf para que parezca como este:
##
## /etc/mydns.conf
## Fri Oct 21 16:36:32 2005
## For more information, see mydns.conf(5).
##
# DATABASE INFORMATION
db-host = localhost # SQL server hostname
db-user = mydns # SQL server username
db-password = mydns_password # SQL server password
database = mydns # MyDNS database name
# GENERAL OPTIONS
user = nobody # Run with the permissions of this user
group = nogroup # Run with the permissions of this group
listen = * # Listen on these addresses ('*' for all)
# CACHE OPTIONS
zone-cache-size = 1024 # Maximum number of elements stored in the zone cache
zone-cache-expire = 60 # Number of seconds after which cached zones expires
reply-cache-size = 1024 # Maximum number of elements stored in the reply cache
reply-cache-expire = 30 # Number of seconds after which cached replies expire
# ESOTERICA
log = LOG_DAEMON # Facility to use for program output (LOG_*/stdout/stderr)
pidfile = /var/run/mydns.pid # Path to PID file
timeout = 120 # Number of seconds after which queries time out
multicpu = 1 # Number of CPUs installed on your system
allow-axfr = no # Should AXFR be enabled?
allow-tcp = yes # Should TCP be enabled?
ignore-minimum = no # Ignore minimum TTL for zone?
soa-table = soa # Name of table containing SOA records
rr-table = rr # Name of table containing RR data
Asegurate de editar correctamente los datos de base de datos, y tambien los detalles de grupo. En Debian, el grupo nobody es nogroup, esto es diferente del valor por defecto en el archivo /etc/mydns.conf (tambien nobody), tambien sera necesario establecer set allow-tcp a yes (si).
ahora creamos en scrip de inicio de MyDNS /etc/init.d/mydns:
#! /bin/sh
# mydns Start the MyDNS server
# Author: Falko Timme
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mydns
DAEMON=/usr/local/sbin/$NAME
DESC="DNS server"
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
$DAEMON --background
echo "."
;;
stop)
echo "Stopping $DESC: $NAME."
kill -9 `pidof $NAME` &> /dev/null
;;
restart)
echo "Restarting $DESC: $NAME."
$0 stop && sleep 1
$0 start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
Lo siguiente será hacer ejecutable el script e iniciar MyDNS:
chmod 755 /etc/init.d/mydns
/etc/init.d/mydns start
Si quieres que MyDNS se inicie automaticamente durante el inicio del sistema, es necesario crear los enlaces de inicio de sistema (system bootup links). En Debian, se hace asi:
update-rc.d mydns defaults 21 22
En Fedora o RedHat:
chkconfig --levels 235 mydns on
Hasta aqui la Parte 2, la parte 3 tratará como instalar un interfaz web de administración como MyDNSConfig.






