How to set up a DNS server for MooseFS on Debian/Ubuntu

September 19th, 2018 | Wojciech Kostański post_thumbnail

We will show you how to set up a DNS server for MooseFS. It is one of the first steps you should take before the installation.

This article is part of the MooseFS installation guide series:

  1. How to set up a DNS server for MooseFS on Debian/Ubuntu
  2. Things to do before installing MooseFS
  3. How to install MooseFS
  4. MooseFS basic usage

For the purpose of these articles, we will assume that your machines have following IP addresses:

  • Master Servers:
    • Leader: 192.168.1.1
    • Follower/Metalogger: 192.168.1.2
  • Chunkservers:
    • 192.168.1.101
    • 192.168.1.102
    • 192.168.1.103
  • Clients (Users’ computers):
    • 192.168.2.x

Using /etc/hosts instead of a DNS server

We recommend using a DNS server instead of writing hosts files on each and every machine.

But if you have only a few machines and you want to test MooseFS, and you really don’t want to set up a DNS, we have a simple guide on how to do it. We will show how to configure it with only one Master server.

You will need to open file/etc/hosts on each host (Masters, chunkservers, and clients) and append:

192.168.1.1   mfsmaster
192.168.1.101 chunkserver01
192.168.1.102 chunkserver02
192.168.1.103 chunkserver03

That’s it! It is super simple and still, we don’t recommend this method.

DNS server for MooseFS setup

The very first thing to do is installing bind9 and DNS utils. You can do this by running the following command:

sudo apt-get install bind9 dnsutils

The second thing you have to do is edit in your favorite editor (e.g. nano or vim) file named /etc/bind/named.conf.local. In this file, you can decide whether it is master or slave server and a select path to zone’s config file. Main configuration files are placed in /etc/bind/ directory. You need to add there your new zone, e.g.:

zone "mfsnetwork.lan" { 
  type master ;
  file "/etc/bind/mfsnetwork.lan"; 
};

After that create the file you’ve pointed to (here: /etc/bind/mfsnetwork.lan) in the zone configuration (user bind must have permissions to read it) and paste there the following code:

$TTL 3600 
$ORIGIN mfsnetwork.lan.  
@ IN SOA dns.mfsnetwork.lan. root.mfsnetwork.lan. ( 
  2016032900 ; serial number YYYMMDDSS 
  10800 ; refresh 
  3600 ; retry 
  604800 ; expire 
  10800 ; negative TTL 
) 

@ IN NS dns.mfsnetwork.lan. 
@ IN A 192.168.0.1 ; address of bind9 
dns IN A 192.168.0.1 ; address of bind9 

mfsmaster IN A 192.168.1.1 ; address of Master01 
mfsmaster IN A 192.168.1.2 ; address of Master02
 
mfsmaster01 IN A 192.168.1.1 ; address of Master01 
mfsmaster02 IN A 192.168.1.2 ; address of Master02 

chunkserver01 IN A 192.168.1.101 ; address of Chunkserver01 
chunkserver02 IN A 192.168.1.102 ; address of Chunkserver02 
chunkserver03 IN A 192.168.1.103 ; address of Chunkserver03

Next thing to do is to edit file /etc/bind/named.conf.options. You should use here your ISP’s DNS servers, or you can use OpenDNS servers – IP addresses are presented below:

forwarders { 
  208.67.222.222; 
  208.67.220.220; 
};

The last thing to do is to restart the bind9 DNS server to let it load new configuration:

sudo service bind9 restart

Set up a revDNS server

Reverse DNS server is used by MooseFS and all network services, in general, to translate IP addresses to human-readable form (e.g. 192.168.1.1 to mfsmaster01). After you install and properly configure theDNS server you need to do 3 more things to have revDNS set up:

Create an empty file named /etc/bind/rev.168.192.in-addr.arpa and paste into it the following code:

@ IN SOA dns.mfsnetwork.lan. root.mfsnetwork.lan. ( 
  2016032900 ; serial number YYYYMMDDSS 
  28800 
  604800 
  604800 
  86400 
) 

168.192.in-addr.arpa. IN NS dns.mfsnetwork.lan. 
1.1 IN PTR mfsmaster01.mfsnetwork.lan. 
2.1 IN PTR mfsmaster02.mfsnetwork.lan. 

101.1 IN PTR chunkserver1.mfsnetwork.lan. 
102.1 IN PTR chunkserver2.mfsnetwork.lan. 
103.1 IN PTR chunkserver3.mfsnetwork.lan.

Add the following code to /etc/bind/named.conf.local file:

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

Restart bind9 using the following command:

sudo service bind9 restart

Summary

After these steps, you are prepared to configure DNS server for MooseFS! You can read more in the next tutorial in this series.

Links