运行命令打开DNS管理器
代码语言:javascript复制dnsmgmt.msc
左侧"条件转发器" → 新建条件转发器 → 单击此处添加IP地址或DNS名称 → 添加云平台内网DNS(不要管结果)
183.60.82.98
183.60.83.19
最后是下面这样
或者用命令配置,一句命令搞定
代码语言:javascript复制dnscmd <YourDNSServer> /ZoneAdd 内网主域名 /Forwarder 183.60.82.98 183.60.83.19
例如:
dnscmd localhost /zoneadd myzijiebao.com /forwarder 183.60.82.98 183.60.83.19
dnscmd localhost /zoneadd tencentyun.com /forwarder 183.60.82.98 183.60.83.19
dnscmd localhost /zoneadd tencent.cn /forwarder 183.60.82.98 183.60.83.19
dnscmd localhost /zoneadd tencent.com.cn /forwarder 183.60.82.98 183.60.83.19
dnscmd localhost /zoneadd tencent-cloud.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文件执行
代码语言:javascript复制set datemine=�te:~0,4%�te:~5,2%�te:~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=�temine%%timehour%%timeother%
copy c:windowssystem32driversetchosts c:windowssystem32driversetc%filename%_hosts
echo.>c:windowssystem32driversetchosts
echo 169.254.0.3 mirrors.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.15 update2.agent.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.4 receiver.barad.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.5 custom.message.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.10.10 metadata.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.23 metadata.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.19 kms.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.54 kms1.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.26 windowsupdate.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.2 ntpupdate.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.79 time1.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.80 time2.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.81 time3.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.82 time4.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.83 time5.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.138 notify.tat-tc.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.138 invoke.tat-tc.tencentyun.com>> c:windowssystem32driversetchosts
echo 169.254.0.138 invoke.tat-tc.tencent.cn>> c:windowssystem32driversetchosts
echo 169.254.0.138 invoke.tat-tc.tencent.com.cn>> c:windowssystem32driversetchosts
echo 169.254.0.138 invoke.tat.tencent-cloud.com>> c:windowssystem32driversetchosts
echo 169.254.0.138 notify.tat-tc.tencent.cn>> c:windowssystem32driversetchosts
echo 169.254.0.138 notify.tat-tc.tencent.com.cn>> c:windowssystem32driversetchosts
echo 169.254.0.138 notify.tat.tencent-cloud.com>> c:windowssystem32driversetchosts