Sunday, January 18, 2009

Tip to speed up your broadband

Standard Disclaimer: I do not, in any way, take responsibility for any sort of mishaps that could happen by following the tips I give on this subject. I have tried it and it worked for me. Does not necessarily mean that it would work the same for everyone. You've been forewarned!

UPDATE! Post has been updated - see end of post for changes.

Lately I'd been experiencing rather slow browsing speeds on my home broadband connection. Initially I thought that it was due to that Mediterranean cable problem that was prevalent at that time. But my problems seemed to continue past the point when that under sea cable problem was sorted out. So, I decided do dig into this a bit deeper.

The settings and results on my ADSL modem's page were fine. Nothing out of sorts, no high noise on the line. Then, I called up BSNL to have my phone line checked. Amazingly they were very prompt and came to my home, just 2 days after I'd submitted a request - they gave my phone like a clean chit too - no problems there. Then I kinda gave up on this for a few days. Browsing speed was still slow but I sort of got used to it. Then, this past saturday, my friends had come over to my place and they complained that my broadband was extremely slow and that it was significantly faster at their places. Now, this was the last straw - I had to solve this problem.

So, I sat down yesterday evening - I did all the usual checks - still no luck. One thing caught my eye during browsing - the initial DNS lookup seemed to be taking quite a while. Browser seemed to sit waiting at "Resolving host ..." for unusually long times. I checked my DNS settings - I was using 61.1.96.69 (primary DNS) and 61.1.96.71 (secondary DNS). I discovered that both these servers are dead as they did not respond to ping. Then how were the DNS lookups getting thru? Turned out that my ADSL modem itself was fetching the DNS resolves - confirmed this by nslookup (host or dig on *nix). I searched on the (still slow) internet for latest BSNL DNS servers and found 218.248.240.208 (primary DNS) and 218.248.240.135(secondary DNS). These 2 servers were not dead - they were responding for pings. I updated my DNS settings. Now the speeds seemed to be better than before. I still continued to research whether I can improve on this further. Some people on broadband forums suggested that opendns servers were better performing that our BSNL servers. I tried them out, but I could not find much difference between the two. Then, it struck me that a local DNS would be much much faster than contacting any of the external DNS servers. I wasted no further time and setup local DNS (bind or pdnsd under linux and treewalk DNS under windows) and set my DNS to be 127.0.0.1. Lo and behold, after some initial 5 minutes of browsing, speeds increased significantly!

Hence, I would recommend using of a local caching DNS server for improved broadband speeds. It takes very minimal of CPU and disk resources and its worth the effort to set it up. Treewalk DNS is just a straightforward install on windows. For bind under unix, see this for help in setting it up.

Now, let me get back and enjoy a better and more responsive online multiplayer FPS gameplay :D

## Update - Under linux, bind has been found to be rather resource hungry and a tad vulnerable to exploits. You may overcome some of these risks by running bind-chroot. But I found pdnsd to be a better substitute to bind. Its lightweight and the DNS cache works like a charm!

8 comments:

  1. There's an easier way. Use the opendns.org DNS servers.

    208.67.222.222
    208.67.220.220

    Much more reliable than BSNL dns servers, and super fast. Plus, no need for any installation.

    ReplyDelete
  2. Quoting from the post: "Some people on broadband forums suggested that opendns servers were better performing that our BSNL servers. I tried them out, but I could not find much difference between the two"

    So, I did try them out. But could not find much of a difference. I'm sure they are more reliable than our BSNL DSN servers. But the point is you can save even the little time that's spent in getting to any DNS server by having a local DNS lookup resolution.

    I have to point out here that the DNS lookup at my home was terribly slow and after I started to run my own DNS server, things really sped up. So, the results I got are relative to the situation I had before.

    ReplyDelete
  3. "Now, let me get back and enjoy a better and more responsive online multiplayer FPS gameplay :D"
    Still - all this knowledge and your router cant support more than 2 laptops connected to it...
    goes into a infinite rebooting loop :P
    All the time, I have to get my router(read - "super duper fast router") to bail us out!

    ReplyDelete
  4. Err - we're talking about broadband here and not our local LAN gameplay!

    ReplyDelete
  5. I know, but why do I care!!

    ReplyDelete
  6. absolut geekomundo :D

    ReplyDelete
  7. Naren - One particular dialogue from TBL immediately comes to my mind...
    "You're not wrong, Walter... you're just an *******"
    :D

    ReplyDelete
  8. pdnsd guide:

    1) Install pdsnd - depending on your distro, it may be rpm, apt or something else - RTFM
    2) Edit /etc/pdnsd.conf - at its simplest, it can contain:
    global {
    perm_cache=1024;
    cache_dir="/var/cache/pdnsd";
    run_as="pdnsd";
    server_ip = 127.0.0.1;
    server_port=53;
    status_ctl = on;
    paranoid=on;
    query_method=udp_tcp;
    max_ttl=1w; # One week.
    timeout=10;
    }
    server {
    label = "opendns";
    ip = 208.67.222.222, 208.67.220.220;
    timeout = 4;
    uptest = ping;
    ping_timeout = 100;
    interval = 15m;
    preset = off;
    }

    3) Save the file and start pdnsd - service pdnsd start
    4) Test lookup times using dig - first lookup can take time, but subsequent lookups should get done in 1ms or so
    5) Configure settings so that pdnsd starts up on boot
    chkconfig --level 5 pdnsd on
    chkconfig --level 3 pdnsd on (for Fedora)

    DONE!

    ReplyDelete

What I want to say is: