|
DJB-DNS HOWTO FOR UBUNTU SERVER EDITION 8.04/8.10/9.04
What I have done in this howto?
I have googled and took several references from several sites/tutorials and re-written them as a step-by-step guide/howto.
If you find any mistakes/errors in this howto, please mail me.
My special thanks goes to all peoples of open-source world.
Last updated: October 15, 2009 by Rezaul Karim (rkarim@linux-bd.com)
STEP-01: Install Ubuntu Server Edition 8.04/8.10/9.04
Install Ubuntu Server Edition 8.04/8.10/9.04 (32bit/64bit) On a particular server/pc which will be your gateway+proxy ( See my gw+proxy howto) server along with (this howto) Caching Only DNS
Server.
Installation Requirements:
There is no special requirements while you install the Ubuntu Server Edition for DNS Server only, if you use the same server as
Gateway+Proxy server; See my this howto. You must have to internet
connection to this server to complete this howto.
STEP-02: Put/Ensure the IP addresses are correctly put in the Ethernet Interfaces.
Make sure that you put the IP addresses on Ethernet Interface properly and you are getting internet connection to this server. If you use this server as caching-dns-server only then you have to put only WAN (primary) interface ip or if this server also your Gateway/Proxy server then you also have to put LAN (secondary) interface IP. Otherwise skip Secondary IP portion in this howto.
I suppose (use your own IP address as require), you have put 123.49.42.180 (eth0) to your WAN Interface, and 192.168.100.1 (eth1) to your LAN Interface.
Here IP:123.49.42.180 will be your caching-dns-server and IP:192.168.100.1 will be your local network interface. Your local network
192.168.100.0/24 will use this (IP:123.49.42.180) caching-dns-server as their dns-server-address.
Note: Always Open the terminal become the root (sudo su / su) and apply your commands used in this howto.
# vi /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 123.49.42.180
netmask 255.255.255.224
network 123.49.42.160
broadcast 123.49.42.191
gateway 123.49.42.161
# The secondary network interface
auto eth1
iface eth1 inet static
address 192.168.100.1
netmask 255.255.255.0
network 192.168.100.0
broadcast 192.168.100.255
Save + Exit
apply the following commands ;
# /etc/init.d/networking restart
# apt-get update
# apt-get upgrade (apt-get upgrade is optional)
# apt-get -q -y install build-essential rcconf vim-nox iftop
STEP-03: Download the packages
apply the following commands ;
# cd /opt
# wget -c http://www.linux-bd.com/app/djbdns-install.tar.gz
# tar zxvf djbdns-install.tar.gz
STEP-04: INSTALL UCSIP-TCP
apply the following commands ;
# cd /opt/djbdns-install
# tar zxvf ucspi-tcp-0.88.tar.gz
# cd ucspi-tcp-0.88
# patch -p1 < /opt/djbdns-install/patches/ucspi-tcp-0.88.errno.patch
# make
# make setup check
STEP-05: INSTALL DAEMON-TOOLS
apply the following commands ;
# cd /opt/djbdns-install
# tar zxvf daemontools-0.76.tar.gz
# cd admin/daemontools-0.76/
# touch /etc/inittab
# patch -p1 < /opt/djbdns-install/patches/daemontools-0.76.errno.patch
# package/install
STEP-06: Fixing of the inittab
apply the following commands ;
# vim /etc/event.d/svscan (write the following lines in the file;)
# svscan - daemontools
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on runlevel 0
stop on runlevel 1
stop on runlevel 6
respawn
exec /command/svscanboot
Save + Exit
apply the following commands ;
# cd /command
# rm -rf *
# cp /opt/djbdns-install/admin/daemontools/command/* /command/
# initctl start svscan
STEP-07: Installing djb-dns itself
apply the following commands ;
# cd /opt/djbdns-install
# tar zxvf djbdns-1.05.tar.gz
# cp djpatch.sh djbdns-1.05/
# cd djbdns-1.05
# chmod 755 djpatch.sh
# ./djpatch.sh
# make
# make setup check
add Essendtial Users/Groups ;
# adduser --no-create-home --disabled-login --shell /bin/false dnscache
# adduser --no-create-home --disabled-login --shell /bin/false dnslog
# adduser --no-create-home --disabled-login --shell /bin/false tinydns
STEP-08: System Configuration to run DJB-DNS
apply the following commands ;
# mkdir /var/lib/svscan
# dnscache-conf dnscache dnslog /var/lib/svscan/dnscache 123.49.42.180
# ln -sf /var/lib/svscan/dnscache /service
# touch /var/lib/svscan/dnscache/root/ip/127.0.0.1
# touch /var/lib/svscan/dnscache/root/ip/192.168.100
(put your local lan subnet to allow dns query)
# touch /var/lib/svscan/dnscache/root/ip/123.49.42
(put more subnet same way to allow dns query)
# cd /var/lib/svscan/dnscache/env
# echo "10000000" > CACHESIZE
# echo "30000000" > DATALIMIT
# chmod 755 /opt/djbdns-install/patches/dnsroots-update
# /opt/djbdns-install/patches/dnsroots-update > /etc/dnsroot.global
# svc -t /service/dnscache (to restart the djb-dns service)
# svc -h /service/dnscache (to reload the djb-dns service)
# svc -d /service/dnscache (to stop the djb-dns service)
# svc -u /service/dnscache (to start the djb-dns service)
# tail -f /var/lib/svscan/dnscache/log/main/current (to view the log)
STEP-09: Test your setup (djb-dns server) from server itself
Open the file /etc/resolv.conf and put the following dns only
# vim /etc/resolv.conf (write the following line in the file;)
nameserver 123.49.42.180
Save + Exit
Now, nslookup any domain name like yahoo.com or google.com and you should see the output if all setup are OK. If you see proper output then go to next step and test your dns-server from local subnet (192.168.100.0/24)
STEP-10: Test your djb-dns server from local pc/net
Now, go to any local pc which might have ip address like 192.168.100.x and put the dns address 123.49.42.180 and try to browse the Internet; It should work properly.
|