| Article Index |
|---|
| Failover Dynamic DNS (BIND and DHCP) |
| Setup the master DNS |
| Setup the DHCP slave |
| Setup DNS slave |
| All Pages |
If a machine uses a dynamic ip-address retrieved from a DHCP server the ip-address will not resolve to it's domainname. Usually we setup DNS with static ip-addresses. However we can setup a dynamic DNS server with DHCP so every machine which retrieves its ip-address from the DHCP server will be registered or updated in the DNS. In this tutorial I will setup a failover. We need to install some packages if they are not allready installed:
yum install ntp dhcp bind bind-chroot bind-libs bind-utils
Let's asume the domainname is mydomain.com, the network is 192.168.1/0/24, Gateway 192.168.1.254, the DHCP servers and DNS servers are 192.168.1.2 and 192.168.1.4.
For a failover DHCP setup both servers should have the time in sync. Therefore we create a simple cron-job on both servers to sync the time every day with a time-server. Create the file /etc/cron.daily/timesync and add the lines
#!/bin/bashOn the master server (192.168.1.2) edit
/usr/sbin/ntpdate ntp.xs4all.nl
/etc/dhcpd.conf
authoritative;
option domain-name "mydomain.com";
option domain-name-servers 192.168.1.2,192.168.1.4;
option netbios-name-servers 192.168.1.2;
ddns-update-style interim;
ddns-updates on;
ddns-domainname "mydomain.com";
key rndckey {
algorithm hmac-md5;
secret "your key from /etc/rndc.key";
}
zone mydomain.com
{
primary 127.0.0.1;
key rndckey;
}
zone 1.168.192.in-addr.arpa
{
primary 127.0.0.1;
key rndckey;
}
failover peer "failover" {
primary;
address 192.168.1.2;
port 647;
peer address 192.168.1.4;
peer port 647;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
split 128;
load balance max seconds 3;
}
subnet 192.168.1.0 netmask 255.255.255.0
{
pool {
failover peer "failover";
range 192.168.1.20 192.168.1.60;
option dhcp-server-identifier 192.168.1.2;
option domain-name-servers 192.168.1.2;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
default-lease-time 43200;
max-lease-time 43200;
option domain-name "mydomain.com";
option routers 192.168.1.254;
deny dynamic bootp clients;
}
allow unknown-clients;
ignore client-updates;
}
