歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux下網速慢的問題

Linux下網速慢的問題

日期:2017/2/28 16:06:55   编辑:Linux教程

機器是雙系統,分別是Windows XP 和 CentOS-5.3,問題是這樣的,在windows 下網速很快,然後切換到Linux下網速就變得蝸牛爬一樣慢,忍受了有些日子了。試過在Linux下重新裝了網卡驅動,效果為零,問題依舊。不廢話了,問題的根本原因是dns解析花費了大量時間,解決方法是利用dnsmasq建立dns 緩存。

1、安裝dnsmasq

dnsmasq的官方網址是:http://www.thekelleys.org.uk/dnsmasq/doc.html。利用裡面的下載鏈接下載安裝即可。

2、配置dnsmasq

配置相當簡單,也不用命令行。在CentOS打開System——>Administration——>Network:

到DNS標簽下添加一個新的DNS服務器:127.0.0.1,並且放在第一的位置上。原來的保留不變,只是挪一下位置,降一下順序。

The other way to do this is to edit /etc/resolv.conf file.Add an new line at the top of the /etc/resolv.conf file and the line looks like this nameserver:127.0.0.1 which means add a new dns server.

3、啟動、停止dnsmasq

/etc/init.d/dnsmasp start

/etc/init.d/dnsmasp stop

/etc/init.d/dnsmasp restart

利用/etc/init.d/dnsmasp start來啟動或者配置修改後用/etc/init.d/dnsmasp restart來重新啟動使dnsmasq生效。

4、測試DNS緩存

4.1dnsmasq啟動之前執行dig結果

dig www.google.com

;; Query time: 1 msec

;; SERVER: xxx.xxx.xxx.xxx#53(xxx.xxx.xxx.xxx) #這裡屏蔽真實DNS地址

;; WHEN: Mon Aug 31 13:13:40 2009

;; MSG SIZE rcvd: 292

4.2dnsmasq啟動之後執行dig結果

dig www.google.com

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Mon Aug 31 13:16:02 2009

;; MSG SIZE rcvd: 110

Copyright © Linux教程網 All Rights Reserved