Answer clients from the nearest datacenter with Windows DNS policy: client subnets, zone scopes, records per scope and ALLOW policies, plus weighted load balancing (SeattleZoneScope,2) and why the resolver IP is what matches.
Home › Guides › Geo-location DNS policy and load balancing
Last updated 23 November 2026
On Windows Server 2016 and later, an authoritative DNS server can answer the same name with a different address depending on where the query comes from. Microsoft's recipe has four steps: create DNS client subnets for each region (Add-DnsServerClientSubnet), create one zone scope per region or datacenter (Add-DnsServerZoneScope), add the record to each scope with that datacenter's address (Add-DnsServerResourceRecord ... -ZoneScope), and link subnet and scope with a zone level query resolution policy (Add-DnsServerQueryResolutionPolicy -Action ALLOW -ClientSubnet "eq,USSubnet" -ZoneScope "USZoneScope,1"). Clients that match no policy get the default zone scope. The same -ZoneScope parameter takes weights, so "SeattleZoneScope,2;ChicagoZoneScope,1;DallasZoneScope,1" sends about half the answers to Seattle. The catch: the policy sees the address of the resolver that sent the query, not the user's computer, and cached answers bypass the weighting.
Microsoft's geo-location article walks through the normal path: the user's computer asks its configured DNS server, usually the ISP's caching resolver (the article calls it the LDNS), and that resolver asks your authoritative server if the name isn't in its cache. So your server usually sees the resolver's address and only rarely the user's computer. Microsoft calls the resolver's address "a fair estimate" of the user's location because users query their local ISP's DNS server.
The article's note is the important part: DNS policies use the sender IP in the UDP or TCP packet that carries the query, and if the query passes through several resolvers, the policy only considers the IP of the last resolver that sent it to your server. Build your client subnets around the resolvers that actually reach you. Whether Windows DNS policy reads the EDNS Client Subnet option instead of the packet's source address is not covered in Microsoft's articles; they only describe the sender IP.
| Goal | What Microsoft configures | Policy shape |
|---|---|---|
| Send each region to its nearest datacenter | One client subnet and one zone scope per region, record per scope | One ALLOW policy per region: -ClientSubnet "eq,USSubnet" -ZoneScope "USZoneScope,1" |
| Answer everyone else | The same record in the default zone scope (no -ZoneScope) | No policy needed for the default zone scope |
| Split traffic by weight across datacenters | One zone scope per datacenter | One ALLOW policy listing several scopes with weights: "SeattleZoneScope,2;ChicagoZoneScope,1;DallasZoneScope,1" |
| Weighted split inside each region | Region client subnets plus datacenter scopes | One weighted policy per region, ordered with -ProcessingOrder |
| Weighted split for the rest of the world | All datacenter scopes | A last policy with every scope at weight 1 (Microsoft matches it on -FQDN, see the quirks below) |
| Same setup on secondary servers | Secondary zones plus copied subnets, scopes and policies | Covered in the zone transfer policies guide linked below |
Microsoft says to identify the subnets or IP address space of each region, for example from Geo-IP maps, and create a client subnet for each. A client subnet is a named group of IPv4 and IPv6 subnets; one client subnet can be used by many policies. Which Geo-IP source to use is not covered in Microsoft's article. The commands from the article (example values; replace them):
Add-DnsServerClientSubnet -Name "USSubnet" -IPv4Subnet "192.0.0.0/24" Add-DnsServerClientSubnet -Name "EuropeSubnet" -IPv4Subnet "141.1.0.0/24"
Both -IPv4Subnet and -IPv6Subnet take arrays in CIDR notation, so one client subnet can hold several ranges; the load balancing article uses Add-DnsServerClientSubnet -Name "AmericaSubnet" -IPv4Subnet 192.0.0.0/24,182.0.0.0/24. Run all of these steps on the DNS server that is authoritative for the zone, as a member of DnsAdmins or equivalent.
Add-DnsServerZoneScope -ZoneName "woodgrove.com" -Name "USZoneScope" Add-DnsServerZoneScope -ZoneName "woodgrove.com" -Name "EuropeZoneScope"
A zone scope is a separate instance of the zone with its own records, and the same record can be in several scopes with the same or different addresses. Every zone already has a default scope with the same name as the zone, and legacy DNS operations work on it. The cmdlet reference adds that a scope name can't be the zone name and that each scope is stored in %Systemroot%\system32\dns\<zone name>\<scope name>.dns. The split-brain DNS guide covers zone scopes in Active Directory integrated zones.
Add-DnsServerResourceRecord -ZoneName "woodgrove.com" -A -Name "www" -IPv4Address "192.0.0.1" -ZoneScope "USZoneScope" Add-DnsServerResourceRecord -ZoneName "woodgrove.com" -A -Name "www" -IPv4Address "141.1.0.1" -ZoneScope "EuropeZoneScope" Add-DnsServerResourceRecord -ZoneName "woodgrove.com" -A -Name "www" -IPv4Address "192.0.0.1" Add-DnsServerResourceRecord -ZoneName "woodgrove.com" -A -Name "www" -IPv4Address "141.1.0.1"
The first two lines put the U.S. and European addresses in their scopes. The last two add both addresses to the default scope (no -ZoneScope, the same as adding records to a normal zone), so that, in Microsoft's words, the rest of the world can still reach the web server in either datacenter. Skip them and clients outside both subnets get whatever the default scope holds for www.
Add-DnsServerQueryResolutionPolicy -Name "USPolicy" -Action ALLOW -ClientSubnet "eq,USSubnet" -ZoneScope "USZoneScope,1" -ZoneName "woodgrove.com" Add-DnsServerQueryResolutionPolicy -Name "EuropePolicy" -Action ALLOW -ClientSubnet "eq,EuropeSubnet" -ZoneScope "EuropeZoneScope,1" -ZoneName "woodgrove.com"
When a query's source address matches one of these policies, the server answers from that policy's zone scope; no policy is needed for the default scope. New policies apply dynamically, without restarting the DNS Server service (the DNS Policies Overview makes one exception: on read-only domain controllers, new policies load only after the service restarts). The -ClientSubnet criterion takes EQ and NE lists, at most one of each, for example "EQ,NorthAmerica,Asia,NE,Europe"; EQ values are OR'd, NE values are AND'd. The other criteria and the DENY and IGNORE actions are in the DNS policy query filters guide.
The -ZoneScope value is a list of scopes and weights in the format Scope01, Weight01; Scope02, Weight02;. Microsoft's application load balancing article creates SeattleZoneScope, DallasZoneScope and ChicagoZoneScope in contosogiftservices.com, adds www with 192.0.0.1, 162.0.0.1 and 182.0.0.1, and then:
Add-DnsServerQueryResolutionPolicy -Name "AmericaPolicy" -Action ALLOW -ZoneScope "SeattleZoneScope,2;ChicagoZoneScope,1;DallasZoneScope,1" -ZoneName "contosogiftservices.com"
With weights 2, 1 and 1 the server answers 50% of the time with Seattle and 25% each with Dallas and Chicago: for every four queries, two Seattle answers and one each for Dallas and Chicago. The overview gives the general rule: weights 3 and 5 mean the first scope answers three out of eight requests.
Microsoft's caveat: DNS clients and resolvers cache records and don't ask again until the TTL runs out, which works against the split. Its mitigation is a low TTL on the load balanced records. Add-DnsServerResourceRecord has a -TimeToLive parameter (a TimeSpan; the reference examples use 01:00:00), so a record could be added with, for example, -TimeToLive 00:05:00. That value is my example; what TTL to choose is not covered in Microsoft's article.
Microsoft's follow-up article combines both: North American queries split 50/25/25 across Seattle, Chicago and Dallas, European queries split 50/50 across Dublin and Amsterdam, and everyone else is spread across all five datacenters. It adds region subnets, two more scopes and their records:
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-DnsServerZoneScope -ZoneName "contosogiftservices.com" -Name "DublinZoneScope" Add-DnsServerZoneScope -ZoneName "contosogiftservices.com" -Name "AmsterdamZoneScope" 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"
New scopes can be added next to the existing ones without changing them and without restarting the DNS server. The policies, ordered so the region policies are evaluated before the catch-all (the overview: the server applies the first policy whose criteria match, and processing order values are unique per level):
Add-DnsServerQueryResolutionPolicy -Name "AmericaLBPolicy" -Action ALLOW -ClientSubnet "eq,AmericaSubnet" -ZoneScope "SeattleZoneScope,2;ChicagoZoneScope,1;DallasZoneScope,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,*.contosogiftservices.com" -ZoneScope "SeattleZoneScope,1;ChicagoZoneScope,1;DallasZoneScope,1;DublinZoneScope,1;AmsterdamZoneScope,1" -ZoneName "contosogiftservices.com" -ProcessingOrder 3
These are not a straight copy. Fix these quirks if you paste from Microsoft's page:
TexasZoneScope, but the earlier article creates DallasZoneScope. I used DallasZoneScope above so the policies point at a scope that exists; what the server does with a policy that names a missing scope is not covered in Microsoft's articles.-FQDN "eq,*.contoso.com" while the zone is contosogiftservices.com. My reading is that it would not match queries for www.contosogiftservices.com, so I changed it to *.contosogiftservices.com (my change, not Microsoft's).DublinZoneScope and an en dash in –ProcessingOrder 1. PowerShell itself accepts an en dash in place of a hyphen, but the commands above use straight quotes and plain hyphens to be safe."ChicagoZoneScope,1; TexasZoneScope,1"). Whether the space matters isn't stated; I removed it.Get-DnsServerClientSubnet Get-DnsServerClientSubnet -Name "AsiaSubnet" | Format-List Set-DnsServerClientSubnet -Name "AsiaSubnet" -Action ADD -IPv4Subnet 192.168.0.4/16 -PassThru Set-DnsServerClientSubnet -Name "AsiaSubnet" -Action REPLACE -IPv6Subnet 0db8::1/8 -PassThru Set-DnsServerClientSubnet -Name "AsiaSubnet" -Action REMOVE -IPv4Subnet 10.0.0.1/8 -PassThru Remove-DnsServerClientSubnet -Name AsiaSubnet -PassThru -Force
Set-DnsServerClientSubnet takes -Action ADD, REMOVE or REPLACE and works on the IPv4 list, the IPv6 list or both. That is how you update a region when its address ranges change, without touching the policies. Remove-DnsServerClientSubnet refuses to remove a client subnet that any DNS policy still uses, so remove or change those policies first. Microsoft's remove-all example is Get-DnsServerClientSubnet | Remove-DnsServerClientSubnet -PassThru -Force. The sample output on these reference pages doesn't always match the command (for example, an added 0db8::1/28 is shown as 3ffe::1/28), so treat it as illustration only.
Get-DnsServerQueryResolutionPolicy -ZoneName "woodgrove.com" Get-DnsServerZoneScope -ZoneName "woodgrove.com" Get-DnsServerResourceRecord -ZoneName "woodgrove.com" -Name "www" -ZoneScope "USZoneScope"
The first line lists the zone's policies with their processing order; the second the scopes, including the default one; the third is my example built from the cmdlet's parameter list and shows the record in one scope. A good end-to-end test is to query your server directly (for example nslookup www.woodgrove.com <server address>) from a machine whose address is inside one of the client subnets and then from one outside them. That test is my suggestion; Microsoft's articles don't include a test step.
-ZoneScope against Get-DnsServerZoneScope (see the TexasZoneScope quirk above).To serve internal and external clients different answers from one server, use split-brain DNS with DNS policy zone scopes. To block or ignore queries, see DNS policy query filters.
Look up DNS Server events such as 4013 and 4015 in the Windows Event ID Lookup, copy the client subnet, zone scope and query resolution policy lines from the PowerShell Cheat Sheet, pull resolver addresses out of exported DNS server logs with the Regex Tester, work out the CIDR ranges for each client subnet with the IPv4 Subnet Calculator or IPv6 Subnet Calculator, and identify the adapters on a multihomed DNS server with the MAC Vendor Lookup. Related guides: split-brain DNS with DNS policy zone scopes, DNS policy query filters, zone transfer policies and DNS policy on secondary servers and common Windows DNS Server and DHCP Server errors.
Every Windows DNS Server and DHCP Server event and symptom in one place: common Windows DNS Server and DHCP Server errors.
Create a DNS client subnet per region with Add-DnsServerClientSubnet, a zone scope per region with Add-DnsServerZoneScope, add the record to each scope with that region's address, and add a zone level Add-DnsServerQueryResolutionPolicy with -Action ALLOW, -ClientSubnet eq plus the subnet name and -ZoneScope set to the region's scope. Clients that match no policy get the default zone scope.
The policy matches the source address of the query packet, which is usually the user's ISP or public resolver, and only the last resolver that sent the query to your server counts. If that resolver's address is not in the region's client subnet, the query falls through to another policy or the default zone scope.
The value is a list of scope and weight pairs separated by semicolons. With SeattleZoneScope,2;ChicagoZoneScope,1;DallasZoneScope,1 the server answers with Seattle half the time and with Chicago and Dallas a quarter each. Weights 3 and 5 mean three answers out of eight from the first scope.
Resolvers and clients cache the answer for the record's TTL and don't query your server again until it expires. Microsoft's mitigation is a low TTL on the load balanced records.
No. Remove-DnsServerClientSubnet cannot remove a client subnet that appears in any DNS policy. Change or remove those policies first, or update the subnet's ranges in place with Set-DnsServerClientSubnet -Action ADD, REMOVE or REPLACE.
Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.