Slave Server
A slave DNS server is similar to a master DNS server. It can help with load balancing and provide redundancy should the master DNS server fail. Because it serves as a “secondary” DNS server, it actually pulls the necessary files from its master counterpart, making configuration of a slave DNS server quite easy. Because the slave server pulls all the DNS records from the master, you need to set up the slave DNS server on RHEL02.
NOTE: On RHEL02, you need to install the BIND packages, make a backup of the /etc/named.conf file, and copy the following template.
When you have RHEL02 set up, you can use the following template for your /etc/named.conf file:
/* Global options for the BIND Server */
options
{
directory “/var/named”; // the default
dump-file “data/cache_dump.db”;
statistics-file “data/named_stats.txt”;
memstatistics-file “data/named_mem_stats.txt”;
};
/* Logging options so you know where your logs are going */
logging
{
channel default_debug {
file “data/named.run”;
severity dynamic;
};
};
/* Our sample domain is example.com defined here */
zone “example.com” {
type slave;
file “slaves/example.com.zone”;
masters { 172.168.1.1; };
};
/* This is a reverse lookup for our subnet 172.168.1.0/24 */
zone “1.168.172.in-addr.arpa” {
type slave;
file “slaves/example.com.revzone”;
masters { 172.168.1.1; };
};
/* File containing root hints (points directly to root DNS servers) */
zone “.” IN {
type hint;
file “named.root”;
};
/* The zone file for our localhost (good for troubleshooting) */
zone “localhost.” IN {
type master;
file “localhost.zone”;
allow-update { none; };
};
/* The reverse lookup zone for our localhost (again good for troubleshooting) */
zone “0.0.127.in-addr.arpa.” IN {
type master;
file “named.local”;
allow-update { none; };
};
Because the slave server can provide redundancy or load balancing, its /etc/named.conf is similar to that of the master DNS server. The difference here, though, is that the slave server doesn’t actually need the zone files to exist. You can see here that you define a masters option, which is actually the master DNS server. The slave DNS server will periodically check with the master DNS server, pull down the data for a zone, and create the zone file if it doesn’t exist. The slave zone files exist in the /var/named/slaves directory.
NOTE: Make sure that your named.ca, named.localhost, and named.loopback files are in place on RHEL02.
Step 1. With the files in place, you can check for syntax errors:
# service named configtest
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Step 2. Start the named service:
# service named start
Starting named: [ OK ]
Step 3. Check the /var/named/slaves directory to see if the zone files copied over from the master DNS server correctly:
# ls /var/named/slaves
example.com.revzone example.com.zone
You can manually pull the zone files from the master DNS server by using the dig command to perform a zone transfer. We look at the full syntax of the dig command later, but here you can see how to manually transfer a zone file:
# dig -t axfr example.com @rhel01
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5 <<>> @rhel01 example.com axfr
; (1 server found)
;; global options: printcmd
example.com. 86400 IN SOA rhel01.example.com.
root.example.com. 2010120711 86400 7200 2419200 3600
example.com. 86400 IN NS rhel01.example.com.
example.com. 86400 IN A 172.168.1.1
client02.example.com. 86400 IN A 172.168.1.20
client01.example.com. 86400 IN A 172.168.1.10
rhel02.example.com. 86400 IN A 172.168.1.2
rhel01.example.com. 86400 IN A 172.168.1.1
example.com. 86400 IN SOA rhel01.example.com.
root.example.com. 2010120711 86400 7200 2419200 3600
;; Query time: 50 msec
;; SERVER: 172.168.1.1#53(172.168.1.1)
;; WHEN: Tue Feb 1 10:21:25 2011
;; XFR size: 8 records (messages 1)
If you get any errors, the slave DNS server is not able to pull the zone files from the master DNS server until the errors are resolved. In the “DNS Utilities and Troubleshooting” section later, you see how to resolve any errors that are thrown here.