Dnsmasq(局域网DNS,DHCP)

安装:yum -y install dnsmasq
 
dnsmasq配置文件: /etc/dnsmasq.conf
默认指定DNS服务器(优先级)文件:/etc/resolv.conf
默认hosts文件:/etc/hosts
 
默认参数均能通过配置文件修改:
resolv-file=/etc/dnsmasq.resolv.conf                #自定义指定DNS服务器
addn-hosts=/etc/dnsmasq.hosts.conf               #不读取/etc/hosts,添加本地hosts文件(要是改配置生效还需取消no-hosts的注释)
conf-file=/etc/dnsmasq.more.conf                    # 引入其他配置文件
sudo /etc/init.d/dnsmasq start                           #启动服务
sudo /etc/init.d/dnsmasq restart                        #重启服务
 
=============================实例=======================
客户机(192.168.10.5)和服务机(192.168.10.3)均安装该软件;
服务机配置hosts文件,指定上层DNS服务器(/etc/resolv.conf);
        nameserver 8.8.8.8
服务机添加hosts解析(/etc/hosts)
        192.168.10.9 wifi.test.cn 
客户机指定指定Dnsmasq服务端地址,获取相关DNS解析记录(/etc/resolv.conf);
        nameserver 192.168.10.3
 
原文地址:https://www.cnblogs.com/wangshi-work/p/5177143.html