在Windows Server 2016发布的时候其实有些新功能加入,因为在国内大伙都关注公有云了,因此对于本地Windows Server新版本发布就不是特别关注了,但国内用本地版的Windows Server用户也不少,因此今天我在这里结合老王写过的《 Windows Server 2016 DNS Policy Geo-Location 1 》来更新一版Windows Server 2019在这里的表现,我的环境是如下这样的(整个都是工作组的系统,没有域环境):
在总部的这台Windows Server 2019上我配置好了DHCP的成都和北京作用域
DNS上我加了2条A记录
在中间的路由器服务器Win08R2Router我配置了DHCP中继
在成都站点,WinSrv08-Web01构建好了一个Web网站
在北京站点,WinSrv08-Web02构建好了一个Web网站
成都站点有一台客户端WinVista01是可以访问到成都和北京的Web服务器的
北京站点有一台客户端WinVista02是可以访问到成都和北京的Web服务器的
最后我想达到的效果是:
成都站点的客户端vista01访问web.basehome.com.cn时能根据网段判别出应该访问成都站点的web01服务器
北京站点的客户端vista02访问web.basehome.com.cn时能根据网段判别出应该访问北京站点的web02服务器
那么接下来就开始干吧,首先在WinSrv2019-DNS服务器上创建出DNS客户端子网
以管理员方式运行Powershell
示例:
Add-DnsServerClientSubnet -Name "AmericaSubnet" -IPv4Subnet 192.0.0.0/24,182.0.0.0/24
Add-DnsServerClientSubnet -Name "EuropeSubnet" -IPv4Subnet 141.1.0.0/24,151.1.0.0/24
这里根据我的环境执行:
Add-DnsServerClientSubnet -Name "ChengduSubnet" -IPv4Subnet 172.16.1.0/24
Add-DnsServerClientSubnet -Name "BeijingSubnet" -IPv4Subnet 192.168.1.0/24
接下来需要创建区域范围,指定在basehome.com.cn的主区域内创建出成都和北京的2个逻辑地理区域
示例:
Add-DnsServerZoneScope -ZoneName "contosogiftservices.com" -Name "DublinZoneScope"
Add-DnsServerZoneScope -ZoneName "contosogiftservices.com" -Name "AmsterdamZoneScope"
这里根据我的环境执行:
Add-DnsServerZoneScope -ZoneName "basehome.com.cn" -Name "ChengduZoneScope"
Add-DnsServerZoneScope -ZoneName "basehome.com.cn" -Name "BeijingZoneScope"
接下来就需要在各自逻辑区域范围内添加A记录了
示例:
Add-DnsServerResourceRecord -ZoneName "contosogiftservices.com" -A -Name "www" -IPv4Address "151.1.0.1" -ZoneScope "DublinZoneScope”
Add-DnsServerResourceRecord -ZoneName "contosogiftservices.com" -A -Name "www" -IPv4Address "141.1.0.1" -ZoneScope "AmsterdamZoneScope"
这里根据我的环境执行:
Add-DnsServerResourceRecord -ZoneName "basehome.com.cn" -A -Name "web" -IPv4Address "172.16.1.10" -ZoneScope "ChengduZoneScope"
Add-DnsServerResourceRecord -ZoneName "basehome.com.cn" -A -Name "web" -IPv4Address "192.168.1.10" -ZoneScope "BeijingZoneScope"
接下来就是创建DNS的策略了,在此期间需要规划负载比例,也就是权重
比如我希望:
成都网段的客户端请求访问web.basehome.com.cn时成都web服务器承担75%的访问请求,北京web服务器承担25%访问请求,那么我就执行:
Add-DnsServerQueryResolutionPolicy -Name "ChengduLBPolicy" -Action ALLOW -ClientSubnet "eq,ChengduSubnet" -ZoneScope "ChengduZoneScope,3;BeijingZoneScope,1" -ZoneName "basehome.com.cn" –ProcessingOrder 1
北京网段的客户端请求访问web.basehome.com.cn时北京web服务器承担50%的访问请求,成都web服务器承担50%访问请求,那么我就执行:
Add-DnsServerQueryResolutionPolicy -Name "BeijingLBPolicy" -Action ALLOW -ClientSubnet "eq,BeijingSubnet" -ZoneScope "BeijingZoneScope,1;ChengduZoneScope,1" -ZoneName "basehome.com.cn" –ProcessingOrder 2
非成都和北京网段的客户端请求访问web.basehome.com.cn时成都web服务器承担50%的访问请求,北京web服务器承担50%访问请求,那么我就执行:
Add-DnsServerQueryResolutionPolicy -Name "WorldWidePolicy" -Action ALLOW -FQDN "eq,*.basehome.com.cn" -ZoneScope "ChengduZoneScope,1;BeijingZoneScope,1" -ZoneName "basehome.com.cn" -ProcessingOrder 3
其中需要解释的是-ProcessingOrder指的是策略的优先级顺序;最后一条-FQDN "eq,*.basehome.com.cn"中表示允许对basehome.com.cn的域名进行查询,ne是不等于的意思,eq是等于的意思,具体的可以参看:https://docs.microsoft.com/zh-cn/previous-versions/windows/powershell-scripting/mt126273(v=wps.640)
在我的环境中为了达到更好的效果,我将规划为:
成都网段的客户端请求访问web.basehome.com.cn时成都web服务器承担100%的访问请求:
Add-DnsServerQueryResolutionPolicy -Name "ChengduPolicy" -Action ALLOW -ClientSubnet "eq,ChengduSubnet" -ZoneScope "ChengduZoneScope,1" -ZoneName "basehome.com.cn" -ProcessingOrder 1
北京网段的客户端请求访问web.basehome.com.cn时北京web服务器承担100%的访问请求:
Add-DnsServerQueryResolutionPolicy -Name "BeijingPolicy" -Action ALLOW -ClientSubnet "eq,BeijingSubnet" -ZoneScope "BeijingZoneScope,1" -ZoneName "basehome.com.cn" -ProcessingOrder 2
非成都和北京网段的客户端请求访问web.basehome.com.cn时成都和北京的web服务器各承担50%的访问请求:
Add-DnsServerQueryResolutionPolicy -Name "WorldWidePolicy" -Action ALLOW -FQDN "eq,*.basehome.com.cn" -ZoneScope "ChengduZoneScope,1;BeijingZoneScope,1" -ZoneName "basehome.com.cn" -ProcessingOrder 3
最后到Winvista01客户端验证下
到WinVista02客户端验证下
整个过程只能通过Powershell完成,并且无法在执行后再DNS控制台查看到任何变化,因此如果要查询刚才做过的DNS客户端子网,区域范围,以及DNS策略,也只能通过Powershell来查询,修改删除。
如果想查看官方的介绍可以参看:https://docs.microsoft.com/zh-cn/windows-server/networking/dns/deploy/app-lb-geo
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Programming in Haskell
Graham Hutton / Cambridge University Press / 2007-1-18 / GBP 34.99
Haskell is one of the leading languages for teaching functional programming, enabling students to write simpler and cleaner code, and to learn how to structure and reason about programs. This introduc......一起来看看 《Programming in Haskell》 这本书的介绍吧!
在线进制转换器
各进制数互转换器
Base64 编码/解码
Base64 编码/解码