-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
# 监听53端口,接受所有的DNS查询请求 | ||
.:53 { | ||
# lameduck 5s表示当 CoreDNS 即将关闭或重启时,会保持 5 秒钟的时间继续服务请求 | ||
health { | ||
lameduck 5s | ||
} | ||
|
||
# 从 etcd 获取配置,path 指定 etcd 中的 key 的路径 | ||
etcd { | ||
path /coredns | ||
# endpoint 指定本地 embed etcd 的地址 | ||
endpoint http://localhost:2379 | ||
# fallthrough 表示如果 etcd 中没有找到记录则继续传递查询 | ||
fallthrough | ||
} | ||
# 将查询转发到本地的 DNS 服务器 /etc/resolv.conf | ||
forward . /etc/resolv.conf | ||
# 启用缓存,缓存 1800 秒 | ||
cache 1800 | ||
# 允许自动 reload 配置 | ||
reload | ||
# 启用日志 | ||
log | ||
# 日志只记录错误信息 | ||
errors | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# embedns | ||
a tiny dns server which is made up of coredns and embed etcd | ||
一个轻量型支持API动态更新的DNS Server(coredns+embed etcd) | ||
|
||
# example | ||
1. 启动服务 | ||
``` | ||
go run main.go | ||
``` | ||
|
||
2. 写入A记录 | ||
``` | ||
etcdctl put /coredns/helloworld/x1 '{"host":"192.168.1.8","ttl":60}' | ||
``` | ||
|
||
3. 域名解析验证 | ||
``` | ||
❯ nslookup helloworld localhost | ||
Server: localhost | ||
Address: ::1#53 | ||
Name: helloworld | ||
Address: 192.168.1.8 | ||
``` |