Dnsmasq is much easier to use than bind, it can do forward and reverse DNS resolution, and supports DHCP services. It can also be used as an internal dns server.
By default, dnsmasq uses the system's /etc/resolv.conf and reads the /etc/hosts file.
1. Install dnsmasq software
yum install dnsmasq
2. Edit the configuration file /etc/dnsmasq.conf
cache-size= 10000 #Number of cache entries resolv - file =/etc/dnsmasq- resolv.conf #Upgrade DNS addn -hosts =/etc/ dnsmasq.hosts #Local domain name configuration file (pan-domain name is not supported) log-queries log-facility=/var/log/dnsmasq.log local -ttl= 600 #DHCP lease time conf -dir =/etc / dnsmasq.d
3. Modify the upstream DNS configuration file /etc/dnsmasq-resolv.conf
nameserver x.x.x.x
3.1 Edit the local domain name configuration file /etc/dnsmasq.hosts (add the internal addresses and domain names that need to be resolved) (reload will take effect)
127.0 . 0.1 www.qq.com #IP domain name
3.2 Edit the configuration file /etc/dnsmasq.d/address.conf that supports PAN domain name (you need to restart the service to take effect after editing)
address=/www.taobao.com/ 127.0 . 0.1 #Forward parsing ptr -record= 127.0 . 0.1 . in - addr.arpa,www.taobao.com #Reverse parsing (optional) address =/baidu.com/ 127.0 . 0.1 #Pan domain name resolution
4. Configure log rotation, edit /etc/logrotate.d/dnsmasq
/var/log/dnsmasq.log { daily copytruncate missingok rotate 30 compress notifempty dateext size 200M } http://www.cnblogs.com/wsl222000/p/5981299.html http://www.360doc.com/content/14/0913/13/8314158_409140713.shtml