DNSmasq搭建内网DNS服务器

1.安装dnsmasq

yum install -y dnsmasq

2.配置配置文件

vim /etc/dnsmasq.conf

no-hosts

resolv-file=/etc/resolv.dnsmasq.conf

strict-order

listen-address=192.168.0.43,127.0.0.1

addn-hosts=/etc/dnsmasq.hosts

vim /etc/resolv.conf
nameserver 127.0.0.1
 
vim /etc/resolv.dnsmasq.conf
nameserver 8.8.8.8
nameserver 115.115.115.115
 
cp /etc/hosts /etc/dnsmasq.hosts 把/etc/hosts拷贝过来
 
3.配置需要解析的域名
vim /etc/dnsmasq.hosts 添加 ip 域名
192.168.1.7 nexus.szhmxxkj.com
 
4.配置客户机DNS服务器地址
增加上内网DNS服务器ip
原文地址:https://www.cnblogs.com/cuiyupu/p/11601880.html