v2-6284e988385b9fe152f98461fa49b17a.jpg

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

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code