[How To] Install BIND 9 on Ubuntu (DNS)

  1. Installing Bind

    apt-get install bind9

    The output is

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      bind9utils
    Suggested packages:
      bind9-doc resolvconf
    The following NEW packages will be installed:
      bind9 bind9utils
    0 upgraded, 2 newly installed, 0 to remove and 97 not upgraded.
    Need to get 429 kB of archives.
    After this operation, 1,409 kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric/main bind9utils i386 1:9.7.3.dfsg-1ubuntu4 [102 kB]
    Get:2 http://us.archive.ubuntu.com/ubuntu/ oneiric/main bind9 i386 1:9.7.3.dfsg-1ubuntu4 [327 kB]
    Fetched 429 kB in 1s (238 kB/s)
    Preconfiguring packages ...
    Selecting previously deselected package bind9utils.
    (Reading database ... 146516 files and directories currently installed.)
    Unpacking bind9utils (from .../bind9utils_1%3a9.7.3.dfsg-1ubuntu4_i386.deb) ...
    Selecting previously deselected package bind9.
    Unpacking bind9 (from .../bind9_1%3a9.7.3.dfsg-1ubuntu4_i386.deb) ...
    Processing triggers for man-db ...
    Processing triggers for ufw ...
    Processing triggers for ureadahead ...
    ureadahead will be reprofiled on next reboot
    Setting up bind9utils (1:9.7.3.dfsg-1ubuntu4) ...
    Setting up bind9 (1:9.7.3.dfsg-1ubuntu4) ...
    Adding group `bind' (GID 125) ...
    Done.
    Adding system user `bind' (UID 115) ...
    Adding new user `bind' (UID 115) with group `bind' ...
    Not creating home directory `/var/cache/bind'.
    wrote key file "/etc/bind/rndc.key"
    #
     * Starting domain name service... bind9                                                                                                 [ OK ]
    root@ubuntu:~# 
    
  2. The file /etc/bind/named.conf includs:

    cat /etc/bind/named.conf
    
    include "/etc/bind/named.conf.options"; 
    include "/etc/bind/named.conf.local"; 
    include "/etc/bind/named.conf.default-zones";
  3. Edit the file

    vim /etc/bind/named.conf.local
    
    zone "domain.local" { 
    type master; 
    file "/etc/bind/master/domain.local"; 
    };
    
    zone "189.168.192.in-addr.arpa." { 
    type master; 
    file "/ etc/bind/master/192.168.189.rev"; 
    };
  4. Create a folder

    mkdir /etc/bind/master

    And create the zone files

    vim /etc/bind/master/domain.local
    $ TTL 3h 
    @ IN SOA ubuntu.domain.local. root.ubuntu.domain.local. A 1d 12h 1w 3h
    
    domain.local. IN NS ubuntu.domain.local.
    
    ubuntu A 192.168.189.129 
    serv1 A 192.168.189.253 
    win A 192.168.189.20
    vim /etc/bind/master/192.168.189.rev
    $ TTL 604 800 
    @ IN SOA ubuntu.domain.local. root.ubuntu.domain.local. A 1d 12h 1w 3h
    
    @ IN NS ubuntu.
    
    129 PTR ubuntu.domain.local. 
    53 PTR serv.domain.local. 
    0 PTR win.domain.local.

    Restart the bind

    /etc/init.d/bind9 restart
  5. Edit the resolv.conf file:

    vim /etc/resolv.conf
    nameserver 192.168.189.129 
    domain domain.local
Tags:, ,
One Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.