Dear Friends,
I came to know about namebench tool while working on a setup of DNS server, test results showed some servers working pretty fast. After investigating different options and many tests i managed to keep a good rank of DNS slave server. The idea was to keep checking available fastest DNS servers in the region and modify named.conf accordingly.
As many of us are not building a DNS server, I am not going to discuss it in details here, however in case you are using some flavour of GNU/Linux, UNIX you can use following method to have a faster internet experience.
To have it accomplished we are going to use namebench, cron and a small script. namebench looks for the fastest DNS (Domain Name System) servers accessible to your computer.
Namebench can be downloaded from
http://code.google.com/p/namebench/downloads/list
- Become root.
- mkdir /usr/local/fastdns
- cd /usr/local/fastdns
- Download namebench:
wget 'http://namebench.googlecode.com/files/namebench-1.3.1-source.tgz'
- tar zxf namebench-1.3.1-source.tgz
- mv namebench-1.3.1 namebench
- create a small script fastme.sh, using your fav text editor.
Code:
#!/bin/bash
#script to detect fastest DNS servers in reach
#and modify /etc/resolv.conf accordingly
DIR_SRC=/usr/local/fastdns/namebench
BASE_DIR=/usr/local/fastdns
TMPDIR=/usr/local/fastdns/tmp
export TMPDIR
cd $DIR_SRC
./namebench.py | tee $BASE_DIR/checking.txt
if [ "$?" -ne 0 ] ; then
echo "issue with running namebench...aborting"
exit
fi
#take a backup of existing resolv.conf
cp -p /etc/resolv.conf $BASE_DIR/
grep -A4 Recomm $BASE_DIR/checking.txt | grep name | tee /tmp/new-resolv.conf
grep nameserver /tmp/new-resolv.conf
if [ $? -eq 0 ] ;then
cat /tmp/new-resolv.conf > /etc/resolv.conf
fi
rm -rf $TMPDIR/name*
- Do a chmod
chmod 755 fastme.sh
- Add this script to get executed every 4 hours.
Another similar approach is used for modifying forwarders in named.conf which resulted in one of the fastest DNS server in the region, let me know if you want to know how.
Method here is just an idea, use at your own risk.
Suggest if you have some better idea :-)
all flames >/dev/null 2>&1
Thanks & Regards,
Anuj Singh