06
2023
07
08:27:05

图形界面和命令行两种方式配置:AD域DNS条件转发器实现内网域名解析走云平台默认DNS



推荐点击下面图片,通过本站淘宝优惠价购买:

image.png

运行命令打开DNS管理器

dnsmgmt.msc

左侧"条件转发器" → 新建条件转发器 → 单击此处添加IP地址或DNS名称 → 添加云平台内网DNS(不要管结果)

183.60.82.98

183.60.83.19

最后是下面这样

或者用命令配置,一句命令搞定

dnscmd <YourDNSServer> /ZoneAdd tencentyun.com /Forwarder 183.60.82.98 183.60.83.19例如:
dnscmd localhost /zoneadd tencentyun.com /forwarder 183.60.82.98 183.60.83.19

dns调整后,验证的话,最后多执行几遍ipconfig /flushdns (一遍有时候不行,有时候还需要powershell执行restart-service dnscache 2>$null重启dns client服务才能快速释放缓存,但dns client服务的依赖项很多,有时候用restart-service dnscache重启不了,可能需要重启机器),如下图就是我先删掉图形界面配置的DNS条件转发器,然后用命令行配置了DNS条件转发器来测试的全过程。

当然,如果觉得配置DNS条件转发器麻烦的话,也可以试试hosts的方法

添加内网域名解析到hosts,如下代码存储为.bat文件执行

set datemine=%date:~0,4%%date:~5,2%%date:~8,2%echo;%time:~0,1%|find " "&&(set timehour=0%time:~1,1%) || (set timehour=%time:~0,2%)set timeother=%time:~3,2%%time:~6,2%set filename=%datemine%%timehour%%timeother%copy c:\windows\system32\drivers\etc\hosts c:\windows\system32\drivers\etc\%filename%_hosts

echo.>c:\windows\system32\drivers\etc\hosts

echo 169.254.0.3  mirrors.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.15  update2.agent.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.4  receiver.barad.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.5  custom.message.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.10.10  metadata.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.23  metadata.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.19  kms.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.54  kms1.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.26  windowsupdate.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.2  ntpupdate.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.79  time1.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.80  time2.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.81  time3.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.82  time4.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.83  time5.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts

echo 169.254.0.138 notify.tat-tc.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 invoke.tat-tc.tencentyun.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 invoke.tat-tc.tencent.cn>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 invoke.tat-tc.tencent.com.cn>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 invoke.tat.tencent-cloud.com>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 notify.tat-tc.tencent.cn>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 notify.tat-tc.tencent.com.cn>>  c:\windows\system32\drivers\etc\hosts
echo 169.254.0.138 notify.tat.tencent-cloud.com>>  c:\windows\system32\drivers\etc\hosts


本文链接:https://hqyman.cn/post/4266.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:





休息一下,本站随机推荐观看栏目:


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: