- dnsmasq安装
brew install dnsmasq
brew info dnsmasq//每次配置完,重启服务
sudo brew services restart dnsmasq
- 修改 /usr/local/etc/dnsmasq.conf
log-queries
log-facility=/var/log/dnsmasq.log
bogus-nxdomain=119.29.29.29
cache-size=2048
port=53
no-resolv
- /private/etc/hosts ,使用no-resolv走的就是host的配置(使用gas mask软件可以快速修改host)
123.123.123.123 www.xxx.com
- 手机设置dns地址为电脑ip,使用NetAnalyzer查看dns
PS: .zshrc中可以配置别名,快速查看本机ip地址
alias ip='curl ifconfig.me'
alias ip2='ifconfig | grep inet | grep -v inet6 | grep -v 127'
alias ip3='ifconfig | grep inet'