Recipe13.4.Creating a Zone


Recipe 13.4. Creating a Zone

Problem

You 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.

Solution

Using a graphical user interface

Use the following instructions to create a forward zone:

  1. From the Administrative Tools, 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. Expand the server in the left pane and click Forward Lookup Zones.

  4. Right-click on Forward Lookup Zones and select New Zone.

  5. Click Next.

  6. Select the zone type and click Next.

  7. If you selected Active Directory to store the zone data, you will be asked for the servers to which you want to replicate the DNS data. Click Next after you make your selection. (This applies to only Windows Server 2003.)

  8. Enter the zone name and click Next.

  9. Fill out the information for the remaining screens. They will vary depending on whether you are creating a primary, secondary, or stub zone.

Use these instructions to create a reverse zone:

  1. From the Administrative Tools, 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. Expand the server in the left pane and click on Reverse Lookup Zones.

  4. Right-click on Reverse Lookup Zones and select New Zone.

  5. Click Next.

  6. Select the zone type and click Next.

  7. If you selected Active Directory to store the zone data, you will be asked which servers you want to replicate the DNS data to. Click Next after you make your selection. (This applies to only Windows Server 2003.)

  8. Type the Network ID or enter a Reverse lookup zone name and click Next.

  9. Fill out the information for the remaining screens. They will vary depending on if you are creating a primary, secondary, or stub zone.

Using a command-line interface

The 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

When you create a file-based primary or secondary zone, the file that stores the contents of the zone is created under %SystemRoot%\system32\dns.


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

Discussion

Using a command-line interface

When 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 Also

Recipe 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



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