此篇博文针对Windows下的CoreDNS配置
首先写Corefile配置文件
.:53 {
# 绑定interface ip
bind 127.0.0.1
# 先走本机的hosts
hosts C:\Windows\System32\drivers\etc\hosts {
fallthrough
}
# 转发上游dns服务器
forward . tls://223.5.5.5:853 {
tls_servername dns.alidns.com
force_tcp
max_fails 3
}
# 缓存时间ttl
cache 120
reload 10s
log
errors
}
注册服务且开机自启
准备注册服务,但是,我尝试了以下方式都启动失败了
New-Service -Name "CoreDNS" -BinaryPathName '"D:\Applications\apps\coredns\1.8.3\coredns.exe -conf D:\Applications\apps\coredns\Corefile"' -Description "CoreDNS Service" -StartupType "Automatic"
New-Service -Name "CoreDNS" -BinaryPathName '"powershell -file D:\Applications\apps\coredns\CorednsService.ps1 -WindowStyle Hidden"' -Description "CoreDNS Service" -StartupType "Automatic&#