When in your browser, type the address of a page such as linux-software-news-tutorials.blogspot.com and press "Enter", your machine is connected to a DNS server, And asks what IP address is linux-software-news-tutorials.blogspot.com?. Then the DNS server will reply: 11.11.11.111
You can also ask the DNS server for this open the terminal and write:
You can also ask the DNS server for this open the terminal and write:
ping linux-software-news-tutorials.blogspot.comNow let the subject matter, to understand the reason for the acceleration.
Every time you enter the page linux-software-news-tutorials.blogspot.com, questions to the DNS server which is the IP address. But even more to say, if the page is images that are not located on the same server (which is most common), then more of the same. But normally, the pages do not change IP, then, that you want to ask, learn it by heart and in this way is faster. Well here is where dnsmasq. Dnsmasq is a server (DNS, DHCP) very light also is expected to act as a DNS server, cache it, that is pairs of values saves address - IP, to avoid having to repeat the query again, this time saving .
Before going further, try running the following command twice:
Before going further, try running the following command twice:
dig madrid.salir.com | grep "Query time"
see that the first can give you around 150 milliseconds and the second around 50 milliseconds. This depends on the DNS server you have configured, as I indicated earlier. I for example I have set Google's DNS servers so that the response rate is 1 millisecond. As I already said that this is not so concerned
The issue is that approximately question, you can save about 50 milliseconds, if over 20 it is already a second that is good thing.
The issue is that approximately question, you can save about 50 milliseconds, if over 20 it is already a second that is good thing.
Installation and configuration:
Installation
The installation is simple, since dnsmasq is in the Ubuntu repositories, so to install it, simply clicking dnsmasq or in a terminal:
sudo apt-get install dnsmasqConfiguration
Configuration is also very simple. At the Ubuntu menu> Preferences> Network Connections
Select the network you use. If you use more, you have to do in several. And you click the Edit button
Select the network you use. If you use more, you have to do in several. And you click the Edit button
In the window that appears you go to the tab "IPv4 settings" (that until we change to IPv6). Now you have to do two steps:
- Select as a method: Only automatic address (DHCP)
- DNS servers 127.0.0.1, 8.8.8.8, 8.8.4.4
The 127.0.0.1 is for dnsmasq, and the other two (8.8.8.8 and 8.8.4.4) are the Google's DNS serversThat solve very quickly. You can also use other, that it is your choice.
The final configuration step is to restart the service:
The final configuration step is to restart the service:
sudo service network-manager restart
Now that you have installed and configured, repeats the previous test. That is, run the following command a few times:
dig madrid.salir.com | grep "Query time"
Now you'll have the second gives 0. This is because the address has been stored, and the second time has not made the query.
You see something really simple, and that does not take you long. Try it and you tell me.
You see something really simple, and that does not take you long. Try it and you tell me.
3 Comments
Excellent tutorial. – Raymond, Éire.
ReplyDeleteThanks for step-by-step, easy and simple steps guide for DNS, Ubuntu installation and configuration. How to proceed with Subversion in Ubuntu??
ReplyDeleteall tutorials for you always great and pulls attention
ReplyDeletethank you