Cisco CNS Network Registrar CLI Reference Guide, 5.5
About the nrcmd Program
Downloads: This chapterpdf (PDF - 166.0KB) | Feedback

About the nrcmd Program

Table Of Contents

About the nrcmd Program

Invoking the nrcmd Command

Command Organization

Command Usage

Create Keyword

Set Keyword

Enable Keyword

Attribute Flags

Saving Your Changes

Command Line Navigation Keys

nrcmd Commands


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 nrcmd command line interface.

It specifically describes:

Invoking the nrcmd command

Using the nrcmd command arguments

Listing the nrcmd commands

Invoking the nrcmd Command

You can use the nrcmd 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.


The command syntax is as follows:

nrcmd [general_options] [command] [specific_options]

Table 1-1 describes the general options. Chapter 2, "Using the nrcmd Commands," describes the commands and their specific options.

Table 1-1 General Options to nrcmd Command 

Option
Description

-C cluster

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

-N user

user is the Network Registrar user name.

-P password

password is the password of the Network Registrar user.

-h

prints help text.

-r

logs in as a read-only user.

-b filename.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 nrcmd commands 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 common methods, 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 ipaddress mask [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:

nrcmd> scope testScope create 128.103.1.1 255.255.255.0 dns-zone-name=example.com. 

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:

nrcmd> zone QuickExample.com set auth-servers=196.68.1.10,196.68.1.20 

For example, to set the client's client-class and domain-name, enter:

nrcmd> client 1,6,02:02:02:02:02:02 set client-class-name=internal 
domain-name=QuickExample.com 

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 boolean attribute, 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:

Invoking the save command

Exiting from nrcmd

Reloading a server

Adding a resource record or a host to a zone


Note Network Registrar saves resource records immediately.


Command Line Navigation Keys

Table 1-2 lists keyboard navigation key combinations that are useful when entering nrcmd commands.

Table 1-2 nrcmd Navigation Key Combinations 

Key Combination
Action

Control-a

Go to the beginning of the line

Control-b

Back one character

Control-d

Delete one character

Control-e

Go to the end of the line

Control-f

Forward one character

Control-k

Kill to the end of the line

Control-l

Redraw the line

Control-n

Next line in the history

Control-p

Previous line in the history

Control-t

Shift an individual character left

Control-u

Delete the line and move the cursor to the beginning of the line

Control-w

Delete one word backwards

Esc-b

Back one word

Esc-f

Forward one word


nrcmd Commands

Table 1-3 lists the nrcmd commands, alphabetically. You can use these commands on the command line or insert them into scripts.

Table 1-3 nrcmd Commands 

Command
Description

address-block

Creates and sets properties for address blocks

address-block-policy

Configures DHCP embedded policies for address blocks

admin

Creates administrators and assigns them passwords

client

Creates clients and assigns them to client-classes

client-class

Creates client-classes

client-class policy

Sets embedded client-class policies

client-policy

Sets embedded client policies

custom-option

Creates a custom DHCP option

dhcp

Specifies the DHCP server attributes

dhcp-interface

Specifies the IP address of the DHCP server's hardware card

dns

Specifies the DNS server attributes

exit

Quits the nrcmd command

export

Writes the state of the lease or a zone to a file

extension

Integrates user-written DHCP extensions into the Network Registrar DHCP server

force-lock

Obtains an exclusive lock for the nrcmd command session

help

Provides online help

import

Loads configuration information from a file

ldap

Specifies the LDAP remote server attributes

lease

Retrieves information about DHCP leases

lease-notification

Notifies you when you run out of available leases in a scope

license

Views and updates license information

namespace

Creates and sets properties for namespaces

option-datatype

Defines data types for use in defining vendor-supplied DHCP options

policy

Specifies the policy information

remote-dns

Specifies information about remote DNS servers

report

Creates a summary of the dynamic and static IP address utilization for one or more clusters

save

Saves the current configuration changes

scope

Specifies scope attributes

scope-policy

Sets embedded scope attributes

scope-selection-tag

Creates scope selection tags

server

Affects server behavior

session

Configures session parameters

subnet

Retrieves information about subnets

tftp

Specifies the Trival File Transport Protocol (TFTP) server attributes

trap

Activates Simple Network Management Protocol (SNMP) traps

vendor-option

Defines vendor-supplied DHCP options

zone

Specifies DNS zone attributes