How to add a 3rd name server (ns3)


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DNS

How to add a 3rd name server (ns3)Last Modified: Nov 1, 2010, 3:59 pm
The DirectAdmin interface currently only allows for 2 nameservers to be entered.  You can add a 3rd namesevrer to all old and new domains, but requires some simple file editing.

We'll assume that the 3rd nameserver is called ns3.host.com and that the user domains are called domain.com

1) First, setup the default ns template so that any newly created domains have the 3rd nameserver.

cd /usr/local/directadmin/data/templates/custom
cp ../dns_ns.conf .

Then edit the copied dns_ns.conf and add the following line to the bottom of it:

ns3.host.com.=|DOMAIN|.

Make sure you add the periods to the end of each value, they're very important.  This will now add a 3rd namesever for all domains created after this point.


2) Next, to change the existing domains, we need to edit the named.db template temporarily. Type

cd /usr/local/directadmin/data/templates

(without the /custom).  Edit the named.db file.  At the very bottom of the file, add:

|DOMAIN|.       14400   IN      NS      ns3.host.com.

Again paying special attention to the periods at the end of the values.   Now, any rewrite done by DirectAdmin will add that line, so let's now issue a full dns rewrite

echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d400

At this point, all domains will have the ns3 value, but we don't want them to have multiple ns3 values after each rewrite (adding a subdomain, etc), so we have to now remove the last line you've added from the named.db.  Edit the named.db and remove your entry.   You're done.



If you want the ns3 value to vary per Reseller, you can use if-then-else type statements in the dns_ns.conf, since all templates support scripting, eg:

|NS1|=|DOMAIN|.
|NS2|=|DOMAIN|.
|*if NS1="ns1.ofreseller1.com."|
ns3.ofreseller1.com.=|DOMAIN|.
|*else|
ns3.globalforeveryoneelse.com.=|DOMAIN|.
|*endif|

2003 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST