openSUSE 13.1开启dnsmasq提速网路
opensuse吧
全部回复
仅看楼主
level 1
dnsmasq是轻量级DNS.DHCP伺服端,在桌面环境常用来建立本地端DNS CACHE加速网路访问速度。以及通过自定解析策略让域名解析到特定IP位址。
1.安装dnsmasq
2.修改network配置档,启用dnsmasq
配置档:/etc/sysconfig/network/config
键值:NETCONFIG_DNS_FORWARDER="dnsmasq"
3.重启网路服务
4.配置dnsmasq
配置档:/etc/dnsmasq.conf
配置项:
#no plain names
domain-needed
#no route priv
bogus-priv
#forwarders
resolv-file=/var/run/dnsmasq-forwarders.conf
#no-poll forwarders
no-poll
#interface
interface=lo
# disable DHCP and TFTP
no-dhcp-interface=lo
5.启用dnsmasq服并设定自启动。OK,终了!
如果有问题:
查看一下/var/run/dnsmasq-forwarders.conf,这里面应该有forwarders(DNS伺服器)。
示例:
nameserver 8.8.8.8
nameserver 8.8.4.4
查看一下/etc/resolv.conf,这里面应该有forwarders(DNS伺服器)。
示例:
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
#第一行为127.0.0.1时意味著优先使用本地CACHE。
如果有问题,改好重启服务就可以了。
===========
加强版:
如果你有一个VPS,可以装一个dnsmasq,然后通过加密队道与本机通信,然后在本机上也启用dnsmasq,然后就可以防止ISP对DNS的恶意破坏。
假设远端与本地端通过加密ptptun连线。tun0:10.10.10.10<->tun0:10.10.10.11
远端
#dnsmasq.conf
domain-needed
bogus-priv
resolv-file=/var/run/dnsmasq-forwarders.conf
no-pol
listen-address=10.10.10.10
no-dhcp-interface=tun0
#/var/run/dnsmasq-forwarders.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
#/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
本地端
#dnsmasq.conf
domain-needed
bogus-priv
resolv-file=/var/run/dnsmasq-forwarders.conf
no-pol
interface=lo
no-dhcp-interface=lo
#/var/run/dnsmasq-forwarders.conf
nameserver 10.10.10.10
#/etc/resolv.conf
nameserver 127.0.0.1
2014年08月20日 05点08分 1
level 1
no-poll
有几处错写成no-pol了。
2014年08月20日 05点08分 2
1