How to Install MaraDNS on CentOS 6


MaraDNS is a lightweight yet robust open source DNS server program. Compared with other applications of the same kind, like ISC BIND, PowerDNS, and djbdns, MaraDNS is more simple and easier to use, perfect for small and medium-sized businesses.

In this article, I will show you how to install and use MaraDNS as a recursive DNS server on a Vultr CentOS 6 server instance.

Prerequisites

  • A newly-created Vultr CentOS 6 server instance.
  • A non-root sudo user. See this Vultr article for details on how to create a sudo user.

Step 1: Update the system

sudo yum updatesudo shutdown -r now

Use the same sudo user to log in after the reboot.

Step 2: Download and install MaraDNS

cdwget http://maradns.samiam.org/download/2.0/2.0.13/maradns-2.0.13.tar.bz2tar -jxvf maradns-2.0.13.tar.bz2cd maradns-2.0.13sudo yum install gccsudo makesudo make install

Step 3: Use MaraDNS as a recursive DNS server

MaraDNS uses a standalone component named Deadwood to process recursive DNS queries. In order to run Deadwood properly and safely, you need to modify its settings according to your specific conditions.

For example, if you want to setup a semi-public recursive DNS server which handle DNS queries only from designated IP addresses, you need to configure Deadwood as below:

Open the file “/etc/mararc” with the vi editor:

sudo vi /etc/mararc

Find the line:

ipv4_bind_addresses = "127.0.0.1"

Add your machine’s public IP address (say it is 203.0.113.1) and private IP address (say it is 10.99.0.10), and then this line should become:

ipv4_bind_addresses = "127.0.0.1, 203.0.113.1, 10.99.0.10"

Save and quit:

:wq!

Open another file “/etc/dwood3rc” with the vi editor:

sudo vi /etc/dwood3rc

Find the line:

bind_address="127.0.0.2" # IP we bind to

Add your machine’s public IP address and private address again, and then this line should become:

bind_address="127.0.0.2, 203.0.113.1, 10.99.0.10" # IP we bind to

Find the line:

recursive_acl = "127.0.0.1/16" # Who is allowed to use the cache

Add any allowed IP address ranges under the above line, say they are 10.99.0.0/24, and 203.0.113.0/24, one address range per line:

recursive_acl = "10.99.0.0/24"recursive_acl = "203.0.113.0/24"

Additionally, uncomment the following line to allow DNS queries from private network:

#filter_rfc1918 = 0

It should become:

filter_rfc1918 = 0

Save and quit:

:wq!

Finally, start Deadwood:

sudo chkconfig maradns.deadwood onsudo /etc/init.d/maradns.deadwood start

That’s it. Thank you for reading.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.