As speed Internet surfing with a local DNS cache with dnsmasq To speed up web browsing, speeding up the name resolution will create a local DNS cache, we will install dnsmasq DNS Server will use as our network, we can also install dnsmasq on our team and use it as a "single user"
Server Configuration apt-get install dnsmasq To avoid losing your settings of "manufacture" of dnsmasq will make a copy of the configuration file of the program
cp / etc / dnsmasq.conf / etc / dnsmasq.conf.original Edit the configuration file and we like the following example of basic configuration of dnsmasq
nano / etc / dnsmasq.conf # port that will operate the service port = 53 # this will
dnsmasq say, not to pass higher servers, # names without periods, or part domain, thus avoiding the burden # unnecessary on dns servers root. domain-needed
# This will prevent the re-shipment to the main DNS server # address space without routing bogus-priv # Size domain ip address to be stored in cache cache-size = 1000 # will use DNS to resolve names dnsmasq ; resolv-file = / etc / dnsmasq-servers-parent Editarmos the DNS Hosts file to use dnsmasq
nano / etc / dnsmasq-servers-parent and write the main DNS that we use, the format is identical to the file "/ etc / resolv.conf "
nameserver 8.8.8.8 nameserver 4.2.2.2 it is finished, edit the file" / etc / resolv.conf "and delete all servers DNS and leave a line like this:
nano / etc / resolv.conf nameserver 127.0.0.1 Now, we configure our computer to use it as a DNS server, we do this by copying the following line in the file "/ etc/dhcp3/dhclient.conf "
nano / etc / resolv.conf prepend domain-name-servers 127.0.0.1; With everything configured, restart the dnsmasq
, / etc / init.d / dnsmasq restart In the client computers, we replace the servers name displayed in the file "/ etc / resolv.conf" with the IP of our new Local DNS Server
For example:
nano / etc / resolv.conf ; namserver 192.168.1.2 to verify that we are using the new server, do a check using the command "dig" dig google.es
and would
that if a response something like the following:
, \u0026lt;\u0026lt;>> DiG 9.7.0-P1 \u0026lt;\u0026lt;>> google.es ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60378 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;google.es. IN A ;; ANSWER SECTION: google.es. 142 IN A 74.125.230.80 google.es. 142 IN A 74.125.230.81 google.es. 142 IN A 74.125.230.83 google.es. 142 IN A 74.125.230.82 google.es. 142 IN A 74.125.230.84 ;; Query time: 39 msec ;; SERVER: 192.168.1.2#53(192.168.1.2) ;; WHEN: Tue Jan 11 11:09:02 2011 ;; MSG SIZE rcvd: 107
and as you can see the lines of "SERVER" We are using it as local DNS server to our server and not an external DNS .
Based on the HowTo's from
Go2Linux and Linux Guide