Open wangkuiyi opened 8 years ago
我花了几个小时学习DNS ( https://www.digitalocean.com/community/tutorials/an-introduction-to-dns-terminology-components-and-concepts ) 以及 dig 用法 ( http://www.thegeekstuff.com/2012/02/dig-command-examples/ ),然后试了试 —— SkyDNS 可以作为一个 DNS 服务器部署在我的MacBook Pro上,并且设置系统使用它作为DNS服务。具体步骤如下:
安装 etcd
:
curl -L https://github.com/coreos/etcd/releases/download/v3.0.2/etcd-v3.0.2-darwin-amd64.zip -o etcd-v3.0.2-darwin-amd64.zip
unzip etcd-v3.0.2-darwin-amd64.zip
cd etcd-v3.0.2-darwin-amd64
启动 etcd
:
./etcd
下载和build SkyDNS:
export GOPATH=`pwd`
go get github.com/skynetservices/skydns
运行 SkyDNS,它会默认使用本地单节点etcd:
sudo $GOPATH/bin/skydns
配置SkyDNS在自己解析不了域名的时候,forward到Google的DNS:
./etcdctl set /skydns/config '{"nameservers":["8.8.8.8:53", "8.8.4.4:53"]}'
设置域名 www.wangkuiyi.skydns.local
的IP地址是 10.10.10.111:8080
./etcdctl set skydns/local/skydns/wangkuiyi/www '{"host":"10.10.10.111","port":8080}'
用dig验证可以从本地DNS(SkyDNS)解析 www.wangkuiyi.com.skydns.local
dig @localhost www.wangkuiyi.skydns.local +short
配置Mac OS X使用本地DNS:
测试ping可以解析 www.wangkuiyi.skydns.local:
$ ping www.wangkuiyi.skydns.local
PING www.wangkuiyi.skydns.local (10.10.10.111): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
基于上面的试验,以及刚才和 @vienlee 的电话讨论,我想验证一下这样一种配置:
以上设计是基于目前对相关技术的理解,还需要实际操作来验证。 @lipeng-unisound
Must Read
DNS Basics: https://www.digitalocean.com/community/tutorials/an-introduction-to-dns-terminology-components-and-concepts
This tutorial is very concise and useful. I learned zones, records, name servers, and resolving name servers.
dig Usage: http://www.thegeekstuff.com/2012/02/dig-command-examples/
This is also a must-to-read. It explained the usage of dig, which we use to verify the DNS service.
Source repo: https://github.com/skynetservices/skydns