国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux中通過緩存DNS的解析來提高上網的響應速度

2024-08-28 00:05:02
字體:
來源:轉載
供稿:網友

用Firefox瀏覽網頁的時候,一開始總會看到左下角有一行提示:

     “正在解析主機 xxx ...”   

看上去是等待DNS服務器對域名的解析,于是閑來無事,決定做一個DNS Cache來提高下速度!

找了一下,有一個:

[xport@Ubuntu ~] $ apt-cache search "dns" | fgrep "cach"
dnsmasq - A small caching DNS proxy and DHCP server

去翻翻資料,設定的步驟如下:

1. 安裝dnsmasq:

# 安裝dnsmasq的軟件包
[xport@ubuntu ~] $ sudo apt-get install "dnsmasq"

2.設定dnsmasq接管本機的DNS解析請求:

# 修改dnsmasq的配置文件
[xport@ubuntu ~] $ sudo gedit /etc/dnsmasq.conf

# 找到下面的內容,并進行修改
# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
# interface=
# Or you can specify which interface _not_ to listen on
# except-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 # 把這一行前面的注釋去掉


3.修改dhclient的配置:

# 修改dnsmasq的配置文件
[xport@ubuntu ~] $ sudo gedit /etc/dhcp3/dhclient.conf

# 找到下面的內容,并進行修改
prepend domain-name-servers 127.0.0.1; # 把這一行前面的注釋去掉
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, host-name,
        netbios-name-servers, netbios-scope;


4.修改resolv.conf的配置:

[xport@ubuntu ~] $ sudo gedit /etc/resolv.conf

# 因為dnsmasq會接管本機的DNS解析請求,所以把127.0.0.1的地址放在最前面
nameserver 127.0.0.1
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
search localdomain


5. 重新開啟dnsmasq的服務:

[xport@ubuntu ~] $ sudo /etc/init.d/dnsmasq restart

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 泰宁县| 张掖市| 尉氏县| 漳浦县| 柳河县| 浪卡子县| 札达县| 石台县| 东兰县| 和田县| 密云县| 海林市| 车致| 合阳县| 鹤峰县| 内黄县| 阳新县| 河曲县| 景洪市| 依兰县| 思茅市| 霍州市| 北票市| 固镇县| 梁河县| 元朗区| 收藏| 富平县| 静宁县| 龙口市| 南靖县| 邯郸市| 荔波县| 临邑县| 霍林郭勒市| 南乐县| 合水县| 沧州市| 扬中市| 汶上县| 灌云县|