Difference between revisions of "How to install Bind9"
Line 90: | Line 90: | ||
2419200 ; Expire | 2419200 ; Expire | ||
3600 ) ; Negative Cache TTL 1H | 3600 ) ; Negative Cache TTL 1H | ||
− | |||
; name servers - NS records | ; name servers - NS records | ||
− | |||
IN NS ns2.tx.labnet. | IN NS ns2.tx.labnet. | ||
− | |||
; name servers A records | ; name servers A records | ||
ns2 IN A 10.64.0.2 | ns2 IN A 10.64.0.2 | ||
− | |||
;CANAME Records | ;CANAME Records | ||
puppet IN CNAME puppetmaster2003.tx.labnet. | puppet IN CNAME puppetmaster2003.tx.labnet. | ||
− | |||
;10.64.0.0 - A records | ;10.64.0.0 - A records | ||
lab2001 A 10.64.0.19 | lab2001 A 10.64.0.19 |
Revision as of 17:31, 1 February 2019
Prerequisites
BIND is an open source software that allows you to setup and Domain Name Server (DNS) to resolve IP addresses to hostnames and vice versa To complete this tutorial, we will need:
- 1 node for the Bind9 server
- 1 or 2 nodes for testing
All 3 nodes in this tutorial have Ubuntu 16.04, but this will work as well on Debian Stretch. So make sure first all your nodes have Ubuntu or Debian installed and have all updates.
Bind9 installation
The installation is very simple just two commands
sudo apt-get install bind9 sudo apt-get install bind9utils
If you are using puppet in your environment, you can also create a class and use it to install bind9.
Example of class:
#The class will install a DNS server using the bind9 package class server::bind_server { #Execute -apt-get update' exec { 'apt-update': command => '/usr/bin/apt-get update' } #installation of Bind package { 'bind9': require => Exec['apt-update'], ensure => installed, } #installation of Bind utils package { 'bind9utils': require => Exec['apt-update'], ensure => installed, } service { 'bind9': ensure => running, } }
Bind9 configuration
All the configuration files we need are under /etc/bind/. The fist configuration file we will work on is named.conf.local. In this file we are going to define all the zones we need and the path to the zones file. The default file looks like the one below.
// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918";
To this file we are going to define our first zone tx.labnet and the reverse zone 0.64.10.in-addr.arpa. so the file will look like the one below.
// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; zone "tx.labnet" { type master; file "/etc/bind/zones/labnet"; notify yes; }; zone "0.64.10.in-addr.arpa" { type master; file "/etc/bind/zones/10.in-addr.arpa"; notify yes; };
Now that we have define our zones it is time to to create the two files for our zones. Under /etc/bind/, create a directory named zones
cd /etc/bind/ sudo mkdir /etc/bind/zones
Create the two files 'labnet" and "10.in-addr.arpa"
ppaul@ns2:/etc/bind/zones$ sudo touch labnet 10.in-addr.arpa ppaul@ns2:/etc/bind/zones$ ls -l total 8 -rw-r--r-- 1 root root 1723 Jan 31 17:07 10.in-addr.arpa -rw-r--r-- 1 root root 1620 Jan 31 17:07 labnet
We are going to start with the "labnet" file. Open the "labnet" file and copy and paste the content below into the file.
$TTL 604800 @ IN SOA ns2.tx.labnet. admin.tx.labnet. ( 50 ; Serial 43200 ; Refresh 12H 7200 ; Retry 2H 2419200 ; Expire 3600 ) ; Negative Cache TTL 1H ; name servers - NS records IN NS ns2.tx.labnet. ; name servers A records ns2 IN A 10.64.0.2 ;CANAME Records puppet IN CNAME puppetmaster2003.tx.labnet. ;10.64.0.0 - A records lab2001 A 10.64.0.19