DNS server install

In this video I will install a server that is outside of openstack and maas to run BIND9 for DNS resolution. I have found that it would make things a lost easier if we can use domain names rather than IP's.

Link to the video:

I use this walk through it was very helpful.

Set your interfaces to static

sudo nano /etc/network/interfaces

Check to make sure your hostname is correct:

cat /etc/hostname

Edit your host file and add your new DNS name
sudo nano /etc/hosts

Example of mine:       localhost   desktop.bcnet.cin desktop

Now is a good time to reboot:

sudo now reboot

Install bind:

sudo apt install bind9

Make a zones directory:

sudo /etc/bind/zones

Copy the example zone files into your new files so you have something to work off of.

sudo cp /etc/bind/db.local /etc/bind/zones/bcnet.cin.db

sudo cp /etc/bind/db.127 /etc/bind/zones/db.192

Edit conf.options:

sudo nano /etc/bind/named.conf.options


options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.

         forwarders {


        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        dnssec-validation no;
        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };

Edit conf.local:

sudo nano /etc/bind/named.conf.local


// Do any local configuration here

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

# Our domain zone
zone "bcnet.cin" {
   type master;
   file "/etc/bind/zones/bcnet.cin.db";

# For reverse DNS
zone "1.168.192.in-addr.arpa" {
   type master;
   file "/etc/bind/zones/db.192";

Edit your master zone file:

sudo nano /etc/bind/zones/bcnet.cin.db


; BIND data file for local loopback interface
$TTL    604800
@       IN      SOA     desktop.bcnet.cin. webuser.bcnet.cin. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
bcnet.cin.       IN      NS      desktop.bcnet.cin.
bcnet.cin.       IN      A
gateway         IN      A
nas             IN      A
desktop         IN      A
mythserv        IN      A
mythserv2       IN      A
alien           IN      A
maas            IN      A
www     IN      CNAME   bcnet.cin.

Edit reverse zone file:

sudo nano /etc/bind/zones/db.192


; BIND reverse data file for local loopback interface
$TTL    604800
@       IN      SOA     desktop.bcnet.cin. webuser.bcnet.cin. (
                              1         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
        IN NS desktop.
1       IN PTR gateway.bcnet.cin.
115     IN PTR nas.bcnet.cin.
116     IN PTR desktop.bcnet.cin.
130     IN PTR mythserv.bcnet.cin.
131     IN PTR mythserv2.bcnet.cin.
142     IN PTR alien.bcnet.cin.
150     IN PTR maas.bcnet.cin.

Run a check on your zone files, there should return with a OK, if now you have typos:

named-checkzone autun.hom /etc/bind/zones/bcnet.cin.db

named-checkzone autun.hom /etc/bind/zones/db.192

Restart bind:

sudo /etc/init.d/bind9 restart

On our new DNS server a host command should return all the zones:

host -l bcnet.cin

Output should look something like this:

bcnet.cin name server desktop.bcnet.cin.
bcnet.cin has address
alien.bcnet.cin has address
desktop.bcnet.cin has address
gateway.bcnet.cin has address
maas.bcnet.cin has address
mythserv.bcnet.cin has address
mythserv2.bcnet.cin has address
nas.bcnet.cin has address

Edit your interfaces file again to remove the comment from dns-nameservers:

sudo nano /etc/network/interfaces

To check for errors you can tail the syslog

tail -f /var/log/syslog

What ever machine you want to use your new DNS server update there DNS server entries:

On you MAAS server edit bind to turn off the dnssec option:

sudo nano /etc/bind/named.conf.options

It should look like this:

options { directory "/var/cache/bind";
dnssec-validation no;
include "/etc/bind/maas/named.conf.options.inside.maas";
auth-nxdomain no;
listen-on-v6 { any; }; };

Restart bind on MAAS:

sudo /etc/init.d/bind9 restart

Now you can access MAAS with the DNS name, mine is maas.bcnet.cin/MAAS

Make sure you change this setting on the MAAS gui in networks>eth0 config add you new DNS server:

Make this change in the settings tab as your DNS forward address to your new server: