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.
The above content from: http://lookluk.blogbus.com/logs/56313765.html
After performing the above-mentioned experiment, I did not succeed in Step 4, prompting "not start pdnsd"
Fortunately, step 5 was successful !!! That is to say, the expected results are achieved.
Haha ..........
After the setting is successful, restart again. The DNS may fail to be resolved. You can solve the problem as follows.
When NetworkManager is used to set the NIC, the DNS is automatically cleared every time the system is restarted. It is very troublesome to reset the DNS after each restart.
The nameserver configuration file is/etc/resolv. conf.
This is the normal content:
# Dynamic resolv. conf (5) file for glibc resolver (3) generated by resolvconf (8)
# Do not edit this file by hand -- your changes will be overwritten
Nameserver 202.102.152.3
After the restart, the nameserver 202.102.152.3 is deleted.
The above # dynamic resolv. conf (5) file for glibc resolver (3) generated by resolvconf (8)
It can be seen that resolv. conf is generated by resolvconf. Edit the vim/etc/resolvconf/resolv. conf. d/head File
Display the same content as resolv. conf:
# Dynamic resolv. conf (5) file for glibc resolver (3) generated by resolvconf (8)
# Do not edit this file by hand -- your changes will be overwritten
Enter nameserver 202.102.152.3
Save and exit,
Resolvconf-u
In this case, you can access the Internet normally. After restarting, you do not need to reset the DNS.
From http://hi.baidu.com/step_1/blog/item/bad960f53b2c6337bd3109b2.html