Servidor DNS y servidor DHCP en RHEL 5 y Centos 5
Fuente: http://www.alcancelibre.org/staticpages/index.php/ejercicio-ddns-dhcp
yum -y install dhcp bind bind-chroot caching-nameserver vim-enhanced
# Intel Corporation 82801G (ICH7 Family) LAN Controller
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:13:D4:B7:9D:70
ONBOOT=yes
PEERDNS=no
# D-Link System Inc DGE-528T Gigabit Ethernet Adapter
DEVICE=eth1
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=5C:D9:98:9A:64:8A
IPADDR=192.168.0.1
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
PEERDNS=no
cd /var/named/chroot/var/named
mkdir dynamics
chmod 770 dynamics/
chown named.named dynamics/
touch /var/named/chroot/var/named/dynamics/red-local.net.zone
touch /var/named/chroot/var/named/dynamics/0.168.192.in-addr.arpa.zone
vim /var/named/chroot/var/named/dynamics/red-local.net.zone
$TTL 86400 @ IN SOA servidor.zapto.org. root.zapto.org. ( 20121226; numero de serie 28800 ; tiempo de refresco 7200 ; tiempo entre reintentos 604800 ; expira si se deja de resolver 86400 ; tiempo total de vida ) @ IN NS servidor.zapto.org. @ IN A 192.168.0.1 servidor IN A 192.168.0.1 ~
touch /var/named/chroot/var/named/dynamics/0.168.192.in-addr.arpa.zone
$TTL 86400 @ IN SOA servidor.zapto.org. root.zapto.org. ( 20121226; numero de serie 28800 ; tiempo de refresco 7200 ; tiempo entre reintentos 604800 ; expira si se deja de resolver 86400 ; tiempo total de vida ) @ IN NS servidor.zapto.org. 1 IN PTR servidor.zapto.org.
chown named:named /var/named/chroot/var/named/dynamics/0.168.192.in-addr.arpa.zone
chown named:named /var/named/chroot/var/named/dynamics/red-local.net.zone
touch /var/named/chroot/etc/named.conf
vim /var/named/chroot/etc/named.conf
// // Sample named.conf BIND DNS server 'named' configuration file // for the Red Hat BIND distribution. acl "red-local" { 127.0.0.0/8; 192.168.0.0/24; }; options { 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-recursion { red-local; }; allow-query { red-local; }; forwarders { 8.8.8.8; 8.8.4.4; }; forward first; }; include "/etc/named.rfc1912.zones"; include "/etc/rndc.key"; zone "red-local.net" { type master; file "/var/named/dynamics/red-local.net.zone"; allow-update { key "rndckey"; }; }; zone "0.168.192.in-addr.arpa" { type master; file "/var/named/dynamics/0.168.192.in-addr.arpa.zone"; allow-update { key "rndckey"; }; };
Generar clave rndckey /usr/sbin/dns-keygen clavesecreta 1488SCpaXu0MZlGW3w4v9WsjJW4JPsUkQG6KyfyqTIeASGLI3OkI2dsmx5Lr Copiar y pegar la clave en /etc/rndc.key key "rndckey" { algorithm hmac-md5; secret "key "rndckey" { algorithm hmac-md5; secret "1488SCpaXu0MZlGW3w4v9WsjJW4JPsUkQG6KyfyqTIeASGLI3OkI2dsmx5Lr"; };service named start
chkconfig named on
vim /etc/resolv.conf
; generated manual dns bind
search servidor.zapto.org
nameserver 127.0.0.1
vim /etc/dhcpd.conf # # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.sample # include "/var/named/chroot/etc/rndc.key"; server-identifier servidor.zapto.org; ddns-update-style interim; ddns-domainname "zapto.org."; ddns-rev-domainname "in-addr.arpa."; ignore client-updates; authoritative; default-lease-time 900; max-lease-time 7200; option domain-name "zapto.org"; option ip-forwarding off; zone localdomain. { primary 127.0.0.1; key rndckey; } zone 0.168.192.in-addr.arpa. { primary 192.168.0.1; key rndckey; } zone red-local.net. { primary 192.168.0.1; key rndckey; } subnet 192.168.0.0 netmask 255.255.255.0 { option routers 192.168.0.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.0.255; option domain-name-servers 192.168.0.1; range 192.168.0.150 192.168.0.199; }
service dhcpd start chkconfig dhcpd on
vim /etc/sysconfig/dhcpd
Linux es genial!