How to set up a DNS server for MooseFS on Debian/Ubuntu
MooseFS relies on DNS to locate masters and chunkservers by name, making a proper DNS setup essential before anything else. This guide configures bind9 on Debian/Ubuntu with a custom zone for your cluster’s mfsnetwork.lan domain, including forward and reverse (PTR) records.
This article is part of the MooseFS installation guide series:
- How to set up a DNS server for MooseFS on Debian/Ubuntu
- Things to do before installing MooseFS
- How to install MooseFS
- MooseFS basic usage
For the purpose of these articles, we will assume that your machines have the 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) the file named /etc/bind/named.conf.local. In this file, you can decide whether it is a master or slave server and select the path to the 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 (the bind user 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, edit the 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 the 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 the DNS 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 the /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 a DNS server for MooseFS! You can read more in the next tutorial in this series.
Links
You can find out more about DNS server e.g. on these pages: