How to Install and Configure dnsmasq on freebsd

cd /usr/ports/dns/dnsmasq
make install clean
Options for dnsmasq 2.55,1
[X] IPV6  IPv6 support
[ ] DBUS  DBUS support
[X] NLS   NLS and IDN support
vi /etc/rc.conf
dnsmasq_enable=”YES”
:wq
vi /usr/local/etc/dnsmasq.conf
#service-labs.com
listen-address=192.168.1.8
server=/115.com/114.114.114.114
server=/126.com/114.114.114.114
server=/126.net/114.114.114.114
server=/163.com/114.114.114.114
server=/17173.com/114.114.114.114
server=/17cdn.com/114.114.114.114
server=/51.la/114.114.114.114
server=/6rooms.com/114.114.114.114
server=/91.com/114.114.114.114
server=/alimama.com/114.114.114.114
server=/alipay.com/114.114.114.114
server=/atpanel.com/114.114.114.114
server=/baidu.com/114.114.114.114
server=/bdimg.com/114.114.114.114
server=/bilibili.tv/114.114.114.114
server=/ccb.com/114.114.114.114
server=/cdn20.com/114.114.114.114
server=/cn/114.114.114.114
server=/cnepub.com/114.114.114.114
server=/cnzz.com/114.114.114.114
server=/douban.com/114.114.114.114
server=/douban.fm/114.114.114.114
server=/duomi.com/114.114.114.114
server=/gtimg.com/114.114.114.114
server=/hdslb.com/114.114.114.114
server=/hiapk.com/114.114.114.114
server=/hoopchina.com/114.114.114.114
server=/hupu.com/114.114.114.114
server=/iask.com/114.114.114.114
server=/ifeng.com/114.114.114.114
server=/ifengimg.com/114.114.114.114
server=/service-labs.com/114.114.114.114
server=/ijinshan.com/114.114.114.114
server=/iqiyi.com/114.114.114.114
server=/jing.fm/114.114.114.114
server=/kandian.com/114.114.114.114
server=/kandian.net/114.114.114.114
server=/kanimg.com/114.114.114.114
server=/kdnet.net/114.114.114.114
server=/koudai8.com/114.114.114.114
server=/ku6cdn.com/114.114.114.114
server=/ku6.com/114.114.114.114
server=/letv.com/114.114.114.114
server=/loli.mg/114.114.114.114
server=/loli.vg/114.114.114.114
server=/lxdns.com/114.114.114.114
server=/mapbar.com/114.114.114.114
server=/microsoft.com/114.114.114.114
server=/mop.com/114.114.114.114
server=/mydrivers.com/114.114.114.114
server=/netease.com/114.114.114.114
server=/pengyou.com/114.114.114.114
server=/qiyi.com/114.114.114.114
server=/qiyipic.com/114.114.114.114
server=/qq.com/114.114.114.114
server=/qqmail.com/114.114.114.114
server=/qstatic.com/114.114.114.114
server=/renren.com/114.114.114.114
server=/sdo.com/114.114.114.114
server=/sina.com/114.114.114.114
server=/sinaedge.com/114.114.114.114
server=/sogou.com/114.114.114.114
server=/sohu.com/114.114.114.114
server=/soso.com/114.114.114.114
server=/tanx.com/114.114.114.114
server=/taobaocdn.com/114.114.114.114
server=/taobao.com/114.114.114.114
server=/tbcache.com/114.114.114.114
server=/tdimg.com/114.114.114.114
server=/tencent.com/114.114.114.114
server=/thawte.com/114.114.114.114
server=/tianyaui.com/114.114.114.114
server=/tmall.com/114.114.114.114
server=/tudou.com/114.114.114.114
server=/tudouui.com/114.114.114.114
server=/weibo.com/114.114.114.114
server=/wrating.com/114.114.114.114
server=/xiami.com/114.114.114.114
server=/xiami.net/114.114.114.114
server=/xiaonei.com/114.114.114.114
server=/xlpan.com/114.114.114.114
server=/xn--fiqs8s/114.114.114.114
server=/xunlei.com/114.114.114.114
server=/ydstatic.com/114.114.114.114
server=/ykimg.com/114.114.114.114
server=/youdao.com/114.114.114.114
server=/youku.com/114.114.114.114
server=/zbjimg.com/114.114.114.114
server=/zhubajie.com/114.114.114.114
server=/service-labs.com/114.114.114.114
address=/aiobox.com/114.114.114.114
server=8.8.8.8
server=8.8.4.4
:wq
########################################################################
DNSMasq支持泛域名,比如在hosts中需要配2000条:
# apple app store
202.175.5.114 a1.phobos.service-labs.com
202.175.5.114 a2.phobos.service-labs.com
202.175.5.114 a3.phobos.service-labs.com
……
202.175.5.114 a2000.phobos.service-labs.com

而DNSMasq只需要1条:

#apple app store
address=/.phobos.service-labs.com/202.175.5.114

#############################################################################
#service-labs.com
# Google China hosts, use at your own risk
#address=/ggpht.com/203.208.46.29
#address=/googleusercontent.com/203.208.46.29
#address=/gstatic.com/203.208.46.29
#address=/google.com.hk/203.208.46.29
#address=/google.com/203.208.46.29
#address=/youtube.com/203.208.46.29
#address=/ytimg.com/203.208.46.29
server=/115.com/114.114.114.114
server=/126.com/114.114.114.114
server=/126.net/114.114.114.114
server=/163.com/114.114.114.114
server=/17173.com/114.114.114.114
server=/17cdn.com/114.114.114.114
server=/51.la/114.114.114.114
server=/6rooms.com/114.114.114.114
server=/91.com/114.114.114.114
server=/alimama.com/114.114.114.114
server=/alipay.com/114.114.114.114
server=/atpanel.com/114.114.114.114
server=/baidu.com/114.114.114.114
server=/bdimg.com/114.114.114.114
server=/bilibili.tv/114.114.114.114
server=/ccb.com/114.114.114.114
server=/cdn20.com/114.114.114.114
server=/cn/114.114.114.114
server=/cnepub.com/114.114.114.114
server=/cnzz.com/114.114.114.114
server=/douban.com/114.114.114.114
server=/douban.fm/114.114.114.114
server=/duomi.com/114.114.114.114
server=/gtimg.com/114.114.114.114
server=/hdslb.com/114.114.114.114
server=/hiapk.com/114.114.114.114
server=/hoopchina.com/114.114.114.114
server=/hupu.com/114.114.114.114
server=/iask.com/114.114.114.114
server=/ifeng.com/114.114.114.114
server=/ifengimg.com/114.114.114.114
server=/ijinshan.com/114.114.114.114
server=/iqiyi.com/114.114.114.114
server=/jing.fm/114.114.114.114
server=/kandian.com/114.114.114.114
server=/kandian.net/114.114.114.114
server=/kanimg.com/114.114.114.114
server=/kdnet.net/114.114.114.114
server=/koudai8.com/114.114.114.114
server=/ku6cdn.com/114.114.114.114
server=/ku6.com/114.114.114.114
server=/letv.com/114.114.114.114
server=/loli.mg/114.114.114.114
server=/loli.vg/114.114.114.114
server=/lxdns.com/114.114.114.114
server=/mapbar.com/114.114.114.114
server=/microsoft.com/114.114.114.114
server=/mop.com/114.114.114.114
server=/mydrivers.com/114.114.114.114
server=/netease.com/114.114.114.114
server=/pengyou.com/114.114.114.114
server=/qiyi.com/114.114.114.114
server=/qiyipic.com/114.114.114.114
server=/qq.com/114.114.114.114
server=/qqmail.com/114.114.114.114
server=/qstatic.com/114.114.114.114
server=/renren.com/114.114.114.114
server=/sdo.com/114.114.114.114
server=/sina.com/114.114.114.114
server=/sinaedge.com/114.114.114.114
server=/sogou.com/114.114.114.114
server=/sohu.com/114.114.114.114
server=/soso.com/114.114.114.114
server=/tanx.com/114.114.114.114
server=/taobaocdn.com/114.114.114.114
server=/taobao.com/114.114.114.114
server=/tbcache.com/114.114.114.114
server=/tdimg.com/114.114.114.114
server=/tencent.com/114.114.114.114
server=/thawte.com/114.114.114.114
server=/tianyaui.com/114.114.114.114
server=/tmall.com/114.114.114.114
server=/tudou.com/114.114.114.114
server=/tudouui.com/114.114.114.114
server=/weibo.com/114.114.114.114
server=/wrating.com/114.114.114.114
server=/xiami.com/114.114.114.114
server=/xiami.net/114.114.114.114
server=/xiaonei.com/114.114.114.114
server=/xlpan.com/114.114.114.114
server=/xn--fiqs8s/114.114.114.114
server=/xunlei.com/114.114.114.114
server=/ydstatic.com/114.114.114.114
server=/ykimg.com/114.114.114.114
server=/youdao.com/114.114.114.114
server=/youku.com/114.114.114.114
server=/zbjimg.com/114.114.114.114
server=/zhubajie.com/114.114.114.114
server=/service-labs.com/114.114.114.114
server=8.8.4.4
server=8.8.8.8

:wq

原文链接:,转发请注明来源!

发表评论