Friday, 23 October 2015

TinyDNS & DNSCache Installation in Linux

Reference : http://www.slideshare.net/yonitg/tinydns-and-dnscache

#yum install gcc make
#cd /usr/local/src
#wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
#wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
#wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
#tar xzvf daemontools-0.76.tar.gz
#cd admin/daemontools-0.76/
#./package/install
-----------------------------
@@Note@@
Error:
@@At this point the script will stop with error message as "
/usr/bin/ld: errno: TLS definition in /lib64/libc.so.6 section .tbss mismatches non-TLS reference in envdir.o
/lib64/libc.so.6: could not read symbols: Bad value
collect2: ld returned 1 exit status

Solution:
@@Run the below command to fix it and run again ./package/install@@
#echo gcc -O2 -include /usr/include/errno.h > compile/conf-cc
./package/install
------------------------------
#cd /usr/local/src
#tar xzvf ucspi-tcp-0.88.tar.gz
#cd ucspi-tcp-0.88
#echo gcc -O2 -include /usr/include/errno.h > conf-cc
#make
#make setup check

#cd /usr/local/src
#tar xzvf djbdns-1.05.tar.gz
#cd djbdns-1.05
#echo gcc -O2 -include /usr/include/errno.h > conf-cc
#make
#make setup check

#cd /usr/local/src
#useradd -d /dev/null -s /bin/false dnscache
#useradd -d /dev/null -s /bin/false dnslog
##create the dnscache:
#dnscache-conf dnscache dnslog /etc/dnscache 10.1.14.83
##create the acl for the server (who can query):
#touch /etc/dnscache/root/ip/10.1
#touch /etc/dnscache/root/ip/10.2
#touch /etc/dnscache/root/ip/172.1
##create the link for the daemon tools to start the service
#ln -sf /etc/dnscache /service/dnscache
useradd -d /dev/null -s /bin/false tinydns
useradd -d /dev/null -s /bin/false tinylog
##create the server
tinydns-conf tinydns tinylog /etc/tinydns 127.0.0.1
cd /etc/tinydns/root/
init q
ln -sf /etc/tinydns /service/tinydns

#vim /etc/init/daemontools.conf
#Add below lines then save and close
# daemontools

start on runlevel [2345]

stop on runlevel [016]

respawn

exec /usr/local/bin/svscanboot




:wq


Run below command to start the dameontools
#initctl start daemontools


cp /etc/tinydns/root/data /root/bkp/data_Orig
vim /etc/tinydns/root/data
#SOA
.gai.net:10.1.14.83:a:259200

#PTR
.1.10.in-addr.arpa:10.1.14.83:a:259200
.2.10.in-addr.arpa:10.1.14.83:a:259200
.1.172.in-addr.arpa:10.1.14.83:a:259200

=sys-0001.gai.net:10.1.6.81:86400
=sys-0002.gai.net:10.1.6.82:86400
=sys-0003.gai.net:10.1.6.91:86400
=sys-0004.gai.net:10.1.6.92:86400

:wq

cd /etc/tinydns/root/
make ; svc -t /service/*

##Create below files

#vim /etc/dnscache/env/CACHESIZE
#change the value to 7000000

#vim /etc/dnscache/env/DATALIMIT
#change the value to 10485760

#vim /etc/dnscache/root/servers/1.10.in-addr.arpa
127.0.0.1

#vim /etc/dnscache/root/servers/2.10.in-addr.arpa
127.0.0.1

#vim /etc/dnscache/root/servers/gai.net
127.0.0.1

#vim /etc/dnscache/root/servers/@
203.145.184.13
8.8.8.8
8.8.4.4
180.151.151.152

cd /etc/tinydns/root/
make ; svc -t /service/*

#Now change the nameserver ip to 10.1.14.83 and ping the local machine sys-0001.gai.net (it should give ip as 10.1.6.81)