2. Agenda
1. What is DNS server?
2. What is Name server?
3. What are zones – forward and reverse zone?
4. What are master dns server and slave dns server?
5. What are the DNS server records type?
6. Setup DNS server master and slave on Ubuntu 14.04 64bit VPS.
2
3. What is DNS server?
A dns server is a computer name resolution service which helps to recognize computers by name
over ip network.
A dns server resolves hostname to ip address and ip address to hostname.
Without a name resolution server i.e a dns server it is not possible to surf a website by its human
readable name.
A computer communicates with another computer by identify their address and understands
only ip address. Hence a dns server works as a translator between human to computer.
Some example are :
Google public dns server
8.8.8.8
8.8.4.4
3
4. What is Name server? 4
A Name server is actually the dns server’s name.
To host a website or to resolve an address of a computer over internet you need to register the dns name
with a domain registrar.
You also need to register your dns server as name server to your domain registrar.
After the above two steps you need to configure DNS server as per name server registered and then you
can create record to your own dns server.
At least minimum two name servers required to register ( can have same wan IP)
Example :
Domain registrar : godaddy , bigrock, znetlive etc.
I purchase a domain name mevijay.in from bigrock.
I have two Ubuntu VPS having ip 158.85.163.100 & 158.85.163.103 hence I register both vps as name
server ns1.mevijay.in & ns2.mevijay.in
I also updated ns records from domain registrar to use as my vps ns1.mevijay.in and ns2.mevijay.in
So all the name resolution query will be forwarded to my dns server (name server) from my domain
registrar.
5. What are zones? 5
DNS server has two types of zones
1. forward zone
2. reverse zone
A forward zone resolves host name into ip address and holds record types – A , NS, MX, CNAME,
AAA, SPF.
A reverse zone resolves ip address to hostname and holds only PTR record type. If I need to
know an ip address is belongs to which hostname or dns name then it can be lookup by reverse
zone. Reverse zone is mandatory for mail server. If you have a mail server then a PTR records
corresponding to mail servers hostname must be entered as wel as mx record and A record also
must be entered in forward zone.
6. DNS server Types: 6
Two types of dns server mainly used.
1. Primary or master dns server
2. secondary or slave dns server
Master dns server is nothing but as its name it’s a master name server and holds both zone and
records.
Slave dns server works as secondary dns server and sync with master dns server for records. So
you do not need to update a slave dns server records and can simply restart the service when
a master dns server records got updated.
7. DNS server record types: 7
A DNS server consists two zones forward and reverse, depending upon the zone we have
following main record types-
Forward zone records:-
A
MX
NS
CNAME
Reverse zone record:-
PTR
8. Understanding forward zone records: 8
A record:-
an A record resolves hostname to ip address and is main record type to recognize a computer or
website by its name.
e.g. mail IN A 192.168.1.108
MX record:-
mx record is used to point a host name as mail exchanger server i.e. mail server. This record used to
tell network that pointed hostname is a mail server of domain.
e.g. @ IN MX 10 mail.mevijay.in.
Above example telling you that mail.mevijay.in A record or hostname is the mail server for domain
mevijay.in having mail priority 10.
NS record:-
ns record is used to point for your dns server (name server)address and is usually dns server itself.
e.g. @ IN NS ns1.mevijay.in.
Above example shows @ symbol which means zone i.e. mevijay.in for my case having name server is
ns1.mevijay.in
CNAME record:-
This also knows as alias of a domain name. perhaps it is quite easy to understand for a website that
opens with www and without. So we create a cname record of domain as www and it points on the
same hostname or same ip whether we use with www or not.
e.g. www IN CNAME mevijay.in.
9. Setup master dns server:- 9
# apt-get update
# apt-get install bind9 dnsutils –y
# cd /etc/bind
# mkdir zones ( to hold all zone records files)
# vim named.conf.default-zones
Remove all the lines and make changes like bellow
10. 10
Save file and exit.
# cp db.local zones/mevijay.in
# vim zones/mevijay.in
Make changes for your domain and enter required records example in bellow snap. Save and exit
# service bind9 restart
11. Setup slave dns server:- 11
# apt-get update
# apt-get install bind9 dnsutils –y
# cd /etc/bind
# mkdir zones ( to hold all zone records files)
# vim named.conf.default-zones
Remove all the lines and make changes like bellow. Here we have given ip of our master server to sync
records.
# touch zones/mevijay.in
# service bind9 restart