$ brew install dnsmasq
$ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
$ vi /usr/local/etc/resolv.dnsmasq.conf
# Google DNS
nameserver 8.8.8.8
nameserver 8.8.4.4
# OpenDNS
nameserver 208.67.222.222
nameserver 208.67.220.220
$ vi /usr/local/etc/dnsmasq.conf
resolv-file=/usr/local/etc/resolv.dnsmasq.conf
strict-order
listen-address=127.0.0.1 # 多个IP用逗号隔开
no-hosts
cache-size=32768
address=/bitbucket.org/131.103.20.167
address=/google.com/173.194.38.128
address=/ggpht.com/173.194.38.128
address=/googleapis.com/173.194.38.128
address=/googleusercontent.com/173.194.38.128
address=/gstatic.com/173.194.38.128
address=/youtube.com/173.194.38.128
address=/gmail.com/173.194.38.128
address=/googlesource.com/173.194.38.128
address=/googlelabs.com/173.194.38.128
address=/googlecode.com/173.194.38.128
address=/goo.gl/173.194.38.128
address=/google.cn/203.208.46.210
address=/google.com.hk/203.208.46.210
address=/flickr.com/66.196.66.157
address=/up.flickr.com/119.161.24.27
address=/api.flickr.com/208.71.44.31
address=/farm1.staticflickr.com/72.30.196.151
address=/farm2.staticflickr.com/72.30.196.152
address=/farm3.staticflickr.com/98.137.205.236
address=/farm4.staticflickr.com/98.137.204.89
address=/farm5.staticflickr.com/68.142.227.95
address=/farm6.staticflickr.com/98.139.21.45
address=/farm7.staticflickr.com/98.139.235.135
address=/farm8.staticflickr.com/72.30.198.116
address=/farm9.staticflickr.com/72.30.198.117
address=/github.global.ssl.fastly.net/185.31.17.184
$ sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
$ sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
原文链接:http://nick.txtcc.com/index.php/linux/1228
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/22944