$> hostnamectl set-hostname dns1.dominio.local
$> exit
Comprobar Nombre de host
$> hostnamectl
Configurar la ip del host en /etc/hosts
$> vim /etc/hosts
127.0.0.1 localhost.localdomain localhost
X.X.X.X dns1.dominio.local dns1
Ejecute lo siguiente para instalar Bind en CentOS 7
$> yum -y install bind bind-chroot bind-utils
Copiar los archivos del DNS al entorno chroot
$> cd /var/named
$> for f in named.* data dynamic slaves; do mv $f chroot/var/named/; ln -s /var/named/chroot/var/named/$f /var/named/; done
Crear firma digital del servidor
$> rndc-confgen -a -r /dev/urandom -b 512 -c /etc/rndc.key
$> chown named:named /etc/rndc.key
$> chmod 640 /etc/rndc.key
Copiar la firma digital al entorno chroot
$> cd /etc
$> for f in named.* rndc.key; do mv $f /var/named/chroot/etc/; ln -s /var/named/chroot/etc/$f /etc/; done
Actualizar el archivo de cache con los servidores DNS raíz.
$> wget -N http://www.internic.net/domain/named.root -O /var/named/named.ca
$> chown named:named /var/named/named.ca
$> chmod 640 /var/named/named.ca
Editar el archivo /etc/named.conf:
$> vim /var/named/chroot/etc/named.conf
------------------------------------------------------------------------------------------------------------------------------------------------
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { 127.0.0.1;192.168.2.5;};
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";allow-query { localhost; 192.168.2.0/24; };
forwarders { 8.8.8.8; };
recursion yes;
dnssec-enable no;
dnssec-validation no;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
// Zona raiz por defecto
zone "." IN {
type hint;
file "named.ca";
};
// Zona para nuestro dominio
zone "dominio.local" {
type master;
file "/var/named/chroot/var/named/dominio.local.zone";
allow-update { none; };
};
zone "2.168.192.in-addr.arpa" {
type master;
file "/var/named/chroot/var/named/2.168.192.in-addr.arpa.zone";
allow-update { none; };
};
include "/etc/named.rfc1912.zones";
---------------------------------------------------------------------------------------------------------------------------------------------
Crear y editar los archivos de zona de resolución Directa e Inversa$> cd /var/named/chroot/var/named
$> vim dominio.local.zone
-------------------------------------------------------------------------------------------------------------------------
$TTL 86400 @ IN SOA @ root ( 2017062401 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum dominio.local. IN NS dns1.dominio.local. dns1 IN A 192.168.2.5 mail IN A 192.168.2.5 www IN A 192.168.2.5 dominio.local. IN A 192.168.2.5 dominio.local. IN MX 1 mail.dominio.local. pc1 IN A 192.168.2.11
------------------------------------------------------------------------------------------------------------------------
$> vim 2.168.192.in-addr.arpa.zone
----------------------------------------------------------------------------------------------------
$TTL 86400
@ IN SOA @ root (
2017062501 ; serial
21600 ; refresh after 6 hours
3600 ; retry after 1 hour
604800 ; expire after 1 week
86400 ) ; minimum TTL of 1 day
IN NS dns1.dominio.local.
5 IN PTR dns1.dominio.local.
11 IN PTR pc1.dominio.local.
----------------------------------------------------------------------------------------------------
Configurar DNS de tarjeta de red: $> vim /etc/resolv.conf nameserver IP DE SERVIDOR
Reiniciar los servicios $> systemctl start named $> systemctl enable named $> systemctl status named
Si salen errores en el servicio, verificar los logs $> tail -f /var/log/messages $> less /var/log/messages Nota si sale errores de permisos o selinux ——————————————————————————– $> chgrp -R named /var/named/chroot/var/named $> restorecon -FRvv /var/named/chroot/var/named ——————————————————————————— Reglas del firewall si se desea consultar el DNS desde otro equipo Instalar Firewalls: $> yum -y install firewalld $> systemctl enable firewalld $> systemctl start firewalld $> firewall-cmd --add-service=dns --permanent $> firewall-cmd --reload
Verificar puertos abiertos: $> iptables -S ————————— Verificar el firewall: $> iptables -S | grep 53 ————————— Comprobación del DNS $> dig NS dominio.local $> dig MX dominio.local $> dig -x 192.168.2.5 $> ping pc1
No hay comentarios:
Publicar un comentario