Recipe13.9.Configuring Conditional Forwarding


Recipe 13.9. Configuring Conditional Forwarding

Conditional forwarding is a new feature in Windows Server 2003, so this recipe will not work on Windows 2000.


Problem

You want to configure conditional forwarding to streamline name resolution in your environment.

Solution

Using a graphical user interface

  1. Open the DNS snap-in (dnsmgmt.msc).

  2. Connect to the DNS Server you want to modify. In the left pane, right-click on DNS and select Connect to DNS Server. Select The following computer and enter the target server name. Click OK.

  3. Right-click on the server and select Properties.

  4. Click the Forwarders tab.

  5. To configure a global forwarder, make sure All other DNS domains is selected under DNS domain, type an IP under Selected domain's forwarder IP address list, click Add, and Apply.

  6. To configure a forwarder for a specific domain, click the New button.

  7. Enter the domain name and click OK.

  8. Add IPs as described for global forwarders.

  9. From the Forwarders tab, you can also set the number of seconds the server waits before forward queries times out, and you can disable the use of recursion for certain domains. Both of these can be set on a per-domain basis.

Using a command-line interface

The 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

Discussion

Name 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 example


See Also

Recipe 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)



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net