使用應用程式負載平衡的地理位置感知 DNS 原則Use DNS Policy for Application Load Balancing With Geo-Location Awareness

適用於:Windows Server(以每年次管道)、Windows Server 2016Applies To: Windows Server (Semi-Annual Channel), Windows Server 2016

您可以使用本主題以了解如何設定 DNS 負載平衡應用程式的地理位置認知的原則。You can use this topic to learn how to configure DNS policy to load balance an application with geo-location awareness.

本指南,在前一個主題使用 DNS 原則的應用程式負載平衡、使用範例虛構公司-Contoso 禮品服務-online 贈送所提供的服務,和這已網站命名 contosogiftservices.com。Contoso 禮品服務負載平衡 online Web 應用程式之間北美位於西雅圖縣、伊利諾州芝加哥,以及達拉斯、傳送的資料中心中的伺服器。The previous topic in this guide, Use DNS Policy for Application Load Balancing, uses an example of a fictional company - Contoso Gift Services - which provides online gifting services, and which has a Web site named contosogiftservices.com. Contoso Gift Services load balances their online Web application between servers in North American datacenters located in Seattle, WA, Chicago, IL, and Dallas, TX.

注意

建議您,您熟悉的主題適用於應用程式負載平衡使用 DNS 原則之前,請先執行此案例中的指示操作。It is recommended that you familiarize yourself with the topic Use DNS Policy for Application Load Balancing before performing the instructions in this scenario.

本主題使用相同虛構公司和網路基礎結構做為基礎的新的範例部署包含地理位置感知。This topic uses the same fictional company and network infrastructure as a basis for a new example deployment that includes geo-location awareness.

在此範例中,以 Contoso 禮品服務成功全球的展開他們卡。In this example, Contoso Gift Services is successfully expanding their presence across the globe.

北美洲類似,公司現在已在歐洲資料中心裝載的網頁伺服器。Similar to North America, the company now has web servers hosted in European datacenters.

設定應用程式負載平衡適用於歐洲的資料中心 DNS 原則實作在美國,類似的方式使用應用程式流量分配,愛爾蘭都柏林,阿姆斯特丹、 荷蘭、 中或其他地方找到的網頁伺服器要 Contoso 禮品服務 DNS 系統管理員。Contoso Gift Services DNS Administrators want to configure application load balancing for European datacenters in a similar manner to the DNS policy implementation in the United States, with application traffic distributed among Web servers that are located in Dublin, Ireland, Amsterdam, Holland, and elsewhere.

DNS 系統管理員也可以從其他位置世界同樣分散在所有的資料中心中的所有查詢。DNS Administrators also want all queries from other locations in the world distributed equally between all of their datacenters.

中的下一個區段中,您可以了解如何達成類似的目標,以 Contoso DNS 您自己的網路系統管理員的。In the next sections you can learn how to achieve similar goals to those of the Contoso DNS Administrators on your own network.

如何設定平衡的地理位置感知應用程式How to Configure Application Load Balancing with Geo-Location Awareness

下列區段會顯示如何設定的應用程式負載平衡的地理位置感知 DNS 原則。The following sections show you how to configure DNS policy for application load balancing with geo-location awareness.

重要

以下的各節包含包含許多參數值範例範例 Windows PowerShell 命令。The following sections include example Windows PowerShell commands that contain example values for many parameters. 請確認值是適用於您的部署,執行下列命令之前,先取代範例值這些命令列中。Ensure that you replace example values in these commands with values that are appropriate for your deployment before you run these commands.

建立 DNS Client 子網路Create the DNS Client Subnets

您第一次必須找出子網路的 IP 位址空間北美洲、 歐洲的地區。You must first identify the subnets or IP address space of the North America and Europe regions.

您可以從地理 IP 「 地圖 」 來取得此資訊。You can obtain this information from Geo-IP maps. 依據這些地理 IP 散發,您必須建立 DNS Client 子網路。Based on these Geo-IP distributions, you must create the DNS Client Subnets.

DNS Client 子網路是 IPv4 或 IPv6 子網路,查詢會傳送至 DNS 伺服器的邏輯群組。A DNS Client Subnet is a logical grouping of IPv4 or IPv6 subnets from which queries are sent to a DNS server.

若要建立 DNS Client 子網路,您可以使用下列的 Windows PowerShell 命令。You can use the following Windows PowerShell commands to create DNS Client Subnets.

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

如需詳細資訊,請查看新增-DnsServerClientSubnetFor more information, see Add-DnsServerClientSubnet.

建立區域範圍Create the Zone Scopes

Client 子網路中的位置之後,您必須到不同的區域的範圍,datacenter 針對每個分割區 contosogiftservices.com。After the client subnets are in place, you must partition the zone contosogiftservices.com into different zone scopes, each for a datacenter.

時區領域是區域的唯一執行個體。A zone scope is a unique instance of the zone. DNS 區域可以有多個區域領域,與每個包含 DNS 記錄它自己設定的區域範圍。A DNS zone can have multiple zone scopes, with each zone scope containing its own set of DNS records. 相同記錄可能會出現在多個領域,以不同的 IP 位址或相同的 IP 位址。The same record can be present in multiple scopes, with different IP addresses or the same IP addresses.

注意

根據預設,區域領域存在於 DNS 區域。By default, a zone scope exists on the DNS zones. 這個區域領域作為區域,具有相同的名稱,並在這個領域中工作舊版 DNS 作業。This zone scope has the same name as the zone, and legacy DNS operations work on this scope.

在應用程式負載平衡前一個案例示範如何設定的資料中心有三種區域範圍北美地區。The previous scenario on application load balancing demonstrates how to configure three zone scopes for datacenters in North America.

使用下列命令,您可以建立兩個更多區域範圍,其中每個的都柏林和阿姆斯特丹資料中心。With the commands below, you can create two more zone scopes, one each for the Dublin and Amsterdam datacenters.

您可以新增相同時區中的三個現有北美地區時區領域這些區域範圍,而無須進行任何變更。You can add these zone scopes without any changes to the three existing North America zone scopes in the same zone. 此外,在建立這些區域範圍之後,您不需要重新開機您的 DNS 伺服器。In addition, after you create these zone scopes, you do not need to restart your DNS server.

您可以使用下列的 Windows PowerShell 命令來建立區域範圍。You can use the following Windows PowerShell commands to create zone scopes.

Add-DnsServerZoneScope -ZoneName "contosogiftservices.com" -Name "DublinZoneScope"
Add-DnsServerZoneScope -ZoneName "contosogiftservices.com" -Name "AmsterdamZoneScope"

如需詳細資訊,請查看新增-DnsServerZoneScopeFor more information, see Add-DnsServerZoneScope

若要的區域領域加入資料Add Records to the Zone Scopes

現在,您必須新增到區域領域代表網頁伺服器主機記錄。Now you must add the records representing the web server host into the zone scopes.

在前一個案例中新增的記錄地區資料中心。The records for the America datacenters were added in the previous scenario. 您可以使用下列 Windows PowerShell 命令若要適用於歐洲的資料中心區域領域加入資料。You can use the following Windows PowerShell commands to add records to the zone scopes for European datacenters.

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"

如需詳細資訊,請查看新增-DnsServerResourceRecordFor more information, see Add-DnsServerResourceRecord.

建立 DNS 原則Create the DNS Policies

您所建立的磁碟分割 (區域領域) 並新增了記錄之後,您必須建立 DNS 原則,連入查詢分配這些範圍。After you have created the partitions (zone scopes) and you have added records, you must create DNS policies that distribute the incoming queries across these scopes.

針對此範例中,在不同的資料中心中的應用程式伺服器查詢 distribution 符合下列條件。For this example, query distribution across application servers in different datacenters meets the following criteria.

  1. DNS 查詢收到時來源北美 client 子網路中的 DNS 回應 50%指到西雅圖資料中心,25%的回應指向芝加哥資料中心,達拉斯 datacenter 指向剩餘 25%的回應。When the DNS query is received from a source in a North American client subnet, 50% of the DNS responses point to the Seattle data center, 25% of responses point to the Chicago datacenter, and the remaining 25% of responses point to the Dallas datacenter.
  2. 來源歐洲 client 子網路中收到 DNS 查詢時,50%的 DNS 回應都柏林 datacenter,指向 [和 50%的 DNS 回應指向阿姆斯特丹資料中心。When the DNS query is received from a source in a European client subnet, 50% of the DNS responses point to the Dublin datacenter, and 50% of the DNS responses point to the Amsterdam datacenter.
  3. 查詢來自其他地方的世界中,當 DNS 回應分散在所有的五個資料中心。When the query comes from anywhere else in the world, the DNS responses are distributed across all five datacenters.

您可以使用下列 Windows PowerShell 命令來執行這些 DNS 原則。You can use the following Windows PowerShell commands to implement these DNS policies.

Add-DnsServerQueryResolutionPolicy -Name "AmericaLBPolicy" -Action ALLOW -ClientSubnet "eq,AmericaSubnet" -ZoneScope "SeattleZoneScope,2;ChicagoZoneScope,1; TexasZoneScope,1" -ZoneName "contosogiftservices.com" –ProcessingOrder 1

Add-DnsServerQueryResolutionPolicy -Name "EuropeLBPolicy" -Action ALLOW -ClientSubnet "eq,EuropeSubnet" -ZoneScope "DublinZoneScope,1;AmsterdamZoneScope,1" -ZoneName "contosogiftservices.com" -ProcessingOrder 2

Add-DnsServerQueryResolutionPolicy -Name "WorldWidePolicy" -Action ALLOW -FQDN "eq,*.contoso.com" -ZoneScope "SeattleZoneScope,1;ChicagoZoneScope,1; TexasZoneScope,1;DublinZoneScope,1;AmsterdamZoneScope,1" -ZoneName "contosogiftservices.com" -ProcessingOrder 3

如需詳細資訊,請查看新增-DnsServerQueryResolutionPolicyFor more information, see Add-DnsServerQueryResolutionPolicy.

您現在已成功建立 DNS 原則,以提供應用程式負載平衡位於多個大陸上五個不同的資料中心中的網頁伺服器上。You have now successfully created a DNS policy that provides application load balancing across Web servers that are located in five different datacenters on multiple continents.

您可以建立數千 DNS 原則根據您的資料傳輸管理的需求,且所有的新原則已經套用動態-不需要重新 DNS 伺服器-連入查詢。You can create thousands of DNS policies according to your traffic management requirements, and all new policies are applied dynamically - without restarting the DNS server - on incoming queries.