Recipe 13.4. Creating a ZoneProblemYou want to create a forward or reverse lookup zone. A forward lookup zone maps names to IP addresses or other names, and a reverse lookup zone maps IP addresses to names. SolutionUsing a graphical user interfaceUse the following instructions to create a forward zone:
Use these instructions to create a reverse zone:
Using a command-line interfaceThe following command creates an Active Directory-integrated forward or reverse zone: > dnscmd <ServerName> /zoneadd <ZoneName> /DsPrimary This example adds an Active Directory-integrated forward zone called rallencorp.com on dns01: > dnscmd dns01 /zoneadd rallencorp.com /DsPrimary This example adds an Active Directory-integrated reverse zone for 8.10.192.in-addr.arpa on dns01: > dnscmd dns01 /zoneadd 8.10.192.in-addr.arpa /DsPrimary This command creates a file-based zone: > dnscmd <ServerName> /zoneadd <ZoneName> /Primary /file <FileName> This example creates a file-based zone on the local host for the zone foobar.com: > dnscmd . /zoneadd foobar.com /Primary /file foobar.com.dns This command creates a file-based secondary zone: > dnscmd <ServerName> /zoneadd <ZoneName> /Secondary <MasterIPAddress> [ /file <FileName> ] This example creates a file-based secondary zone for 10.10.192.in-addr.arpa: > dnscmd dns01 /zoneadd 10.10.192.in-addr.arpa /Secondary 192.168.2.5
Using VBScript' This code creates an AD-integrated forward or reverse zone. ' ------ SCRIPT CONFIGURATION ------ strServer = "<ServerName>" ' e.g., dns01.rallencorp.com strNewZone = "<ZoneName>" ' e.g., othercorp.com or 8.10.192.in-addr.arpa. ' ------ END CONFIGURATION --------- set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS") set objDNSZone = objDNS.Get("MicrosoftDNS_Zone") strNull = objDNSZone.CreateZone(strNewZone, 0 , True) WScript.Echo "Created zone " & strNewZone DiscussionUsing a command-line interfaceWhen you create an Active Directory-integrated zone with the /DsPrimary switch, you can also include a /dp switch and specify an application partition to add the zone to. Here is an example: > dnscmd /zoneadd <ZoneName> /DsPrimary /dp domaindnszones.rallencorp.com See AlsoRecipe 13.7, MS KB 323445 (HOW TO: Create a New Zone on a DNS Server in Windows Server 2003), MSDN: DNS WMI Provider, and MSDN: CreateZone Method of the MicrosoftDNS_Zone Class |