跳至主要內容

mac安装dnsmasq

brinishness...小于 1 分钟Macosmacosdnsmasq

mac安装dnsmasq

1.安装dnsmasq

brew install dnsmasq

2.备份配置文件

sudo cp /usr/local/etc/dnsmasq.conf /usr/local/etc/dnsmasq.conf_back

3.修改配置文件

sudo vim /usr/local/etc/dnsmasq.conf # 打开配置文件
address=/brinish.com/127.0.0.1 # 添加brinish.com域名解析为127.0.0.1

4.新建dns文档

sudo mkdir -p /etc/resolver
sudo vim /etc/resolver/brinish.com
nameserver 127.0.0.1 # 写入brinish.com文件中

5.重启dnsmasq服务

sudo brew services stop dnsmasq # 关闭dnsmasq服务
sudo brew services start dnsmasq # 启动dnsmasq服务

6.清dns缓存

sudo killall -HUP mDNSResponder # 清dns缓存

7.测试dnsmasq服务是否正常

ping brinish.com
nslookup brinish.com
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v2.15.5