+ Reply to Thread
Results 1 to 10 of 10

Thread: Speeding up your internet connection under Linux and Windows (Setting up DNS caching)

  1. #1
    fierce's Avatar
    fierce is offline x10 Sophmore fierce is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Macedonia
    Posts
    222

    Talking Speeding up your internet connection under Linux and Windows (Setting up DNS caching)

    Speeding up your internet connection under Linux and Windows
    (Setting up DNS caching)


    www.example.com is used as a non-existent site, as an exemple
    1 Good old dry theory
    1.1 Introduction
    The internet is going thru an evolution, faster pc's, more reliable connections etc... But the greatest evolution are the capacity of the lines. What where telephone line are now ISDN lines or cable modems. But there are still people (unfortunate people like me) who have such a sloppy telephone line, which is sloooooow. So people are beginning to search ways to speed up their connection. Their are tools like download managers, tools that download the underlying pages of a visited web site in idle times. And so there are many ways that go to adjusting the hardware of your modem.

    Like you all see the software is either Windows based or lets you **** up your hardware. This way is for Linux and is so easy a Windows user could do it
    There is also an explanation on how to do the exact same thing under Windows
    1.2 Who should be reading this document, requirements
    Everyone who wants to speed up their (modem) dial-up account by some seconds. And want to do this in five minutes (if not less).

    Before asking any questions, please make sure you have read at least the basic networking tutorials at blacksun.box.sk.
    If you still have questions regarding this tutorial, please make sure you've already read at least some of the basic networking tutorials at blacksun.box.sk. Also, please do not Email any member of BSRF directly. There is a message board at blacksun.box.sk - use it.

    Information on how to do the same thing under Windows can be found at the bottom of the tutorial.

    Requirements

    * A computer
    * A dial-up connection to the internet
    * Linux up and running
    * Named installed (1)
    * 5 minutes of time
    * Some spare change for me (*grin*)

    (1) Named is a the nameserver package, this is standard and the most commone Linux distrubution and should bring no problems while installing
    1.3 What does a nameserver do?
    What does a nameserver do ? Well, suppose you are dialed in with you ISP and you wish to go to www.example.com. You open up you browser and type in the URL box http://www.example.com, you press enter and wait until xxxxx appears.
    Simple, isn't it ? Let's look behind the scenes to find out what's really going on in here.

    1. Your computer gets the request to connect to www.example.com, but what is www.example.com ? Well it the alias of a computer (which has an ip) and has an httpd daemon running (on port 80).
    2. Your computers checks if that site isn't running on your own computer or on you local network. So it checks your /etc/hosts file (which has you local intranet information) or it checks a local nameserver (but because you're reading this I guess you don't have a nameserver installed (yet) so that won't be the case). By the way, this is a good chance to mention that DNS stands for Domain Name server.
    3. In fact your computer doesn't check if www.example.com is on your local network, it checks if it can find the ip of www.example.com on you local intranet. (You 'might' have heard once that the entire internet is tcp/ip based )
    4. Then your computer checks the file /etc/resolv.conf file should look like this.


    nameserver 123.123.123.123
    5. This is the nameserver of you ISP. And when nothing can be found on the local intranet you computer will query this nameserver. (if this nameserver is unreachable the you'll get an error).
    6. When this nameserver is reachable it will answer with an ip. If www.example.com is unknown to the nameserver it will query some other nameserver. But in the end you'll get your ip.
    7. Once this ip (lets say 123.123.123.111) is known there will be tried to establish a connection to 123.123.123.111:80 (this connection will be made by the standard routing procedure as can be viewed by typing route from a root shell.

    Now the communication will be established, files will be transferd using the http protocol. So the nameserver simply translates www.example.com into an ip by quering its own databases or querying other databases.
    1.4 Whooow that sounds very cool !!! So ? :p
    Well suppose those seven steps take about 2 seconds (if you have a speedy connection and your ISP has a nameserver with almost no network traffic and if the ip is in the nameservers cache). So if this was an utopia it would take two seconds. So in these times it'll take a bit longer. In this tutorial we'll make something called 'a caching only nameserver'.
    1.5 What is a caching only nameserver
    Well, this is a special 'type' of nameserver. This is not intended to be the nameserver of your intranet. The only thing it does is to cache all names and ip's that are queried from the local network. The first time you query an ip, an other database has to be queried (isp). But any other time that query does not have to find place. It is on you own hard disk, so it doesn't consume any bandwidth, and site will come up some seconds faster on your screen which makes surfing a lot more FUN. You can say now what the hell are two seconds? Yes but how often do you go to a search engine ? How often do you go to you favorite site and further, how often doe you check your e-mail ? (once every 10 minutes is a Netscape default)

    Here ends the theory, now you should be able to understand what a caching only nameserver does and how it can speed up you connection with a few seconds, now go ahead and type something.
    2 **** that damned theory, let me type something
    2.1 named.conf
    First we edit the general config file of the nameserver. The file is called /etc/named.conf and it should look like:

    options {
    directory "/var/named";
    /* Some **** */
    };
    ....

    This first part of the file is the one that needs changes. For this you need to know the nameserver of your ISP (NOT the name but the IP !!!), you change the file to:

    options {
    directory "/var/named";
    forwarders {
    123.123.123.123;
    123.123.123.124;
    };
    };
    ....

    You've now simple said that an unknown query has to be forwarded to the ip's above. If the first is not reachable the second one will be tried.
    2.2 Changing the nameserver
    In fact you have now an up and (almost) running nameserver. There is just one little detail you have to take care of, that's the fact that your computer doesn't recognize / will use you nameserver yet. You have to edit /etc/resolv.conf . And you should edit the file so it'll look like:

    # nameserver 321.321.321.321
    nameserver 127.0.0.1

    The first line was your original nameserver, just comment this (you never know ...) and then you add the line nameserver 127.0.0.1 this just says that queries no longer have to be forwarded but can be answered by you OWN local nameserver.
    2.3 Up and running
    Now you just have to (re)start your nameserver with killall -HUP named . Then you check you logs ( /var/log/messages ) and hope they'll look like

    Nov 20 13:29:34 SaTaN named[692]: starting. named 8.2.1 Fri Sep 24 14:52:24 EDT 1999 ^Iroot@porky.devel.redhat.com:/usr/src/bs/BUILD/bind-8.2.1/src/bin/named
    Nov 20 13:29:34 SaTaN named[692]: hint zone "" (IN) loaded (serial 0)
    Nov 20 13:29:34 SaTaN named[692]: Zone "0.0.127.in-addr.arpa" (file named.local): No default TTL set using SOA minimum instead
    Nov 20 13:29:34 SaTaN named[692]: master zone "0.0.127.in-addr.arpa" (IN) loaded (serial 1997022700)
    Nov 20 13:29:34 SaTaN named[692]: listening on [127.0.0.1].53 (lo)
    Nov 20 13:29:34 SaTaN named[692]: listening on [10.0.0.1].53 (eth0)
    Nov 20 13:29:34 SaTaN named[692]: Forwarding source address is [0.0.0.0].1025
    Nov 20 13:29:34 SaTaN named: named startup succeeded
    Nov 20 13:29:34 SaTaN named[693]: Ready to answer queries.
    Nov 20 13:29:34 SaTaN named[693]: sysquery: sendto([123.123.123.123].53): Network is unreachable

    If you see a last line, like mine, don't worry about it. It means you are not yet connected to the internet. When you get some erros, it means that you have not edited you config file properly so you have check it again. (hint: check if all the ; are in place and every { is closed with an } )
    2.4 U don't believe me ?
    Ok, for everyone who doesn't believe me ...

    [root@SaTaN /] nslookup www.iwanttoquerythis.com
    Server: localhost
    Address: 127.0.0.1

    Name: www.iwanttoquerythis.com
    Address: 123.123.123.321 ... other ip's ..
    Aliases: If available ...

    This was the first query and a request was sent to the nameserver mentioned in the config file. For this far you know you nameserver can forward addresses :p it's a start.

    [root@SaTaN /] nslookup www.iwanttoquerythis.com
    Server: localhost
    Address: 127.0.0.1

    NON-AUTHORITIVE ANSWER
    Name: www.iwanttoquerythis.com
    Address: 123.123.123.321
    Aliases: ...

    Cool, it says Non-authoritive answer. What does it means ? Well, it just wants to say that for that answer there was no need to forward the request, cool huh ?
    Last edited by compwhizii; 12-08-2008 at 04:28 PM. Reason: Chaning links to example.com
    If my post has helped ya or ya like my jokes hit the +REP button ;)
    http://www.eraoferadication.co.cc

    HTML Code:
    http://forums.x10hosting.com/marketplace/85707-req-1000-credits-4-exchange.html

  2. #2
    fierce's Avatar
    fierce is offline x10 Sophmore fierce is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Macedonia
    Posts
    222

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    2.5 And here's another way to do it
    You can also manage your local DNS database by yourself! Simply add lines to the /etc/hosts file that will look like this:
    IP-address hostname #comment
    For example:
    1.2.3.4 www.some-website.com #just another stupid website
    In case you're wondering, you don't HAVE to put a comment... :p
    Oh, by the way, this method is inferior because you have to enter IPs and hostnames by yourself... ouch...

    2.6 Local DNS cache under Windows
    Hello, poor Windows users. Want to make yourself a nice local DNS cache? Too bad, 'cause you can only use the method described in chapter 2.5, only you will be using c:\windows\hosts (not to be confused with c:\windows\hosts.sam, which is a sample file for c:\windows\hosts) instead of /etc/hosts. If you don't wanna do this manually, you could try and find a program called FastNet, which will scan your browser's bookmarks and history database and automatically add every URL you visit to this database, and will also let you add entries manually.
    3. The end
    If my post has helped ya or ya like my jokes hit the +REP button ;)
    http://www.eraoferadication.co.cc

    HTML Code:
    http://forums.x10hosting.com/marketplace/85707-req-1000-credits-4-exchange.html

  3. #3
    tittat's Avatar
    tittat is offline x10 Spammer tittat is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Kerala,India
    Posts
    2,479

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    ***** Thread Moved to Tutorials****
    PLAY ONLINE GAMES
    WWW.TMONDO.COM PlayFar Flash Games
    Former X10 Forum Senior Moderator(Retired)


  4. #4
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    Thanks for the tutorial
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

  5. #5
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    ...

    xxxxxx.com is a pornography site.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  6. #6
    compwhizii is offline Banned compwhizii is an unknown quantity at this point
    Join Date
    May 2008
    Location
    The Moon
    Posts
    779

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    I hope it was an example

    None the less I've changed it to example.com

  7. #7
    fierce's Avatar
    fierce is offline x10 Sophmore fierce is an unknown quantity at this point
    Join Date
    Jul 2008
    Location
    Macedonia
    Posts
    222

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    Quote Originally Posted by leafypiggy View Post
    ...

    xxxxxx.com is a pornography site.
    i didn't know that b4 this post ..since i'm that fun of that stuff,it was just example,I will edit it with other link...still I hope it helps you .

    - fierce .
    Edit:
    Quote Originally Posted by compwhizii View Post
    I hope it was an example

    None the less I've changed it to example.com
    thx 4 changin' it .. I got ashamed:ohnoes: and I only wanted to help .
    Last edited by fierce; 12-09-2008 at 06:28 AM. Reason: Automerged Doublepost
    If my post has helped ya or ya like my jokes hit the +REP button ;)
    http://www.eraoferadication.co.cc

    HTML Code:
    http://forums.x10hosting.com/marketplace/85707-req-1000-credits-4-exchange.html

  8. #8
    compwhizii is offline Banned compwhizii is an unknown quantity at this point
    Join Date
    May 2008
    Location
    The Moon
    Posts
    779

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    No problem, I understand it was an accident.

  9. #9
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    Thanks, very helpful
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  10. #10
    khaledphp is offline Guest khaledphp is an unknown quantity at this point
    Join Date
    Dec 2008
    Posts
    29

    Re: Speeding up your internet connection under Linux and Windows (Setting up DNS cach

    thank you great !!

+ Reply to Thread

Similar Threads

  1. Windows or Linux?
    By Pyker in forum Computers & Technology
    Replies: 139
    Last Post: 11-25-2011, 12:00 PM
  2. Linux vs. Windows - Web server market share
    By scorch94 in forum Computers & Technology
    Replies: 3
    Last Post: 08-23-2008, 12:42 PM
  3. Is Windows A Virus?
    By Akkarin in forum Off Topic
    Replies: 54
    Last Post: 05-10-2008, 08:56 PM
  4. Linux Or Windows
    By thezone1 in forum Crossfire
    Replies: 3
    Last Post: 10-27-2007, 11:51 AM
  5. 5 Razones Por Las Cuales NUNCA Debes Usar Linux.
    By KainAngel in forum General
    Replies: 6
    Last Post: 02-03-2007, 12:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers