Is Ubuntu slow to access the Internet? That's right! Do not doubt that Ubuntu is indeed slower than Windows. Where is the slowness? When you use Firefox to browse the Web page under Ubuntu9.10, you will find that the status bar in the lower left corner shows the information of Lookingupxxxx.com... Or Connectingtoxxxx.com for a long time. At this time, the page remains blank. When this information finally jumps, it is fast Transferringdata
Is Ubuntu slow to access the Internet? That's right! Do not doubt that Ubuntu is indeed slower than Windows. Where is the slowness?
When you use Firefox in Ubuntu 9.10 to browse the Web page, you will find that the status bar in the lower left corner shows the information of Looking up xxxx.com... or Connecting to xxxx.com for a long time. The page remains blank.
When this information finally jumps, it is fast Transferring data from xxxx.com, very fast,
The page is displayed. At this point, we come to the conclusion that the DNS resolution is slow, rather than pulling webpage data.
DNS cache is enabled by default in Windows. Therefore, it is impossible for all resolved domain names to connect to a remote DNS server for query in a short time, but to directly query from the local DNS cache, theoretically, the DNS resolution time is similar to 0. Ubuntu does not enable similar functions by default. Therefore, we feel that the Internet access speed in Windows is better than that in Ubuntu on the same machine and cable.
Therefore, the idea to solve the problem of slow access to Ubuntu is also coming: we can set up a DNS proxy server on the local machine and cache DNS. Common Software for building DNS proxy in linux include bind, djbdns, dnsmasq, and pdnsd. Here, we use pdnsd as an example.
1. Install
Pdnsd has been added to the source and is easy to install:
Sudo apt-get install pdnsd
During the installation process, it will ask you which configuration you choose. Here, choose manual.
2. Configuration
Sudo gedit/etc/pdnsd. conf
Modify
Server {
Label = "resolvconf ";
}
Is
Server {
Label = "resolvconf ";
Ip = 61.233.154.33;
Ip = 211.98.4.1;
Timeout = 30;
Interval = 30;
Uptest = ping;
Ping_timeout = 50;
Purge_cache = off;
}
Where:
Ip = 61.233.154.33;
Ip = 211.98.4.1;
These two lines can also be written as a line of ip = 61.233.154.33, 211.98.4.1; representing the local DNS server address. If you are on the campus network, the two addresses are the DNS and backup DNS provided by the network administrator...
You can enter multiple IDS as needed. Here is tietong's DNS.
The following parameters can be used by default.
3. Set the local DNS
Sudo gedit/etc/resolv. conf
Insert a row before all content:
Nameserver 127.0.0.1
In particular, if you are using ADSL dial-up Internet access (configured through pppoeconf), you also need to modify the file:
Sudo gedit/etc/ppp/peers/dsl-provider
Add # In Front Of usepeerdns and comment it out. Prevents ppp from forcing remote DNS and overwriting resolv. conf
If you have enabled the DHCP service
Sudo gedit/etc/dhcp3/dhclient. conf
Remove
# Prepend domain-name-servers 127.0.0.1;
The preceding "#".
4. Start pdnsd
Sudo/etc/init. d/pdnsd start
5. Simple Test
Dig yahoo.com | grep time
The first result shows:; Query time: 11 msec
The second result shows:; Query time: 0 msec
The third result shows:; Query time: 0 msec
The fourth result shows:; Query time: 0 msec
Result N:; Query time: 0 msec,
So far, our local DNS proxy server has been set up successfully. Of course, this does not mean that the network speed will
Immediately improved. However, when Firefox accesses the page under the same domain name for the second time, the Looking up xxxx.com... or Connecting to xxxx.com... time is almost 0. Now the Internet access speed of Ubuntu is equivalent to that of Windows.
After I tried the above methods, step 4 failed. The prompt "Not start pdnsd" was prompted. But fortunately, step 5 succeeded !!! That is to say, the expected results are achieved.