How Nameservers work


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


Top Level » DNS

How Nameservers workLast Modified: Nov 9, 2012, 12:24 am
The Domain Name System (DNS) is the system that converts domian names (domain.com) into IP addresses (1.2.3.4).  This system is far simpler than most people realize.

There are 3 main compontents to the dns system:
- Parent Nameservers (there are 13 of them in the world)
- Your domain name registrar (where you buy your domain)
- Your own Name Server (where you control the dns values of your domain)

1) When you go to your registrar, you'll purchase a domain.  When you purchase the domain, you'll specify the nameservers you want that domain to use.  Your registrar will take this information (the domain name and the nameservers it uses) and will send that to the parent nameservers.   This can sometimes take a few days to sync up.   Once finished, any query of your domain to the parent nameservesr will return the names of the nameservers you specified with your domain.  Subsequent queries will ask those nameservers (usualy at your own server), using the zones and values you've setup through DirectAdmin.

2) If you wish to create your own nameservers for your domain (eg: ns1.domain.com), you'll have to go to your registrar to "register" you nameservers as nameservers before you can use them.  The first step is usually to make sure they resolve.  To do this, you can either go to Reseller Level -> Nameservers, and create nameservers there... or to accomplish the same effect, simply go to manage your domain's zone (Admin Level -> DNS Admin -> domain.com) and add the 2 "A" records for ns1 and ns2, just like any other subdomain (eg, the same as for www, ftp, pop, etc..).  At the bottom of the page, use the "Add A Record" field to create:

ns1  A  1.2.3.4
ns2  A  1.2.3.5

where 1.2.3.4 and 1.2.3.5 are the IPs you want your nameservers to use.   This is essentially all a nameserver needs to have to exist (on the part of your server anyway, the rest is at the registrar).

Once your ns1.domain.com and ns2.domain.com values resolve, go to your registrar and register them as nameservers.

3) Propagation of the new values might take upwards of a few days, so patience is important.   Once they're registered, you can again go to your registrar and set your domain to use these new nameservers.   You'll also need to go back to your domain's dns management and set these new nameservers in the "NS" record values.


The order of events for a dns lookup of www.domain.com is as follows:

- A client queries his ISP's nameservers.

- His ISP's nameservers query the parent dns servers for domain.com, they return it's nameservers, (eg: ns1.domain.com and ns2.domain.com)

- His ISP's nameservers then query either ns1.domain.com or ns2.domain.com (choice is random) for the value of www.domain.com.

- either ns1 or ns2 will return the IP address of the "www" A record for domain.com to the ISP's nameservers.   The ISP's nameserver caches this value for usually about 4 hours so further queries are not required during that time.  The IP is returned to the client to use to access the server.


The locations in DirectAdmin where the NS records will be used, are specified at:

- Admin Level -> Admin Settings -> ns1/ns2:  The main nameservers for the box. Use to give to new Admins and Resellers, and for fallback values.   The IPs that these resolve to are the IPs used for "virtual" nameservers at the Reseller Level.

- Reeller Level -> Nameservers -> ns1/ns2 (bottom set):  The default values that are given to newly created Users created by this Reseller.

- Reseller Level -> List Users -> username -> ns1/ns2:  The default values that are given to newly created domains by the User.

All of these settings ultimately end up changing just the NS records of a domain, so by changing the NS values manually, that's all that really matters.
 
Related Helpfiles
www.domain.com doesn't work, but domain.com works fine (or vice versa)
How the multi server dns clustering works

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