CoreDNS Windows

CoreDNS for Windows 注册服务 开机自启

  • 首先写Corefile配置文件
  • 注册服务且开机自启
    • 安装WinSW
    • 编写xml配置文件
    • 注册、启动
  • 测试
  • 修改网卡的DNS

此篇博文针对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"

你可能感兴趣的:(Windows,网络,coredns,windows,服务,winsw)