本文共 1016 字,大约阅读时间需要 3 分钟。
相比于Bind提供的DNS解析服务,Dnsmasq无论是使用或是配置上都更加快捷和简单,尤其是一些测试场景和SOHO办公方面,都可以用做DNS Server来使用。
Ubuntu 18.04
apt-get install dnsmasq
vim /etc/dnsmasq.conf#监听本机ip地址listen-address=10.100.33.50#用于非本地主机解析记录解析的dns列表resolv-file= /etc/dnsmasq.d/resolv.dnsmasq.conf #实际解析按照resolv-file中从上到下dns server的顺序进行指派解析strict-order #本地主机解析记录addn-hosts=/etc/hosts
vim /etc/dnsmasq.d/resolv.dnsmasq.confserver = 114.114.114.114server = 233.5.5.5
vim /etc/hosts#解析记录10.10.33.22 office.zabbix.you.cn10.10.33.21 office.grafana.you.cn
vim /etc/resolv.conf #本机的dns配置nameserver 114.114.114.114
dig office.zabbix.you.cn @10.100.33.50 +short10.10.33.22dig office.grafana.you.cn @10.100.33.50 +short10.10.33.21
dig [www.sina.cn](http://www.sina.cn) A @10.100.33.50 | grep Query;; Query time: 62 msec
dig [www.sina.cn](http://www.sina.cn) A @10.100.33.50 | grep Query;; Query time: 3 msec
转载于:https://blog.51cto.com/talk1985/2404936