安装
Mac
1
brew install dnsmasq
ubuntu
1
sudo apt-get install dnsmasq
配置
/usr/local/etc/dnsmasq.conf
1
2
3
4
# DNS绑定地址
listen-address=192.168.1.102,127.0.0.1
# 配置解析顺序文件
resolv-file=/usr/local/etc/resolv.dnsmasq.conf
启动
1
2
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
1
sudo brew services restart dnsmasq
测试
1
2
nslookup example.com 127.0.0.1
dig @127.0.0.1 example.com