Table Of Contents

About the nrcmd Program

You can use either the graphical user interface (GUI) or the nrcmd command line interface (CLI) to configure and manage your DNS, DHCP, and TFTP servers. This chapter describes how to use the nrcmdcommand line interface.

It specifically describes:

•Invoking the nrcmdcommand

•Using the nrcmd command arguments

•Listing the nrcmd commands

Invoking the nrcmd Command

You can use thenrcmd command in batch mode by executing scripts that use the commands or by using the interactive mode in which you enter commands at the nrcmd command prompt.

Note The nrcmd command is located in \Program Files\Network Registrar\bin on Windows and in /opt/nwreg2/usrbin on Solaris.

cluster is the name of the machine on which the Network Registrar servers are running. If not specified, the cluster name defaults to localhost.

-Nuser

user is the Network Registrar user name.

-Ppassword

password is the password of the Network Registrar user.

-h

prints help text.

-r

logs in as a read-only user.

-bfilename.txt

filename is the name of a file of nrcmd commands that run in batch mode; reading a line at a time and printing a new line after the prompt.

If you omit the general options, Network Registrar gets them from the Registry or environment variables. If Network Registrar cannot find values for these parameters, it prompts you for them. If you omit the cluster name on a system where Network Registrar servers are installed, the nrcmd program assumes access to localhost and does not prompt you.

The Registry and environment variables are AIC_NAME for the name, AIC_PASSWORD for the password, and AIC_CLUSTER for the cluster name. The Solaris and Linux Registry keys are in a file with the user's login name in the var/nwreg2/data/registry directory, with the file contents in the form name=value. The Windows Registry path is Software\American Internet\Network Registrar\2.0 and the key is HKEY_CURRENT_USER.

To execute the command line interface in interactive mode, enter:

nrcmd [-C cluster] [-N user] [-P password]

Typing this command displays the interactive prompt nrcmd> to which you enter:

nrcmd> command[optional-parameters]

To specify a series of items, use commas between the items. Do not add a space after the comma. For example:

nrcmd> zone example.com. set dynupdate-set=192.168.1.1,127.0.0.1

To terminate an interactive session, enter the exit command.

To view the online help, enter the help command.

Command Organization

The nrcmdcommands specify a class of object, which you can create, delete, or list. Each of these objects in turn has attributes, which you can enable, disable, set, get, and unset, depending on data type. These objects may also have commonmethods, which are specific to the type of object, and that let you perform operations on groups of attributes.

When you use the nrcmd commands to configure Network Registrar, you manipulate the following:

•Classes of objects—these are things that you can create, delete, show or list, such as scopes, policies, or zones.

–create—creates an entry. If the entry already exists, this command overwrites it with the new information.

–delete—removes an entry.

–list—displays all the objects of a given type, including all attributes.

–listnames—displays only the names of all objects of a given type.

–show—displays the values of all the attributes.

•Attributes of objects—these are things that you can enable or disable, or whose value you can set or display using the following common methods:

–enable—enables a Boolean type of attribute.

–disable—disables a Boolean type of attribute.

–set—sets the value of an attribute.

–get—displays the value of an attribute.

–unset—makes an attribute have no value. You cannot unset required attributes.

•Other custom methods—these are specific operations that you can perform on an object, beyond editing its attributes. Examples are adding a range of IP addresses to a scope, or removing hosts from a zone.

Command Usage

How you specify a series of arguments depends on the type of command you are using. The following shows the differences when using the create, set, and enable commands.

Create Keyword

When you use the create keyword and there are required arguments, you must supply them. You can also supply additional arguments. You must supply the required arguments in the specified order; however, you can specify the optional arguments in any order with the syntax attribute=value.

For example, the syntax for creating a scope is as follows:

scope name create ipaddressmask [attribute=value]

This means that you must supply an IP address and mask when you create a scope, and you can optionally specify other attributes of the scope.

The following example creates the scope testScope with the IP address of 128.103.1.1 and a mask of 255.255.255.0:

nrcmd> scope testScope create 128.103.1.1 255.255.255.0

For example, if you want to create a scope and also specify the name of the DNS zone to which a DHCP client's host name should be added, enter:

After the create keyword creates and assigns all specified parameters to the object, it checks that all the required attributes have values (either defaults or user-specified). If you neglect to supply the required attributes, Network Registrar reports an error.

Set Keyword

You use the set keyword to set the value of a attribute. If you want to set a list of things, such as DNS servers, or IP addresses, you can separate them with commas. You can also use the set keyword to set several attributes on a single line—just specify the attribute and its value followed by a space and the next attribute and value pair.

For example, to specify the name of the DNS zone to which a DHCP client's host name should be added, enter:

nrcmd> scope testScope set dns-zone-name=QuickExample.com

For example, to specify the list of IP addresses that you will allow to perform zone transfers, enter:

The unset keyword places an attribute in the undefined state. The get keyword displays the value for an attribute.

Enable Keyword

You use the enable keyword to enable a boolean attribute. After you enable one boolean attribute, you may need to set its associated attributes. Use the disable keyword to disable a boolean attribute. You can use the unset keyword to remove the enabled or disabled state of the boolean attribute.

For example, to enable incremental transfer processing for the DNS server, enter:

nrcmd> dns enable ixfr-enable

To change the incremental transfer expiration interval, enter:

nrcmd> dns set ixfr-expire-interval=10d

Note You cannot add set keywords to an enable command line. You need to first enable the booleanattribute, and then, on the next command line, set the associated attributes.

Attribute Flags

Command attributes are described as follows:

•Required—The attribute is required for the object. You must set the attribute or accept its default, and you can modify the value. You cannot use the unset keyword to set a required attribute to undefined. Trying to do so returns the error message "386 - Required attribute cannot be deleted."

•Optional—The attribute is optional and does require a value. You can set and reset the attribute, and you can use the unset keyword to make it undefined.

•Read-only—The attribute is immutable and read-only. You can use the get keyword with the attribute, but you cannot set or unset it. Trying to set or unset a read-only attribute returns the error message "385 - Read-only attribute cannot be modified."

Saving Your Changes

The CLI waits for one of the following events to occur before it saves your changes to the database: