LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-27-2011, 01:44 AM   #1
xxx_anuj_xxx
Member
 
Registered: Jun 2004
Location: Bharat
Distribution: RedHat, Debian, FreeBSD, Fedora, Centos
Posts: 114

Rep: Reputation: 16
Lightbulb script for a faster internet experience.


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
  1. Become root.
  2. mkdir /usr/local/fastdns
  3. cd /usr/local/fastdns
  4. Download namebench:
    wget 'http://namebench.googlecode.com/files/namebench-1.3.1-source.tgz'
  5. tar zxf namebench-1.3.1-source.tgz
  6. mv namebench-1.3.1 namebench
  7. 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*
  8. Do a chmod
    chmod 755 fastme.sh
  9. 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
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-27-2011, 04:15 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
A word of warning to those who intend to use namebench as config/hostname_reference.cfg includes not only social networking and file sharing sites but also lists gambling, pr0n and extremist web sites. Running namebench (with or without the "censorship" switch?) in access-controlled networks may result in "interesting" results if requests can be traced back to your workstation and you can be held responsible for network policy violations. Also, unless I read over it, namebench doesn't actively query your or adjacent regional ISP's or upstream for name servers: instead it relies on a static list of name servers so the result may or may not be what you want. Also note caching name servers like Pdnsd will already query name servers in parallel to speed up resolving.
 
2 members found this post helpful.
Old 02-28-2011, 09:56 AM   #3
goossen
Member
 
Registered: May 2006
Location: Bayern, Germany
Distribution: Many
Posts: 224

Rep: Reputation: 41
I don't think using an *external* DNS server will be fast than using your provider's DNS!
 
Old 02-28-2011, 01:52 PM   #4
xxx_anuj_xxx
Member
 
Registered: Jun 2004
Location: Bharat
Distribution: RedHat, Debian, FreeBSD, Fedora, Centos
Posts: 114

Original Poster
Rep: Reputation: 16
goossen:

namebench looks for the available fastest DNS server in reach by the computer, it is not always true that the providers DNS is faster.

Thanks,
Anuj
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Can Deliver A Faster Gaming Experience Than Mac OS X LXer Syndicated Linux News 0 12-11-2010 05:21 PM
A faster and safer Firefox experience tronkel Linux - Newbie 20 08-07-2010 10:08 AM
[SOLVED] make this script faster? shakazzolo Programming 19 07-14-2010 01:18 PM
[SOLVED] Looking for experience to make a script more efficient. aSingularity Programming 7 04-03-2010 01:41 AM
LXer: Why your internet experience is slow LXer Syndicated Linux News 0 05-13-2008 12:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration