The Domain Name System (DNS) is the system that converts domain names (
domain.com) into IP addresses (
18.104.22.168). 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 nameservers will return the names of the nameservers you specified with your domain. Subsequent queries will ask those nameservers (usually at your own server), using the zones and values you've setup through your control panel (DirectAdmin or cPanel for example).
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 in DirectAdmin, 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 22.214.171.124 ns2 A 126.96.36.199
188.8.131.52 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).
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. (Applicable to users of Virtual Private Servers and Dedicated Servers only)
Reseller 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.