Instalando e configurando um servidor DNS (Bind)
Nesse artigo vou explicar passo-a-passo como instalar e configurar um servidor DNS no Slackware. O objetivo do texto é acabar com o mito de que instalar um servidor DNS é tarefa complicada. Sendo assim, mãos à obra!
Parte 4: Iniciando o BIND
Caso você não tenha o arquivo /etc/rc.d/rc.bind crie-o com o seguinte conteúdo:
#!/bin/sh
# Start/stop/restart the BIND name server daemon (named).
# Start bind. In the past it was more secure to run BIND
# as a non-root user (for example, with '-u daemon'), but
# the modern version of BIND knows how uses to use the
# kernel's capability mechanism to drop all root privileges
# except the ability to bind() to a privileged port and set
# process resource limits, so -u should not be needed. If
# you wish to use it anyway, chown the /var/run/named
# directory to the non-root user.
#
# You might also consider running BIND in a "chroot jail",
# a discussion of which may be found in
# /usr/doc/Linux-HOWTOs/Chroot-BIND-HOWTO.
bind_start() {
if [ -x /usr/sbin/named ]; then
echo "Starting BIND: /usr/sbin/named"
/usr/sbin/named
fi
}
# Stop bind:
bind_stop() {
killall named
}
# Restart bind:
bind_restart() {
bind_stop
sleep 1
bind_start
}
case "$1" in
'start')
bind_start
;;
'stop')
bind_stop
;;
'restart')
;;
*)
echo "usage $0 start|stop|restart"
esac
# Start/stop/restart the BIND name server daemon (named).
# Start bind. In the past it was more secure to run BIND
# as a non-root user (for example, with '-u daemon'), but
# the modern version of BIND knows how uses to use the
# kernel's capability mechanism to drop all root privileges
# except the ability to bind() to a privileged port and set
# process resource limits, so -u should not be needed. If
# you wish to use it anyway, chown the /var/run/named
# directory to the non-root user.
#
# You might also consider running BIND in a "chroot jail",
# a discussion of which may be found in
# /usr/doc/Linux-HOWTOs/Chroot-BIND-HOWTO.
bind_start() {
if [ -x /usr/sbin/named ]; then
echo "Starting BIND: /usr/sbin/named"
/usr/sbin/named
fi
}
# Stop bind:
bind_stop() {
killall named
}
# Restart bind:
bind_restart() {
bind_stop
sleep 1
bind_start
}
case "$1" in
'start')
bind_start
;;
'stop')
bind_stop
;;
'restart')
;;
*)
echo "usage $0 start|stop|restart"
esac
Depois de salvo o arquivo com o conteúdo acima e dê permissão ao arquivo:
# chmod +x /etc/rc.d/rc.bind
Para iniciar o BIND basta digitar o seguinte comando:
# /etc/rc.d/rc.bind start
Obrigado.