coredns+etcd搭建DNS服务器

26 阅读1分钟

搭建etcd

搭建coredns

待完善

配置dns-mate

直接操作etcd有点复杂
dns-mate用http方式简化了这些操作
假设启动在1.2.3.4:8053

添加新记录

记录添加前已存在会返回http400

curl --location --request PUT http://1.2.3.4:8053/api/rr/a.haha.com \
--header 'Content-Type: application/json' \
--data-raw '{"values": "1.1.1.1"}'

设置记录

无论是否已经存在记录都覆盖
就是请求体加了一个 "overwrite": true

curl --location --request PUT http://1.2.3.4:8053/api/rr/a.haha.com \
--header 'Content-Type: application/json' \
--data-raw '{"values": "1.1.1.1", "overwrite": true}'

单域名多ip

"values": "1.1.1.1,2.2.2.2,3.3.3.3"

删除记录

curl --location --request DELETE  http://1.2.3.4:8053/api/rr/a.haha.com --header 'Content-Type: application/json'