欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

搭建本地DNS解析

程序员文章站 2024-01-16 23:49:28
一、安装Dnsmasq yum install -y dnsmasq 二、安装dig yum install dnsmasq -y 三、编辑配置文件 vim /etc/dnsmasq.conf resolv-file=/etc/resolv.dnsmasq.conf strict-order lis ......

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