=====================================
DNS (Domain Name system) is a wide area where domains and IPs will be resolved.
You can simply resolve a name server to an IP(DNS), also you can resolve an IP to a name server(rDNS).
Name server ( ns1.google.com) 207.45.35.56
| |
| (DNS) | (rDNS)
| |
207.45.35.56 Name server ( ns1.google.com)
As per web hosting industry you can simply assign a name server to an IP at the domain registrar end.
Why DNS?
=====================================
Why we are assigning name servers to IPs? We can't simply keep all the domain's IPs always to view its pages using your computer. Normally humans are not familiar with such high range of numbers.
So we are moving into DNS simply like a telephone directory.
Registering a name server:
====================
To start resolving your domain, you just have to login to your domain registrar end, who is selling domain names(godaddy, namecheap, etc) , and have to register your desired name servers you want to use for your domains.
For example if you are having a domain name as simpledomain.com with godaddy and you want to use ns1.simpledomain.com, ns2.simpledomain.com as name servers for your domains, here you go..
1. First login to your domain seller's login area and register these two name servers with your hosting servers IPs. ( Its better to use two different IPS instead of using single IP).
Ex: ns1.simpledomain.com = 207.45.35.56
ns2.simpledomain.com = 207.45.35.57
2. Then you need to point your domain to those name servers. So the parent name server end settings completed now.
3. Go to the server end now for setting up child name servers. You may need to create two DNS zone records for your name servers and a single DNS zone record for your domain to resolve them properly.
Ex:
;DNS zone record for ns1.simpledomain.com
==============================================================================================
$TTL 86400 ; 24 hours could have been written as 24h or 1d
$ORIGIN example.com.
@ 1D IN SOA ns1.simpledomain.com. hostmaster.simpledomain.com. (
2002022401 ; serial
3H ; refresh
15 ; retry
1w ; expire
3h ; minimum
)
IN NS ns1.simpledomain.com. ; in the domain
IN NS ns2.simpledomain.com. ; external to domain
IN MX 10 mail.simpledomain.com. ; external mail provider
; server host definitions
ns1 IN A 207.45.35.56 ;name server definition
www IN A 207.45.35.57 ;web server definition
ftp IN CNAME www.simpledomain.com. ;ftp server definition
; non server domain hosts
bill IN A 192.168.0.3
fred IN A 192.168.0.4
The above zone file would be a simple domain which explains the name server's A records, MX records and all. To know what is A record, MX records and CNAME, you can refer the following links;
http://kb.siteground.com/article/DNS_Records_NS_A_MX_CNAME_SPF_Explained.html
http://www.itsyourip.com/dns/dns-records-explained/
So you have now configured DNS zone record for your name server. After allowing 24-48 hours your name server will start to ping from your server with the assigned IP on your DNS zone record.
At the same time if you point your domain to these registered name servers your domain will start to resolve from your server.
=====================================
How DNS works with here?
Once registering name servers and pointing your domain to those registered name servers, what will happen?
1.Once you hit a domain name on your browser, it will produce a DNS query will be accessing all the global DNS cache and will get its name servers which is assigned to it on that domain's registrar end.
2. Once the DNS query got the name servers, it will look for the IPs assigned to it on the name server's registration end, and will find the appropriate IP.
3.Once after getting the IP details, the DNS query will look for the appropriate server which has that specific IP address.
This is bit network related, every router on DNS would have a router table which will be having the IP address info, so while the DNS query passed them over, it will find the corresponding server which has the IP assigned with it and will reach the server.
4. After reaching the server the DNS query will interact with the bind service and will look for the corresponding domain's zone records to see if its existing. If so, the A records will be addressed and hence the domain is resolved.
If its the same server IP, the web server virtual host entry would be checked then appropriate web directory will be displayed on your browser as the domain main page.
Continue...........