一、简介
DNSmasq是一个轻巧的,容易使用的DNS服务工具,它可以应用在内部网和Internet连接的时候的 IP地址NAT转换,也可以用做小型网络的DNS服务。
二、安装
sudo apt-get install dnsmasq
三、配置
vi /etc/dnsmasq.conf
# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
#resolv-file=
用于设置上级dns服务器,用于向上级服务器转发查询请求。不设置,默认使用/etc/resolv.conf
如要解析外网的dns,必须设置此项用于向外转发dns请求。
# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
conf-dir=/etc/dnsmasq.d
用于包含配置文件目录
在/etc/dnsmasq.d 新建文件配置文件,如dns-intrant.conf
address=/www.google.hk/192.168.1.12
#以下是泛解析
address=/.google.hk/192.168.1.12
address=/.google.net/192.168.1.12
address=/.google.com/121.52.221.12
可以添加常用的网站用于dns缓存
四、启动服务
sudo service dnsmasq start
netstat -ntlp|grep 53 查看服务是否启动

