Advanced usage of Bind
Introduction
Bind is good, but sometimes it becomes a bit complex. Especially when you want to manage DNS servers like providers do. Here are some tips I found to improve the beast.
Force zone updates
Method 1
You may quickly need to update your zones without waiting for Bind to do it itself (see SOA, refresh, etc… for each zone). For this, you must freeze Bind updates on the zones in question:
rndc freeze deimos.fr in internalview
- deimos.fr: the zone
- internalview: the view in which the zone is located
You can remove “in
Oct 2 19:05:42 star1 named[8403]: freezing zone 'deimos.fr/IN' internalview: success
Now, make the changes you want on your zone file.
Once finished, run these commands:
rndc reload deimos.fr in internalview
rndc thaw deimos.fr in internalview
- reload: reload configuration file and zones.
- thaw: Enable updates to a frozen dynamic zone and reload it.
If all goes well, you’ll see something like this in the logs:
Oct 2 19:09:50 star1 named[8403]: zone deimos.fr/IN/internalview: loaded serial 2008100208
Oct 2 19:09:50 star1 named[8403]: zone deimos.fr/IN/internalview: sending notifies (serial 2008100208)
Oct 2 19:09:50 star1 named[8403]: client 192.168.0.27#47874: view internalview: transfer of 'deimos.fr/IN': AXFR-style IXFR started
Oct 2 19:09:50 star1 named[8403]: client 192.168.0.27#47874: view internalview: transfer of 'deimos.fr/IN': AXFR-style IXFR ended
Oct 2 19:09:54 star1 named[8403]: unfreezing zone 'deimos.fr/IN' internalview: success
Method 2
Here is a second method, to do the same thing:
rndc retransfer deimos.fr
Round Robin: Load balancer
First of all, you should know that you can only load balance with A records (except apparently for BIND v4 where you can do it with CNAME). Here’s an example of how to manage a domain configuration:
; Round Robin / Load Balancing
www 60 IN A x.x.x.1
www 60 IN A x.x.x.2
- 60: corresponds to the TTL, and it is very important because it will decide when to switch
- x.x.x.x: IP addresses of servers. Unfortunately, you cannot use DNS names.
You can also choose the type of load balancing among these:
- fixed - records are returned in the order they are defined in the zone file
- random - records are returned in a random order
- cyclic - records are returned in a round-robin fashion
To do this, add this type of lines and adapt according to your needs:
...
rrset-order { order cyclic; };
...
For more information, see the reference sites below.
FAQ
journal rollforward failed: journal out of sync with zone
If you have this error, it’s due to a zone synchronization problem. Look in your logs for the zone(s) causing problems, then delete the sync file:
rm /etc/bind/db.deimos.fr.jnl
All that’s left is to reload or restart your bind and the sync will restart correctly.
Resources
Last updated 07 May 2013, 11:33 CEST.