首页 > 技术文章 > 搭建本地DNS解析

xiongyoutom 2018-05-29 09:35 原文

一、安装Dnsmasq

yum install -y dnsmasq 

二、安装dig

yum install dnsmasq -y

三、编辑配置文件

vim /etc/dnsmasq.conf

resolv-file=/etc/resolv.dnsmasq.conf

strict-order

listen-address=172.16.1.10,127.0.0.1

vim /etc/resolv.conf

nameserver 127.0.0.1

cp /etc/resolv.conf /etc/resolv.dnsmasq.conf

nameserver 8.8.8.8

nameserver 199.91.73.222

cp /etc/hosts /etc/dnsmasq.hosts

vim /etc/dnsmasq.conf

addn-hosts=/etc/dnsmasq.hosts

四、启动dns

systemctl enable dnsmasq.service

systemctl start dnsmasq.service

 五、检查是否启动成功

ps -ef|grep dnsmasq

netstat -tlunp|grep 53

 

六、添加日志

vim /etc/dnsmasq.conf

log-queries
log-facility=/var/log/dnsmasq/dnsmasq.log
 
七、重启dns就可以了

推荐阅读