dnsmasq快速安装

  sre
yum install dnsmasq -y

内部hosts写这里

vim /etc/dnsmasq.hosts
192.16.8.2.1 www.test.com

上游dns写这里

vim /etc/resolv.dnsmasq.conf
nameserver 114.114.114.114
nameserver 8.8.8.8

主配置文件写这里

vim /etc/dnsmasq.conf

resolv-file=/etc/resolv.dnsmasq.conf
strict-order
listen-address=172.16.0.2,127.0.0.1
addn-hosts=/etc/dnsmasq.hosts
cache-size=1000
bogus-nxdomain=114.114.114.114
log-queries
log-facility=/var/log/dnsmasq.log

重启生效

systemctl enable dnsmasq
systemctl restart dnsmasq

LEAVE A COMMENT

Captcha Code