ezset - set common configuration parameters
SYNOPSIS
package require libcisco
|
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.
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.
COMMANDS
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".
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:
On success, ezset banner returns 0.
On error, a short text message is returned beginning with the string "err".
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".
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".
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".
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:
On success, ezset community returns 0.
On error, a short text message is returned beginning with the string "err".
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:
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.
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:
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.
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
#!/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 |