安装CoreDNS

安装

二进制

1
2
3
wget https://github.com/coredns/coredns/releases/download/v1.8.4/coredns_1.8.4_linux_amd64.tgz
mkdir coredns_1.8.4_linux_amd64
tar zxvf coredns_1.8.4_linux_amd64.tgz -C coredns_1.8.4_linux_amd64

docker

1
docker pull coredns/coredns:1.8.4

源码

1
2
3
git clone https://github.com/coredns/coredns -b v1.8.4
cd coredns
make

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
./coredns -plugins
vi Corefile
###
. {
hosts {
10.0.0.1 example.org
fallthrough
}
forward . /etc/resolv.conf
cache
log
errors
}
###

测试

1
2
./coredns -dns.port=1053
dig @localhost -p 1053 a example.org