1、安装

1
wget https://github.com/coredns/coredns/releases/download/v1.4.0/coredns_1.4.0_linux_amd64.tgz

2、启动

1
2
touch Corefile
vi Corefile
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# vi Corefile
. {
    proxy . 223.5.5.5:53 223.6.6.6:53 {
        protocol dns
        policy round_robin
    }
    #hosts
    reload 10s
    #loadbalance round_robin
    prometheus
    errors
    log
}
1
2
./coredns -conf Corefile -dns.port 1053
# http://127.0.0.1:9153/metrics
1
2
3
# 测试
dig +short -p 1053 @127.0.0.1 baidu.com
dig +noall +answer AAAA -p 1053 @127.0.0.1 youku.com

3、DNS记录类型

  • A (Host address)
  • AAAA (IPv6 host address)
  • ALIAS (Auto resolved alias)
  • CNAME (Canonical name for an alias)
  • MX (Mail eXchange)
  • NS (Name Server)
  • PTR (Pointer)
  • SOA (Start Of Authority)
  • SRV (location of service)
  • TXT (Descriptive text)

4、DNS SRV