dnsmasq 本地局域网DNS服务器搭建

项目背景

因为本地环境需要使用域名进行调试,需要DNS服务器
DNS 机器IP:192.168.5.249
 

dnsmasq 服务端部署

#01 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
firewall-cmd --state
 
#02 下载服务 dnsmasq
yum install -y dnsmasq
 
#03 修改配置文件
[root@damahou ~]# egrep -v "^#|^$" /etc/dnsmasq.conf
resolv-file=/etc/resolv.dnsmasq.conf
address=/test.com/192.168.5.245
listen-address=192.168.5.249
addn-hosts=/etc/dnsmasq.hosts
log-queries
conf-dir=/etc/dnsmasq.d
conf-dir=/etc/dnsmasq.d,.bak
conf-dir=/etc/dnsmasq.d/,*.conf
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmorig
 
 
#04 启动服务
systemctl start dnsmasq
systemctl enable dnsmasq
 
#04 添加需要解析的内网域名
[root@centos7 ~]# cat /etc/dnsmasq.hosts
192.168.5.245 yunyi.com 80
192.168.5.245 zw.yunyi.com 80
192.168.5.245 zf.yunyi.com 80
192.168.5.245 kq.yunyi.com 80
192.168.5.245 dw.yunyi.com 80
 
#05 重启服务生效
systemctl restart dnsmasq.service

使用教程

需要添加DNS 服务器IP:192.168.5.249

 

终端:ping yunyi.com (测试域名) 看是否为DNS解析地址
 
posted @   宁采臣open  阅读(288)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示