当前位置: 移动技术网 > 科技>操作系统>Linux > 搭建本地DNS解析

搭建本地DNS解析

2018年05月30日  | 移动技术网科技  | 我要评论

一、安装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就可以了

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网