ezset(n) 1.3 ezset "Easy Set Commands"

NAME

ezset - set common configuration parameters

SYNOPSIS

package require libcisco

ezset password PwType CurrentPw NewPw
ezset banner ?options? Banner
ezset hostname Hostname
ezset contact Contact
ezset location Location
ezset community ?options? StringType Community?,Acl? ... ?Community?,Acl??
ezset acl ?options? AclNum AclList
ezset permitlist ?options? PermitList
ezset ippermit Operator Operand

DESCRIPTION

The ezset command is used to set common configuration parameters on Cisco network equipment. The first argument to ezset specifies the configuration element to set on the target device. A list of valid elements and their associated options is detailed below.

Note: Before making a call to ezset, a session must first be opened to the target device using the session open command.

COMMANDS

ezset password PwType CurrentPw NewPw
Sets the password on the target device.

PwType may be one of two options--login or enable. The login option will set the local login password on all vty, con, and aux lines if the target system is an IOS-based device. If the target system is running Catalyst Code, the local login password will be set. If the target device is a 1900, the "enable password level 1" will be set to NewPw. The enable option will set the "enable secret" password if the target system is an IOS-based device. If the device is running Catalyst Code, the local enable password will be set. If the target device is a 1900, the "enable password level 15" will be set to NewPw.

CurrentPw is the current password. This will usually be the same password that was used to either open the session or put it into enable mode.

NewPw is the new password to be set.

On success, ezset password returns 0. On error, a short text message is returned beginning with the string "err".

ezset banner ?options? Banner
Sets the login banner on the target system.

Banner is by default assumed to be a Tcl list. Each element of the list is a separte line of text. The lines of text that make up the list need not have leading or trailing newline characters as these will be automatically added when the banner is set on the target system. If the target system is an IOS-based device, this command will set the "banner login." If the target system is running Catalyst Code, the "set banner motd" command will be issued. If the target system is a 1900, nothing will be set.

The following options are supported:

-file
This option will cause the Banner argument to be interpreted as a filename instead of a Tcl list.

--
End of options.


On success, ezset banner returns 0. On error, a short text message is returned beginning with the string "err".

ezset hostname Hostname
Sets the hostname on the target system.

Hostname is the hostname to be set on the target system. The hostname may not exceed 20 characters. If the target system is an an IOS-based device, the "hostname" command will be issued. If the target system is running Catalyst Code, the "set prompt" and "set system name" commands will be issued. If the target system is a 1900, the "hostname" command will be isssued from global configuration mode.

On success, ezset hostname returns 0. On error, a short text message is returned beginning with the string "err".

ezset contact Contact
Sets the system contact (SNMP sysContact) on the target system.

Contact is the contact name to be set on the target system. The contact name may not exceed 220 characters.

On success, ezset hostname returns 0. On error, a short text message is returned beginning with the string "err".

ezset location Location
Sets the system location (SNMP sysLocation) on the target system.

Location is the location to be set on the target system. The location may not exceed 220 characters.

On success, ezset hostname returns 0. On error, a short text message is returned beginning with the string "err".

ezset community ?options? StringType Community?,Acl? ... ?Community?,Acl??
Sets the SNMP community string on the target device.

StringType identifies the type of community string to be set. Valid options are "ro" for read-only, and "rw" for read-write.

Community is the community string to be set. Acl is an optional variable which may be used in conjunction with the community string. If an Acl is specified, a comma ',' must delimit the community string and the Acl with no spaces in between. This also means that the community string cannot have a comma as part of the string. The Acl number has a different effect on the device depending on what OS it is running. For devices running IOS, the Acl should correspond to a valid access-list number. The Acl will be used to limit what stations may access the device using this community string. If the switch is a 1900 or running Catalyst code, the Acl will be silently ignored.

Multiple Community or Community,Acl variables may be specified. However, how multiple strings are handled is again dependent upon the target system's OS. If the target system is an IOS-based device, every community string (and optionally ACL) specified will be applied. If the target device is running Catalyst Code, only the first community string in the list will be set. If the target device is a 1900, only the first four community strings will be set.

The following options are supported:

-clear
This option causes the existing community strings to be cleared before the new string(s) is/are applied.

--
End of options.


On success, ezset community returns 0. On error, a short text message is returned beginning with the string "err".

ezset acl ?options? AclNum AclList
Sets an access control list (ACL).

Note: Before running this command against a device, consider the effect that the new ACL will have on the device. If the ACL is being used for traffic filtering, route redistribution, or whatever, be sure you have taken this into consideration as you could lock yourself or others out of the device.

AclNum is an ACL number.

AclList is a Tcl list where each element is a separate ACL entry. The expected format of the ACL entry is the same as what would be input into an IOS device minus the leading "access-list x" string. For example, a valid entry for an IP standard ACL could be "permit 192.168.1.0 0.0.0.255".

The following options are supported:

-file
This option will cause the AclList argument to be interpreted as a filename instead of a Tcl list.

-ifdiff
This option invokes a comparison of the new ACL and what is already present in the config. The new ACL will be applied only if it is either not already present, or not the same.


On success, ezset acl returns 0. On error, a short text message is returned beginning with the string "err". If the target device is running CatCode or the 1900 OS, the command will always return success.

ezset permitlist ?options? PermitList
Sets a permit list on the target device.

Note: If the permit list is enabled on the target device for telnet sessions, you must call ezset ippermit disable telnet first to disable the permit list. Failure to do so will disable all telnet access into the switch.

PermitList is a Tcl list where each element is a separate permit list entry. The expected format of the permit list entry is the same as what would be input into a CatCode device minus the leading "set ip permit" string. For example, a valid entry might be "192.168.1.0 255.255.255.0".

The following options are supported:

-file
This option will cause the PermitList argument to be interpreted as a filename instead of a Tcl list.

-ifdiff
This option invokes a comparison of the new permit list and what is already present in the config. The new list will be applied only if it is either not already present, or not the same.


On success, ezset permitlist returns 0. On error, a short text message is returned beginning with the string "err". If the target device is running CatCode or the 1900 OS, the command will always return success.

ezset ippermit Operator Operand
Disables and enables the permit list on the target device.

Note: Be very careful when enabling the permit list as you do not want to lock out your telnet session, or worse yet, all telnet access.

Operator is one of two values--enable or disable.

Operand is one of three values--all, telnet, or snmp.

On success, ezset ippermit returns 0. On error, a short text message is returned beginning with the string "err". If the target device is running CatCode or the 1900 OS, the command will always return success.

EXAMPLE

The following code will open a session to 192.168.1.1, put the device in "enable" mode, set the hostname to "R1", and change the enable password from "san-fran" to "newpass". It will then close the session to the device.

 
#!/bin/sh
# the next line restarts using the tclsh interpreter \ 
exec tclsh "$0" "$@"

package require libcisco
namespace import libcisco::*

session open 192.168.1.1 cisco
session enable san-fran
ezset hostname "R1"
ezset password enable san-fran newpass
session close

AUTHOR

Andy Ziegelbein <
mailto:aziegelb@users.sourceforge.net>

SEE ALSO

session(n), sendCmd(n), ezget(n), ezdo(n)

KEYWORDS

ezset, password, banner, hostname, snmp