These days I have been very careful and found that when I browsed the web page using Firefox, I always saw a prompt in the lower left corner at the beginning:
"Parsing host xxx ..."
It seems that it is waiting for the DNS server to resolve the domain name. It is idle, so I decided to make a DNS Cache to speed up the Internet!
I found a software that meets the requirements:
[Xport @ ubuntu ~] $ Apt-cache search "dns" | fgrep "cach" Dnsmasq-A small caching DNS proxy and DHCP server |
Follow these steps:
1. Install dnsmasq:
# Install the dnsmasq Software Package [Xport @ ubuntu ~] $ Sudo apt-get install "dnsmasq"
|
2. Set dnsmasq to take over the local DNS resolution request:
# Modify the configuration file of dnsmasq [Xport @ ubuntu ~] $ Sudo gedit/etc/dnsmasq. conf# Find the following content and modify it # If you want dnsmasq to listen for DHCP and DNS requests only on # Specified interfaces (and the loopback) give the name of # Interface (eg eth0) here. # Repeat the line for more than one interface. # Interface = # Or you can specify which interface _ not _ to listen on # Define T-interface = # Or which to listen on by address (remember to include 127.0.0.1 if # You use this .) Listen-address = 127.0.0.1 # Remove the comment above this line
|
3. Modify the dhclient Configuration:
# Modify the configuration file of dnsmasq [Xport @ ubuntu ~] $ Sudo gedit/etc/dhcp3/dhclient. conf# Find the following content and modify it Prepend domain-name-servers 127.0.0.1; # Remove the comment above this line Request subnet-mask, broadcast-address, time-offset, routers, Domain-name, domain-name-servers, host-name, Netbios-name-servers, netbios-scope;
|
4. Modify the resolv. conf configuration:
[Xport @ ubuntu ~] $ Sudo gedit/etc/resolv. conf# Note: The content of my resolv. conf file will not be rewritten because of ADSL dialing. # Because dnsmasq takes over the DNS resolution request of the local machine, the address of 127.0.0.1 is placed at the beginning. Nameserver 127.0.0.1 Nameserver xxx. xxx Nameserver xxx. xxx Search lan
|
5. Restart the dnsmasq service:
[Xport @ ubuntu ~] $ Sudo/etc/init. d/dnsmasq restart
|
6. Take a look at the time required for DNS resolution, and compare the data between the two before and after DNS resolution:
[Xport @ ubuntu ~] $ Dig baidu.com # first execution ... Omitted output information... ; Query time: 8 msec ; SERVER: 127.0.0.1 #53 (127.0.0.1) ; WHEN: Mon Feb 19 20:43:32 2007 ; Msg size rcvd: 229 [Xport @ ubuntu ~] $ Dig baidu.com # Run again ... Omitted output information... ; Query time: 0 msec ; SERVER: 127.0.0.1 #53 (127.0.0.1) ; WHEN: Mon Feb 19 20:45:27 2007 ; Msg size rcvd: 59 |
Okay, close the job ~~~!