Recipe 13.9. Configuring Conditional Forwarding
ProblemYou want to configure conditional forwarding to streamline name resolution in your environment. SolutionUsing a graphical user interface
Using a command-line interfaceThe following command sets the default forwarders. Replace <IPsOfForwarders> with a space-separated list of IP addresses for the name servers to forward requests to: > dnscmd <ServerName> /resetforwarders <IPsOfForwaders> For example: > dnscmd dns01 /resetforwarders 10.22.3.4 10.22.3.5 The following command creates a domain-based forwarder: > dnscmd <ServerName> /zoneadd <DomainName> /forwarder <IPsOfForwarders> The following command configures the default forwarder timeout: > dnscmd <ServerName> /config /forwardingtimeout <NumSeconds> The following command configures the forwarder timeout for a specific domain: > dnscmd <ServerName> /config <DomainName> /forwardertimeout <NumSeconds> Using VBScript' This code enumerates the default forwarders. ' ------ SCRIPT CONFIGURATION ------ strServer = "<ServerName> " ' e.g., dns1.rallencorp.com ' ------ END CONFIGURATION --------- set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS") set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""") for each strForwarder in objDNSServer.Forwarders Wscript.Echo strForwarder next ' This code sets the default forwarders. ' ------ SCRIPT CONFIGURATION ------ strServer = "<ServerName>" ' e.g., dns1.rallencorp.com arrForwarders = Array("<IP1>","<IP2>") ' ------ END CONFIGURATION --------- set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS") set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""") objDNSServer.Forwarders = arrForwarders objDNSServer.Put_ Wscript.Echo "Successfully set default forwarders" ' This code sets the forwarders for a specific domain. ' ------ SCRIPT CONFIGURATION ------ strServer = "<ServerName>" ' e.g., dns01 strNewZone = "<ZoneName>" ' e.g., othercorp.com arrMasterIPs = Array("<IP1>","<IP2>") ' replace <IPx> with IPs of master server ' ------ END CONFIGURATION --------- on error resume next set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS") set objDNSZone = objDNS.Get("MicrosoftDNS_Zone") strNull = objDNSZone.CreateZone(strNewZone,3,false,"",arrMasterIPs) if Err then WScript.Echo "Error occurred creating zone: " & Err.Description else WScript.Echo "Domain forwarder created." end if DiscussionName servers have long supported the notion of forwarders. The idea is that instead of forwarding all unresolved queries to the root Internet name servers, you'd forward those queries to a specific server or set of servers. This allows you to control the flow of name resolution. Microsoft extended this capability in Windows Server 2003 to support conditional forwarding. With conditional forwarding, you can forward unresolved queries for specific domains to different name servers. The most common use of conditional forwarding is when you have two or more discontinguous namespaces. Consider the example in Figure 13-1. Here, both rallencorp.com and othercorp.com are owned by the same company. Normally, for name servers of rallencorp.com to resolve queries for othercorp.com, the queries would first have to be forwarded to the root Internet name servers. With conditional forwarding, you can specify that all requests for othercorp.com are to be sent to othercorp.com name servers and all other unresolved queries are to be sent to the Internet. Figure 13-1. Conditional forwarding exampleSee AlsoRecipe 13.8, MS KB 304491 (Conditional Forwarding in Windows Server 2003), and MS KB 811118 (Support WebCast: Microsoft Windows Server 2003 DNS: Stub Zones and Conditional Forwarding) |