Jun 23

wvdial and resolv.conf fileDo you use wvdial and want to set custom DNS, but find that even though you put your DNS address in ‘/etc/resolv.conf’, wvdial always uses the ones provided by your ISP and your entries in the file are dynamically overwritten.

So how do make your entries stick and get used. There are two setting which are required to be changed, you require root previlages to do the changes.
[1] The first one is in the file ‘/etc/wvdial.conf’ , in this file if there is an entry for ‘Auto DNS’, change it to below else add the below line:
Auto DNS = 0

[2] In the file ‘/etc/ppp/peers/wvdial’, either comment (#) or remove the following line:
usepeerdns

Next time you connect using wvdial it should be using the servers mentioned in your ‘/etc/resolv.conf’ file.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • digg
  • Reddit
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Spurl
  • Furl
  • Simpy
Jun 20

IMG : Local DNS Cache TutorialIf you are facing slow connections and slow browsing experience, then you can speed up your browsing by a small factor by caching your DNS queries locally and using it.

But before you go ahead the first question that would surely pop up in your mind is what is this DNS? And what does it do? To answer the first question I would take a simple example of your mobile phone, when you want to call your friends, you first find their name in the contacts and click on dial. You could have directly entered their number and dialled, but remembering a few numbers is possible but not all, hence you store them as contacts in your phone.

In the Internet too we have the same concept each site has an IP address which is nothing but a set of numbers, but it would be very difficult to remember the numbers for each site, so we have a DNS server which basically takes the site name and gives back the IP address for the site.

But why cache it locally? The answer is simple, there are a set of sites you would visit regularly and it takes a few milliseconds to get the IP address, so why not store it the first time it is got and use that the next time you visit the same site again. A few milliseconds may not seem a long time, but when on a slow connection it does make a difference and ultimately result in faster browsing experience.

So in Linux we have a simple light weight program ‘dnsmasq’. The steps mention here are applicable to all Linux Distributions, the only exception being the first step to install the software for which you can use your distributions software installed to install the program. I am using Linux Mint, which is based on Ubuntu so the steps are specific to it.

Follow the following steps to install and get ‘dnsmasq’ running, please note that in the below ’sudo gedit’ is entered in the terminal to open the gedit editor with root previliges, you can use any other editor such as vim. ’sudo’ may not work in all distributions in which case you can just issue ’su’ command and for each of the ’sudo gedit’ you can just run ‘gedit’:

Steps:

  • In Ubunutu/Mint you could just give the below command to install ‘dnsmasq’:
    sudo apt-get install dnsmasq

  • The next step is editing the file ‘/etc/dnsmasq.conf’, you need root previliges to edit this file. In the terminal you can issue the following command:
    sudo gedit /etc/dnsmasq.conf

  • Find the following string in the file:
    #listen-address=

  • Now remove the ‘#’ at the starting, and change it to the below string:
    listen-address=127.0.0.1

  • Save and close ‘/etc/dnsasq.conf’
  • Next you need to edit the file ‘/etc/dhcp3/dhclient.conf’, issue the following command
    sudo gedit /etc/dhcp3/dhclient.conf

  • Search for ‘prepend domain-name-servers’ in the opened file, and change it to below and remove any ‘#’ character if present at the start of the line.
    prepend domain-name-servers 127.0.0.1;

  • Save and close ‘/etc/dhcp3/dhclient.conf’
  • Next you need to edit the file ‘/etc/resolv.conf’, issue the following command to open it:
    sudo gedit ‘/etc/resolv.conf’

  • Add the following to the start of the file:
    nameserver 127.0.0.1

  • Your other DNS servers should come after the above line, for example my file is as below (I use OpenDNS):
    nameserver 127.0.0.1
    nameserver 208.67.222.222
    nameserver 208.67.220.220

Thats it, your local DNS caching server is set up and ready for use, you can issue the following command to restart the ‘dnsmasq’ program:
sudo /etc/init.d/dnsmasq restart

In case you want to test if your queries are actually hitting the local DNS cache, issue the below command a couple of time, you can yourself see the difference it the resolution time:
dig nithinkamath.info

The output is as below, important things to note is the ‘Query time’ and ‘SERVER’, since I had already visited ‘nithinkamath.info’ it gives 0msec:
; < <>> DiG 9.5.1-P2 < <>> nithinkamath.info
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37197
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;nithinkamath.info. IN A

;; ANSWER SECTION:
nithinkamath.info. 9894 IN A 69.73.144.233

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sat Jun 20 12:30:49 2009
;; MSG SIZE rcvd: 51

If you are still facing any issue, let me know by leaving a comment below.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • digg
  • Reddit
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Spurl
  • Furl
  • Simpy
Apr 15

Using a CDMA USB modem with max speed of 144kbps is slow compared to having a broadband connection. There are times where everything so slow and nothing seems to load, at such time I always wonder if some activity is happening at all, sometimes thunderbird would be downloading the mails hence firefox takes time to load the pages, would it not be wonderful to have a traffic monitor which would show the upload and download speeds at that moment.

The traffic monitor applet for GNOME ‘netspeed’ provides just what I wanted, it shows the network traffic in Bytes or Bits per second (this can be set using the preference menu of the applet).

The netspeed applet updates the activity every N milliseconds, where N can be set to any value, I have set it to 1000, so it would update every second. This applet being in the gnome panel makes it easy to view and notice the network activity. There are a few customisation options which are available in the preferences, which could be used as per need so I would not discuss further on this, it is upto the user to explore.

To add the ‘netspeed’ applet to your gnome panel, right clicking on the panel and choose ‘Add to Panel’ option and in the list choose ‘netspeed’.

If ‘netspeed’ does not appear in the list then you would have to install it using the package manager provided by your distribution. For example in Ubunutu one could use Synaptic to install this applet.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • digg
  • Reddit
  • del.icio.us
  • YahooMyWeb
  • co.mments
  • Spurl
  • Furl
  • Simpy