Quick DNS Server for Centos 5.10

dns settingI used to use Bind as dns server. The server itself is not for complex task such master or slave dns server. Only for authoritative and local dns cache (optional). As I love copy and paste I often post my experience here at least for my future reference in case I have problem.

Today, my copy and paste method in Centos server (running 5.10) not work anymore. Googling around don’t help either. So I choose other dns software that work for my case. Tinydns is my other choice but I think its time to try something new and I found marands.

Installation process is straightforward and working well, here’s the steps :


# yum install gcc

# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –enable-libgcj-multifile –enable-languages=c,c++,objc,obj-c++,java,fortran,ada –enable-java-awt=gtk –disable-dssi –disable-plugin –with-java-home=/usr/lib/jvm/java-1.4.2-gcj- –with-cpu=generic –host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)

Downloaad latest marands (at the time of writing its 2.0.09)

# wget -c http://maradns.samiam.org/download/2.0/2.0.09/maradns-2.0.09.tar.bz2

# tar xvjf maradns-2.0.09.tar.bz2

# cd maradns-2.0.09
# make
# make install
VERSION=2.0.09 ./build/install.sh
Installing MaraDNS, placing programs in /usr/local//bin/ and /usr/local//sbin/,
man pages in /usr/local//share/man/man1, /usr/local//share/man/man5,
and /usr/local//share/man/man8, and documents in /usr/local//doc/maradns-2.0.09
Adding MaraDNS startup scripts
Starting up MaraDNS at runlevel 3
starting up MaraDNS at runlevel 5

# service maradns start

# chkconfig maradns on

Edit mararc to change bind address, I use as lan address.

# nano /etc/mararc
looking for ipv4_bind_address line and change it into :

ipv4_bind_addresses = “,”


Edit content of zone (db.example.net)

# nano /etc/maradns/db.example.net

Use this lines :

test.example.net.      +14400    soa    ns1.example.net. [email protected]. 2012010117 14400 3600 604800 14400 ~
example.net.      +14400    ns     ns1.example.net. ~
example.net.      +14400    ns     ns2.example.net. ~
ns1.example.net.  +14400    a ~
ns2.example.net.  +14400    a ~
example.net.      +14400    a ~
www.example.net.  +14400    a ~
example.net.      +14400    mx     10 mail.example.net. ~
test.example.net. +14400    a ~


restart maradns service

# service maradns restart

dig test ::

Try query dns from other computer that exist on lan.

# dig @ test.example.net

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.6 <<>> @ test.example.net
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19886
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;test.example.net.        IN    A

test.example.net.    14400    IN    A

;; Query time: 0 msec
;; WHEN: Fri Sep 26 19:41:51 2014
;; MSG SIZE  rcvd: 53


The rest is change /etc/resolv.conf and add as nameserver.

In case of blocked port 53 :

# iptables -I INPUT -p udp -m udp --dport 53 -j ACCEPT
# service iptables save
# service iptables restart