bash# /etc/rc.d/init.d/named start
The first thing you need to in order to set up named is to edit the configuration file. The configuration file is found at /etc/named.conf. This is basically what the file looks like:
// generated by named-bootconf.pl options { directory "/var/named"; /* * If there is a firewall between you and nameservers you want * to talk to, you might need to uncomment the query-source * directive below. Previous versions of BIND always asked * questions using port 53, but BIND 8.1 uses an unprivileged * port by default. */ // query-source address * port 53; }; // // a caching only nameserver config // zone "." IN { type hint; file "named.ca"; };
This file works nice, but lets create a new file to replace this one. Let's create the domain name bob.org and assume that we have the IP addresses from 1.2.3.0 to 1.2.3.255. This will be the server 1.2.3.2. Lets also assume that another DNS at the address 2.3.4.5 is going to be getting a copy of our DNS. This will only be one of two DNSs that we will create. Our two DNSs will be 1.2.3.2 and 1.2.3.3. Change the file to say this instead:
options { directory "/var/named"; allow-transfer{ 2.3.4.5; 1.2.3.2; 1.2.3.3; }; }; zone "." { type hint; file "named.ca"; }; zone "0.0.127.in-addr.arpa"{ type master; file "named.local"; }; zone "bob.org"{ type master; file "db.bob"; }; zone "3.2.1.in-addr.arpa" { type master; file "db.1.2.3"; };
Notice that when we declare a zone we reverse the numbers in the IP address and drop the last number that became the first. We have to allow transfers for 2.3.4.5 because that is the DNS that will have our information and publish it to the rest of the world. We are allowing transfers to ourself and the other backup DNS server at 1.2.3.3. The other DNS as 1.2.3.3 would have a file very similar that would look like this:
options { directory "/var/named"; allow-transfer{ 2.3.4.5; 1.2.3.2; 1.2.3.3; }; }; zone "." { type hint; file "named.ca"; }; zone "0.0.127.in-addr.arpa"{ type master; file "named.local"; }; zone "bob.org"{ type slave; file "db.bob"; masters{ 1.2.3.2; }; }; zone "3.2.1.in-addr.arpa" { type slave; file "db.1.2.3"; masters{ 1.2.3.2; }; };
About all that needs to be changed is the line that says ``type master'' so that it instead a slave and there needs to be a master section that says where the master server is located.