Jump to content



Photo

CryoTuts: Install & Configure BIND9

CryoTuts Install Configure BIND9 How To

  • Please log in to reply
2 replies to this topic

#1 Cryo Kinesis

Cryo Kinesis

    Haphost Staff

  • Moderators
  • 128 posts
  • LocationGridania, Eorzea

Posted 05 August 2014 - 05:52 PM

Hello everyone!

This type of question has been posted a few times on here so therefore, I have created this tutorial for you! How nice of me. smiley-grin.png

Firstly, we will need to install BIND9. Usually this doesn't have to be done as BIND9 comes pre-installed on the VPS. However, I'll tell you how to install it anyway.

Just a little heads up, most of the commands should be the same for Debian/Ubuntu & CentOS. This tutorial also expects you to use the "root" account. Screenshots start from stage 2+. To make this tutorial, I used my current DNS configurations. PLEASE DO NOT COPY MY CONFIGURATIONS!

We will use a fake IP for the layouts in the code areas (123.456.789.101)


Stage 1 - Installing BIND9

To install it, just simply execute this command:

For Debian/Ubuntu:-

apt-get update && apt-get install bind9

For CentOS:-
yum update && yum install bind9

If you want to let it install extra packages, you can do.

After the installation is complete, BIND9 is automatically started however, it will be running on default settings.


Stage 2 - Configuration

Next, you can navigate to BIND's configuration folder by using this command:

Suitable for All
cd /etc/bind
ls


Stage 2.1 - named.conf.local

Firstly, we are going to put our configurations into the named.conf.local file. You will need a text editor like nano or vi to edit the file. Use the layout below to help you start setting up:

zone "your_domain.tld" {
        type master;
        file "/etc/bind/zones/master/db.your_domain.tld";
};


zone "789.456.123.in-addr.arpa" {
        type master;
        file "/etc/bind/zones/master/db.123.456.789";
};

After that, you will need to save the file.


Stage 2.2 - Prepare for db files

As you see in the layout, there's a line with "file" there. When BIND9 receives a request, it will look through the zones that request matches to. It then goes through the zone configuration and find the zone type and file. The file part is what we're interested in. The file line tells BIND9 where the db is for the zone.

Let's create the zones and master directories.

Suitable for all:
mkdir zones && cd zones && mkdir master && cd master


Stage 2.3 - db.your_domain.tld

Next, we are going to create the db.your_domain.tld file. Use your text editor to create the file and then use the following layout:

;
; BIND data file for your_domain.tld
;
$TTL    3h
@       IN      SOA     ns1.your_domain.tld. root.your_domain.tld. (
                        2013112601      ; Serial (Best use the date of creation and add a 01 on the end)
                        3h              ; Refresh after 3 hours
                        1h              ; Retry after 1 hour
                        1w              ; Expire after 1 week
                        1h )            ; Negative caching TTL of 1 day
;
@       IN      NS      ns1.your_domain.tld.
@       IN      NS      ns2.your_domain.tld.


your_domain.tld.     IN      MX      10      mail.your_domain.tld.
your_domain.tld.     IN      A       123.456.789.101
ns1                     IN      A       123.456.789.101
ns2                     IN      A       123.456.789.101
www                     IN      CNAME   your_domain.tld.
mail                    IN      A       123.456.789.101

Now save the file once you have finished.


Stage 2.4 - db.123.456.789

Now, we will create the db.123.456.789 to contain the reverse DNS configurations. On Haphost, the reverse DNS function is disabled. If you upgrade to H1P, it will be available. Use your text editor again to create the file and simply use this layout below:

;
; BIND reverse data file for 789.456.123.in-addr.arpa
;
$TTL    604800
789.456.123.in-addr.arpa.         IN      SOA     ns1.your_domain.tld. root.your_domain.tld. (
                            2013112601  ; Serial (Use creation date)
                            3h          ; Refresh after 3 hours
                            1h          ; Retry after 1 hour
                            1w          ; Expire after 1 week
                            1h )        ; Negative caching TTL of 1 day
;
789.456.123.in-addr.arpa.         IN      NS      ns1.your_domain.tld.
789.456.123.in-addr.arpa.         IN      NS      ns2.your_domain.tld.
101.789.456.123.in-addr.arpa.      IN      PTR     your_domain.tld.

Save the file and we'll start the next stage.


Stage 3 - Apply the configuration

The 2nd to last task we need to do is simply restart BIND9 to allow the configurations to take place. Use the following command to do:

Suitable for all
service bind9 restart

If you are getting any errors during the restart, check the configurations you have written.


Stage 4 - Domain Configuration

In your domain's control panel, you will need to go to the domain's DNS configuration and add the nameservers you have created in stage 2.3. You will need to put your server IP where is requires the nameserver IP as you are setting up the nameservers.

After you've completed the configuration, simply save the settings and wait for the domain to propagate. This will usually take around 24-72 hours (Depending on the domain registrar).

You should now be setup with DNS/nameservers. If you have any problems, simply post in this tutorial your problem.

Thanks for reading and Good night!
  • Pityon likes this

Cryo%20Kinesis%20Haphost%20Sig2.png


#2 Siriuo

Siriuo

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 22 October 2014 - 10:53 AM

Hi Cryo,

 

Are there any additional repos which need to be installed for this as yum install bind9 doesn't seem to work.

 

Thanks



#3 Cryo Kinesis

Cryo Kinesis

    Haphost Staff

  • Moderators
  • 128 posts
  • LocationGridania, Eorzea

Posted 27 October 2014 - 01:04 PM

Hi there,

 

I believe the command for yum based operating systems is "yum install bind". :)


Cryo%20Kinesis%20Haphost%20Sig2.png






Also tagged with one or more of these keywords: CryoTuts, Install, Configure, BIND9, How To

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users