Search This Blog

Networking - DNS (Domain Name Server)

Domain Name Service (DNS) is an Internet service that maps IP addresses and fully qualified domain names (FQDN) to one another. In this way, DNS alleviates the need to remember IP addresses. Computers that run DNS are called name servers. Ubuntu ships with BIND (Berkley Internet Naming Daemon), the most common program used for maintaining a name server on GNU/Linux. [Ref: Ubuntu Official Document on 22.02.11]

When you are going to browse any web site, then you enter the web site's name, but this name converted into number. Each time you type a web site's address into your browser, the Domain Name System (DNS) goes to work. The level of FQDN (Fully Qualified Domain Name) are given below,


Ex. mail.yahoo.com.

Follow the below steps to install DNS and configure it.




Step 1] Install the bind9 package to install DNS after login as administrative.


susanta@admin:~$ sudo -s
 

root@admin:~# sudo  apt-get  install  bind9








Step 2] Edit (or add new lines in) the main configuration file.

root@admin:~# gedit  /etc/bind/named.conf
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";



// reduce log verbosity on issues outside our control
logging {
    category lame-servers { null; };
    category cname { null; };
};

// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "home.com" {
        type master;
        file "/etc/bind/home.com.db";
};

zone "0.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/rev.0.168.192.in-addr.arpa.db";
};






Step 3]  Now creates two database files by following existing example. One file contents the information of converting host name to IP address and another contents the information of converting IP address to host name.root@admin:~# cp  /etc/bind/db.local  /etc/bind/home.com.db

Note: It will help to convert host name to IP  address.






root@admin:~# cp  /etc/bind/db.127   /etc/bind/rev.0.168.192.in-addr.arpa.db

Note: It will help to convert IP  address to host name.



Step 4]  Now, edit the home.com.db file to convert host name to IP address


root@admin:~# gedit /etc/bind/home.com.db
;
; BIND data file for local loopback interface
;
$TTL    604800
@    IN    SOA    admin.home.com. root.admin.home.com. (
                  2        ; Serial
             604800        ; Refresh
              86400        ; Retry
            2419200        ; Expire
             604800 )    ; Negative Cache TTL
;
@    IN    NS    admin.home.com.
admin    IN    A    192.168.0.1
mail    IN    A    192.168.0.2
chat    IN    A    192.168.0.3
news    IN    A    192.168.0.4
www    IN    A    192.168.0.5



Step 5]  Now, edit the rev.0.168.192.in-addr.arpa.db file to convert IP address to host name.

root@admin:~# gedit  /etc/bind/rev.0.168.192.in-addr.arpa.db
;
; BIND reverse data file for local loopback interface
;
$TTL    604800
@    IN    SOA    admin.home.com. root.admin.home.com. (
                  1        ; Serial
             604800        ; Refresh
              86400        ; Retry
            2419200        ; Expire
             604800 )    ; Negative Cache TTL
;
@    IN    NS    admin.home.com.
1    IN    PTR    admin.home.com.
2    IN    PTR    mail.home.com.
3    IN    PTR    chat.home.com.
4    IN    PTR    news.home.com.
5    IN    PTR    www.home.com.

No comments:

Post a Comment