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