Wednesday, July 16, 2008
Wednesday, June 18, 2008
DNS server Basics and Configuration
DNS Server Why DNS server is necessary? DNS servers are needed to convert domain name into IP address ======================================================= How many types of DNS servers are there? 1. Caching DNS Server 2. Regular (Authoritative) DNS Server 3. Dynamic DNS Server (DDNS) ======================================================= What is the another name for DNS server? Name Server =========================================================== How Caching DNS servers work? They simply store the information it has learnt from the Authoritative DNS Servers. Almost all the Routers/Firewall equipments have the dhcp server and caching dns servers in them. If you have an office with 100 PC with all having Internet facility, then Caching DNS server is OK. ========================================================== When I need Regular DNS server? If you host a web site from your own office and if you have a static IP address, then you can consider having Regular DNS server. Note: A regular dns server can do all the functions of caching dns server also. ============================================================= I want to start a web site from my office. But I dont have a static IP address. What to do? If your router is getting its ip address from an external dhcp server, then you should go for ddns. ============================================================ My web site is abc.co.in. Its IP address is 61.1.0.23. Only yesterday I installed a new dns server. How a person sitting at Newyark will reach my DNS server.? You are having a web site means, it has been registered with somebody. They will be maintainig the corresponding dns entry for this web site also. You can tell them to change the name server value to this new one. ============================================================== Whether the newyark pc will be able to reach me immediately? If the newyark pc has yesterday browsed your website, then in its cache or in its caching dns server, your old dns ip address will be there. If your old dns server has informed that its ttl is 3 days, then after 3 days only, the newyark pc will try to resolve ip again. ============================================================ How to configure my dns server? DNS server has only three files. 1. confiuration file : named.conf 2. forward zone file 3. Reverse zone file (in certain cases, this is not needed) ========================================================== Why Reverse zone file is necessary? Normally the mail servers will relay the mails only if they are able to resolve ip address into the correct domain name. ============================================================= What is SOA record? The forward and reverse zone files are nothing but databases. The first record of these databases is always SOA record.
===================================================== |
The SOA record contains the following details. It has 6 columns and 6 lines. |
@ | IN | SOA | www.abc.co.in. (fqdn of your primary ns.Last char is a dot) #-@ IN SOA says it is the soa record |
bshivaji.abc.co.in (email id of dns admin.@ is replaced by dot. the last char is a dot) |
( |
200812311 normally current date with single digit inc at the end |
;serial # Everytime you modify this zone file, you should change the serial number. if the serial numbers are different, then only updation will take place. | ||||
3600 | ;refresh seconds instruction for slave dns.soho dont have slaves |
||||
3600 | ;retry seconds instruction for slave to retry if conn fails. not for soho. |
||||
3600 | ;expire seconds total time a slave can retry master dns.not for soho |
||||
3600 | ;ttl seconds ttl for caching dns. this value is overridden by $TTL at the top( $TTL 3D means 3 days) |
) |
What about other records? Apart from SOA record, the zone file can have 4 types of records. NS,MX,A,CNAME records. |
Why you have to put a dot at the end of domain name? If you don't put a "." at the end of a host name in a SOA, NS, A or CNAME record, then automatically the domain name will be attached at its end. So an "A" record with "www" will be assumed to refer to www.abc.co.in. Sample forward zone file. |
Note:
www.abc.co.in is the dns server for abc.co.in. In a large network set up ns1 will be primary and ns2 will be secondary. But our one in soho. Here TTL for caching dns is 3 days MX record for abc.co.in is mail.abc.co.in Here we maintain only one server which works as web server,mailserver,dns server If we have 3 diff servers then there will be three A records as shown here www A 61.1.197.3 mail A 61.1.197.4 ns A 61.1.197.5 When ever you edit this file, you must change the serial number. If the existing and new are same, then this file will not be saved properly.
|
A-record (if web server,mailserver and name server are in the same machine)
column1 | column2 | column3 | column4 | note |
SERVER NAME | "A" | IP ADDRESS | N/A | |
localhost | A | 127.0.0.1 | this entry is a must | |
www | A | 61.1.96.100 | server name may be www.abc.com. if you write fqdn, then end with "." |
A-Record (if web server,mail server and name server are in separate machines)
column1 | column2 | column3 | column4 | note |
SERVER NAME | "A" | IP ADDRESS | N/A | |
localhost | A | 127.0.0.1 | this entry is a must | |
www | A | 61.1.96.100 | server name may be www.abc.com. if you write fqdn, then end with "." | |
A | 61.1.96.101 | mail server name is "mail" | ||
ns | A | 61.1.96.102 | name server name is "ns" |
MX-record
column1 | column2 | column3 | column4 | note |
domain name with "." | "MX" | mailserver priority | cname of mail server or fqdn of mailserver with "." | |
abc.com. | MX | 10 |
CNAME-RECORD
column1 | column2 | column3 | column4 | note |
"alias" or "nickname" for server |
"CNAME" | "A" record name for server |
N/A | |
CNAME | www | mail server is located in the computer where www.abc.com is there. That server's "A" name is www. Now we are giving a nick name to the same server as mail.This nick name is used in MX record. |
NS record
column1 | column2 | column3 | column4 | note |
blank | "NS" | IP address or cname of the nameserver |
N/A | |
NS | www |
Suppose your website is working with someother's dns server. you want to install your own dns server in your LAN.
How to migrate properly? Let my domain name be abc.com
Let us assume that the ip address of your www.abc.com is 61.1.196.100.
step1: you have to ask the existing service provider to change the ttl of abc.com to say, one minute. Normally it will be set to 3 days. What is the use of ttl? If the ttl is set to 3 days, then if a user came to the dns for abc.com, then next time, he will come only after 3 days. Because the dns supplied data will be cached in his computer for 3 days.. So now the problem is, you have migrated. but all the users will go to the old ip address only. That is why first we should do this step.
step: 2. Now, the new domain name will clash with the old existing domain name. So, first, let us create our new domain name as abc-new.com
step 3. Now ask your service to create a new record for the new domain name.
step 4. Now if any body tried,www.abc.com or www.abc-new.com will come to the correct place.
step 5: Certain steps are for purely for testing. now change your new domain from abc-new.com to just abc.com.
step 6: contact your web hosting provider so that their dns records point to the new dns server.This change is to be done siminultaneously at your end and the provider end.
step 7: Later you can change the ttl t 3 days to reduce the traffic to dns server.
========================================================
I got my abc.com domain name from the domain name registrar verisign.com. Now my name server is changed.
verisign.com will know abc.com. but they will not know www.abc.com. what to do?
You are a user of verisign. you can manage your domain name by login into their site. so, login and change
the name server of abc.com. This change will be updated to all the 13 root name servers slowly within 3 or 4 days.
===================================================================
The client sends the Request: This request has three information 1.server name : www.abc.com
2. What type of record it needs : A-record
3. what is the class of the domain name : it is almost always "IN"
The dns server will give the information, if available in its cache
Else, there will be a recursion