2
3 和win下使用ff根本无法相比,这个问题老早就接触过,在debian,ubuntu下都安装过dnsmasq 做本地dns缓存来解决。arch下是头一次。
4
5 下面是方法:
6
7 1,安装
8 pacman -S dnsmasq
9
10 2,修改dns配置文件 /etc/dnsmasq.conf
11 在 listen-address= 后面添加 127.0.0.1
12 变成这样
13 listen-address=127.0.0.1
14
15 3,不同于debian和ubuntu的一点就是现在arch使用了dhcpcd代替了dhclient,所以配置也就不一样了
16 arch dnsmaq wiki中提到了3中方法,我使用了第3种方法
17 在/etc/Networkmanager/dispatcher.d/中添加一个启动脚本myDNS
18 myDNS脚本内容如下
19 #!/bin/bash
20 #
21 # Override /etc/resolv.conf and tell
22 # NetworkManagerDispatcher to go pluck itself.
23 #
24 # scripts in the /etc/NetworkManager/dispatcher.d/ directory
25 # are called alphabetically and are passed two parameters:
26 # $1 is the interface name, and $2 is "up" or "down" as the
27 # case may be.
28 #
29 # Here, no matter what interface or state, override the
30 # created resolver config with my config.
31 #
32 #cp -f /etc/resolv.conf.myDNSoverride /etc/resolv.conf
33 # 不要改变我删除我原来的/etc/resolv.conf,在第一行添加nameserver 127.0.0.1
34 # Creates a copy of resolv.conf with "nameserver 127.0.0.1" as first line.
35 cat - /etc/resolv.conf <<<"nameserver 127.0.0.1" > /etc/resolv.conf.new
36 cp -f /etc/resolv.conf.new /etc/resolv.conf
37
38 3,修改/etc/rc.conf 使dnsmasq在开机就以DAEMONS运行
39 DAEMONS=(networkmanager dnsmasq ...)
40
41 然后重新启动,察看你的域名解析时间是不是加快了
42 $dig google.com | grep Query
No comments:
Post a Comment