edit Уреди тему

Ubuntu: Local DNS Cache for Faster Browsing

DNS сервер враћа IP адресу на основу имена домена, као такав игра врло битну улогу и његова брзина значајно утиче на брзину крстарења интернетом. Сваки интернет провајдер поседује рутер са ДНС сервером који ви контактирате приликом посете свакој страни. Време потребно том ДНС серверу да одговори на ваш захтев није велико 30–60 ms, али када се помножи са броје мстраница које дневно посетите зна да буде значајно. Формирањем локалног DNS сервера на вашем рачунару или на рачунару у вашој локалној мрежи ово време се своди на ~0ms.

Инсталирње dnsmasq-а у Ubuntu

Dnsmasq је лаган, једноставан за подешавање, DNS прослеђивач и DHCP сервер. Да би га инсталирали Universe складиште мора да буде укључено. Инсталирајте dnsmasq кроз synaptic или следећом командом:

sudo apt-get install dnsmasq

У фајлу: /etc/dnsmasq.conf пронађите ред у коме се налази:

#listen-address=

и замените га са:

listen-address=127.0.0.1

Такође у фајлу: /etc/dhcp3/dhcl­ient.conf пронађите ред:

#prepend domain-name-servers

и избришите # која се налази на почетку да изгледа овако:

prepend domain-name-servers 127.0.0.1;

In the normal case, when you get a new dhcp lease, the dhcp3 client (tool) on your computer gets a new lease, and updates the /etc/resolv.conf file on your computer with the right values for the DNS servers to use (usually some machine in the network of your hosting provider). Adding the “prepend” option as we did above ensures that “127.0.0.1″ will appear on the top of the list of DNS servers. That magic number refers to your own computer. So in the future, whenever your computer needs to resolve a domain name, it will forward that request to dnsmasq (which is running at 127.0.0.1 – your computer). If the details for the domain name are already in you cache, well and good, dnsmasq will serve it up and make the process real fast. If it is not in the cache, then dnsmasq will look at the /etc/resolv.conf file and use the nameservers listed below the “127.0.0.1?. I hope that explains things. Сада отворите фајл:

/etc/resolv.conf

у вашем омиљеном едитору. Он изгледа нешто налик овоме:

search yourisp.comnameserver 217.54.170.023nameserver 217.54.170.024nameserver 217.54.170.026

The 127.0.0.1 is missing right now since you haven’t renewed your lease after you edited the /etc/dhcp3/dhcl­ient.conf file. So, let us add that in manually this one time. After you do, your /etc/resolv.conf file will look like the following:

search yourisp.comnameserver 127.0.0.1nameserver 217.54.170.023nameserver 217.54.170.024nameserver 217.54.170.026

Now you need to restart the dnsmasq using the following command

sudo /etc/init.d/dnsmasq restart

Now you are running a local DNS cache.

Testing Your Local DNS Cache

If you want to measure your speed improvement, type the command

dig yahoo.com

You will see something like “;; Query time: 38 msec” there. Now type the command again, and you should see something like:”;; Query time: 2 msec”

Како бисте поставили Ваш коментар морате се учланити/пријавити на сајт.