Network: constant activity, why ??

Thilo Six T.Six at gmx.de
Sun Aug 27 11:11:27 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Vincent Trouilliez wrote the following on 27.08.2006 01:19:
<snip>
> The thread about sluggish DNS was interesting, as it might explain why
> recently, it always takes a few seconds before I can connect to any
> site ! 30Mbps won't be of any benefit for surfing, if the DNS is
> slow !!! :-/ :-(((
> 
> --
> Vince
> 

Here is a copy of a mail i´ve sent to this list some time ago:
_________________________________________________________________

Hello

I have found a good way to increase the online speed by accident.
Probably some of you already know it, but others like me do not.
dnsmasq is a small Nameserver (with DHCP functionality which is not used
here).

How does it improve online speed?
Well it works as a local DNS cache. Therefor not every DNS lookup that
is needed during surfing, or anywere else in your machine is needed to
be send out to upstream DNS.
Have a look here:

WITHOUT dnsmasq:
$ dig google.com

<snip>

;; Query time: 21 msec
              ^^^^



WITH dnsmasq:
$ dig google.com

<snip>

;; Query time: 1 msec
              ^^^


That doesn?t sound much. 20msec
But this is only one request, during surfing you do a lot of this.

The advantages are:
	- faster name resolution
	- less stress on upstream DNS

Here I received a reasonable speed advantage with dnsmasq during surfing.

What needs to be done, if your interrested?

1. install it
$ sudo aptitude install dnsmasq

2. make a copy of your current resolv.conf, which is later used by
   dnsmasq for upstream DNS requests
$ sudo cp /etc/resolv.conf /etc/dnsmasq.resolv.conf

3. change dnsmasq´s config
$ sudo nano -w /etc/dnsmasq.conf

(of course you can use the editor of your choice here)   ;)

in /etc/dnsmasq.conf i have changed this:

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
resolv-file=/etc/dnsmasq.resolv.conf

- ------------------------------------------------------------------

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
#interface=lo
# Or you can specify which interface _not_ to listen on
except-interface=ppp0
except-interface=eth0
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
listen-address=127.0.0.1
# If you want dnsmasq to provide only DNS service on an interface,
# configure it as shown above, and then use the following line to
# disable DHCP on it.
no-dhcp-interface=ppp0
no-dhcp-interface=eth0

- ------------------------------------------------------------------

This will bind [hehe bind not bind] dnsmasq to only local requests.
This is for the security of your system.


# Set the cachesize here.
cache-size=240

Default here is 150 but i have enough memory.


OK that´s the config for dnsmasq. Easy isn´t it?   ;)


4. restart dnsmasq to take into account the new config
$ sudo /etc/init.d/dnsmasq restart

5. make sure all DNS request go through dnsmasq
$ sudo nano -w /etc/resolv.conf

it should only contain this line:
nameserver 127.0.0.1

You probably could leave other nameservers below this line, but i am not
sure if they are used serial for top to bottom or randomly.

6. make sure our modified /etc/resolv.conf does not get changed by other
   programms
at this point YMMV. I have ADSL with pppoe here. If you use DHCP or ippp
you should check to prevent them to change /etc/resolv.conf.
With pppoe it is in:

$ sudo nano -w /etc/ppp/peers/dsl-provider
change the line:
usepeerdns
to
#usepeerdns

If you are using an ext2 or ext3 filesystem and dhcp. open your
/etc/resolv.conf and set valid DNS-servers, as above. Now save the file.
Lock it with:

sudo chattr +i /etc/resolv.conf

from a terminal. This will permanently lock your DNS-values.
(to unlock, use chattr -i)




OK that´s it. :D
The changes take into account immediately.
_________________________________________________________________

HTH Thilo
- --
i am on Ubuntu 2.6 KDE
- - some friend of mine

gpg key: Ox4A411E09

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE8X3dgkdHiUpBHgkRAwFkAKDI0qPvC+i4RV08UmiTWwk51EtvZACgnDbp
v2exNTwd2RIFE5zxLCpKQWw=
=BMsS
-----END PGP SIGNATURE-----





More information about the ubuntu-users mailing list