coredns使用etcd
前言
CoreDNS使用ETCD存储主机记录。etcd安装略过。
Corefile内容
.:53 {
    # 绑定本机IP
    bind 192.168.1.2
    # etcd地址
    etcd {
        path /coredns
        endpoint http://192.168.1.2:2379
        fallthrough
    }
    # 最后所有的都转发到系统配置的上游dns服务器去解析
    forward . /home/apps/coredns/conf/forwards
    # 缓存时间ttl
    cache 1800
    # 自动加载配置文件的间隔时间
    reload 6s
    # 输出日志
    log
    # 输出错误
    errors
}
forwards内容
nameserver 223.6.6.6
nameserver 223.5.5.5
etcd相关操作
- 添加主机记录
etcdctl put /coredns/com/example/x1 '{"host":"192.168.1.3","ttl":60}'
- 查看所有主机记录
etcdctl get --prefix /coredns
- 删除指定主机记录
etcdctl del /coredns/com/example/x1
nslookup测试
nslookup example.com 192.168.1.2
本文来自博客园,作者:花酒锄作田,转载请注明原文链接:https://www.cnblogs.com/XY-Heruo/p/17075718.html
 
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号