Centos 7安装和配置dnsmasq详解

通过yum安装dnsmasq

yum install dnsmasq -y

2.编辑修改dnsmasq配置文件

vim /etc/dnsmasq.conf

#指定外网dns服务器(也就是公网DNS服务器)
resolv-file=/etc/resolv.dnsmasq.conf
listen-address=192.168.1.250 #指定当前服务器的ip
conf-dir=/etc/dnsmasq.d # 指定解析记录都写到这个目录下
addn-hosts=/etc/dnsmasq.hosts #指定dns解析记录文件

3.填写外网dns服务器ip

vim /etc/resolv.dnsmasq.conf
nameserver 114.114.114.114
nameserver 8.8.8.8
nameserver 202.106.0.20

4.填写自建的dns解析记录

vim /etc/dnsmasq.hosts
192.168.10.3 oa.hci.com
192.168.102.10 hci.com

5. 修改/etc/resolv.conf

修改当前服务器的,dns域名服务器,指定自建的dnsmasq服务器ip

vim /etc/resolv.conf
nameserver 192.168.1.250

6.重启dnsmasq,设置开机自启动

systemctl enable dnsmasq
systemctl start dnsmasq
systemctl restart dnsmasq

猜你喜欢

转载自blog.csdn.net/justlpf/article/details/134425040