Table Of Contents
Before You Begin
About the Switch Prompt
Default Switch Roles
About the CLI Command Modes
CLI Command Hierarchy
EXEC Mode Options
Configuration Mode
Configuration Mode Commands and Submodes
CLI Command Navigation
Getting Help
Command Completion
File System Completion
The no and Default Forms of Commands
CLI Command Configuration Options
Displaying the Switch Configuration
Saving a Configuration
Clearing a Configuration
Displaying Users
Sending Messages to Users
Using the ping Command
Using the Extended ping Command
Using traceroute
Setting the Shell Timeout
Displaying VTY Sessions
Clearing VTY Sessions
Setting the Terminal Timeout
Setting the Terminal Type
Setting the Terminal Length
Setting the Terminal Width
Displaying Terminal Settings
Configuring the Switch Banner Message
About Flash Devices
Internal bootflash:
External CompactFlash (Slot0:)
Formatting Flash Devices and File Systems
Initializing Internal bootflash:
Formatting External CompactFlash
Using the File System
Setting the Current Directory
Displaying the Current Directory
Displaying File Checksums
Listing the Files in a Directory
Creating a Directory
Deleting an Existing Directory
Moving Files
Copying Files
Deleting Files
Displaying File Contents
Saving Command Output to a File
Compressing and Uncompressing Files
Displaying the Last Lines in a File
Executing Commands Specified in a Script
Setting the Delay Time
Before You Begin
This chapter prepares you to configure switches from the CLI. It also lists the information you need to have before you begin, and it describes the CLI command modes.
This chapter includes the following sections:
•About the Switch Prompt
•Default Switch Roles
•About the CLI Command Modes
•CLI Command Hierarchy
•CLI Command Navigation
•About Flash Devices
•Formatting Flash Devices and File Systems
•Using the File System
About the Switch Prompt
Note Refer to the Cisco MDS 9200 Series Hardware Installation Guide or the Cisco MDS 9500 Series Hardware Installation Guide for installation and connection instructions.
Once the switch is powered on successfully, you see the default switch prompt (switch#) as shown in Example 2-1.
Example 2-1 Output When Switch Boots Up
Auto booting bootflash:/boot-279 bootflash:/system_image;...
Booting kickstart image:bootflash:/boot-279....
............................................Image verification OK
INIT: version 2.78 booting
Checking all filesystems..... done.
Uncompressing system image: bootflash:/system_image
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
INIT: Entering runlevel: 3
<<<<<<SAN OS bootup log messages>>>>>>
---- Basic System Configuration Dialog ----
This setup utility will guide you through the basic configuration of
the system. Use ctrl-c to abort configuration dialog at any prompt.
Basic management setup configures only enough connectivity for
management of the system.
Would you like to enter the basic configuration dialog (yes/no): yes
<<<<<<after configuration>>>>>>
Cisco Storage Area Networking Operating System (SAN-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2004, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained herein are owned by
Cisco Systems, Inc. and/or other third parties and are used and
distributed under license. Some parts of this software are covered
under the GNU Public License. A copy of the license is available
at http://www.gnu.org/licenses/gpl.html.
You can perform embedded CLI operations, access command history, and use command parsing functions at this prompt. The switch gathers the command string upon detecting an Enter (CR) and accepts commands from a terminal.
Default Switch Roles
By default, two roles exist in all switches:
•Network operator—Has permission to view the configuration.
•Network administrator—Has permission to perform all functions and to set up to 64 permission levels based on user roles and groups.
When you execute a command, perform command completion, or obtain context sensitive help, the switch software allows the operation to progress if you have the correct permission as specified in the description of the command. see Chapter 26, "Configuring Users and Common Roles."
About the CLI Command Modes
Switches in the Cisco MDS 9000 Family have two main command modes—user EXEC mode and configuration mode. The commands available to you depend on the mode you are in. To obtain a list of available commands in either mode, type a question mark (?) at the system prompt.
Table 2-1 lists and describes the two commonly used modes, how to enter the modes, and the resulting system prompts. The system prompt helps you identify which mode you are in and hence, which commands are available to you.
Table 2-1 Frequently Used Switch Command Modes
Mode
|
Description of Use
|
How to Access
|
Prompt
|
EXEC
|
Enables you to temporarily change terminal settings, perform basic tests, and display system information.
Note Changes made in this mode are generally not saved across system resets.
|
At the switch prompt, enter the required EXEC mode command.
|
|
Configuration mode
|
Enables you to configure features that affect the system as a whole.
Note Changes made in this mode are saved across system resets if you save your configuration. See the "Saving a Configuration" section.
|
From EXEC mode, enter the config terminal command.
|
|
You can abbreviate commands and keywords by entering just enough characters to make the command unique from other commands. For example, you can abbreviate the config terminal command to conf t.
Note Do not enter percent ( % ), pound ( # ), ellipsis ( ... ), vertical bar ( | ), less than or great than ( < > ), brackets ( [ ] ), or braces ( { } ) in command lines. These characters have special meaning in Cisco SAN-OS text strings.
CLI Command Hierarchy
The CLI commands are organized hierarchically, with commands that perform similar functions grouped under the same level. For example, all commands that display information about the system, configuration, or hardware are grouped under the show command, and all commands that allow you to configure the switch are grouped under the config terminal command. Figure 2-1 illustrates a portion of the config terminal command hierarchy.
Figure 2-1 CLI Command Hierarchy Example
To execute a command, you enter the command by starting at the top level of the hierarchy. For example, to configure a Fibre Channel interface, use the config terminal command. Once you are in configuration mode, issue the interface command. When you are in the interface submode, you can query the available commands there.
The following example shows how to query the available commands in the interface submode:
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)# interface fc1/1
Interface configuration comands:
channel-group Add to/remove from a port-channel
exit Exit from this submode
fcdomain Configure fcdomain parameters
fspf Configure FSPF parameters
no Negate a command or set its defaults
rspan-tunnel Configure remote span tunnel interface
shutdown Enable/disable an interface
switchport Configure switchport parameters
EXEC Mode Options
When you start a session on the switch, you begin in EXEC mode. Based on the role or group to which you belong, you have access to limited commands or to all commands (see the "Role-Based Authorization" section on page 26-1). From EXEC mode, you can enter configuration mode. Most of the EXEC commands are one-time commands, such as show commands, which display the current configuration status. Here is a list of EXEC mode commands:
attach Connect to a specific linecard
callhome Callhome commands
cd Change current directory
clock Manage the system clock
config Enter configuration mode
copy Copy from one file to another
crypto Act on crypto associations
debug Debugging functions
dir List files in a directory
discover Discover information
fctrace Trace the route for an N-Port.
find Find a file below the current directory
gunzip Uncompresses LZ77 coded files
gzip Compresses file using LZ77 coding
ips Various sibyte module related commands
mkdir Create new directory
no Disable debugging functions
port-channel Port-Channel related commands
purge Deletes unused data
pwd View current directory
reload Reboot the entire box
run-script Run shell scripts
send Send message to open sessions
setup Run the basic SETUP command facility
show Show running system information
sleep Sleep for the specified number of seconds
ssh SSH to another system
system System management commands
tac-pac Save tac information to a specific location
tail Display the last part of a file
telnet Telnet to another system
terminal Set terminal line parameters
traceroute Trace route to destination
undebug Disable Debugging functions (See also debug)
write Write current configuration
zone Execute Zone Server commands
zoneset Execute zoneset commands
Configuration Mode
In configuration mode, you can make changes to the existing configuration. When you save the configuration, these commands are preserved across switch reboots. Once you are in configuration mode, you can enter interface configuration mode, zone configuration mode, and a variety of protocol-specific modes. Configuration mode is the starting point for all configuration commands. When you are in configuration mode, the switch expects configuration commands from the user.
The following example shows output from the config terminal command:
Enter configuration commands, one per line. End with CNTL/Z.
Configuration Mode Commands and Submodes
Here is a list of configuration mode commands:
Enter configuration commands, one per line. End with CNTL/Z.
aaa Configure aaa functions
arp [no] remove an entry from the ARP cache
asm Configure ASM Modules
banner Configure banner message
boot Configure boot variables
callhome Enter the callhome configuration mode
cdp CDP Configuration parameters
cfs CFS configuration commands
cimserver Modify cimserver configuration
clock Configure time-of-day clock
crypto Set crypto settings
device-alias Device-alias configuration commands
dpvm Configure Dynamic Port Vsan Membership
end Exit from configure mode
exit Exit from configure mode
fabric-binding Fabric Binding configuration
fc-tunnel Configure fc-tunnel
fcalias Fcalias configuration commands
fcanalyzer Configure cisco fabric analyzer
fcc Configure FC Congestion Control
fcdomain Enter the fcdomain configuration mode
fcdroplatency Configure switch or network latency
fcid-allocation Add/remove company id(or OUIs) from auto area list
fcinterop Interop commands
fcns Name server configuration
fcroute Configure FC routes
fcrxbbcredit Enable extended rx b2b credit configuration
fcs Configure Fabric Config Server
fcsp Config commands for FC-SP
fctimer Configure fibre channel timers
fdmi Config commands for FDMI
ficon Configure ficon information
in-order-guarantee Set in-order delivery guarantee
interface Select an interface to configure
iscsi Enable/Disable iSCSI
ivr Config commands for IVR
line Configure a terminal line
logging Modify message logging facilities
mcast Configure multicast
nasb Configure Third-Party Copy Functionality
no Negate a command or set its defaults
port-security Configure Port Security
port-track Configure Switch port track config
power Configure power supply
poweroff Poweroff a module in the switch
qos QoS Configuration commands
radius Configure RADIUS configuration distribution
radius-server Configure RADIUS related parameters
rib Configure RIB parameters
rscn Config commands for RSCN
san-ext-tuner Enable/Disable San Extension Tuner tool
santap Enter SanTap configuration
scheduler Config commands for scheduler
scsi-flow SCSI Flow configuration
snmp-server Configure snmp server
span Enter SPAN configuration mode
ssh Configure SSH parameters
ssm Config commands for SSM (Storage Services Module)
switchname Configure system's network name
system System config command
tlport Configure TL Port information
trunk Configure Switch wide trunk protocol
username Configure user information.
vsan Enter the vsan configuration mode
wwn Set secondary base MAC addr and range for additional WWNs
zone Zone configuration commands
zone-attribute-group Zone attribute group commands
zoneset Zoneset configuration commands
Configuration mode, also known as terminal configuration mode, has several submodes. Each of these submodes places you deeper in the prompt hierarchy. When you type exit, the switch backs out one level and returns you to the previous level. When you type end, the switch backs out to the user EXEC level. You can also type Ctrl-Z in configuration mode as an alternative to typing end.
Note In configuration mode, you can alternatively enter
— Ctrl-Z instead of the end command, and
— Ctrl-G instead of the exit command
You can execute an EXEC mode command from a configuration mode or submode prompt. You can issue this command from any submode within the configuration mode. When in configuration mode (or in any submode), enter the do command along with the required EXEC mode command. The entered command is executed at the EXEC level and the prompt resumes its current mode level.
switch(config)# do terminal session-timeout 0
In this example, terminal session-timeout is an EXEC mode command—you are issuing an EXEC mode command using the configuration mode do command.
The do command applies to all EXEC mode commands other than the end and exit commands. You can also use the help (?) and command completion (Tab) features for EXEC commands when issuing a do command along with the EXEC command.
Table 2-2 lists some useful command keys that can be used in both EXEC and configuration modes:
Table 2-2 Useful Command Key Description
Command
|
Description
|
Ctrl-P
|
Up history.
|
Ctrl-N
|
Down history.
|
Ctrl-R
|
Refreshes the current line and reprints it.
|
Ctrl-X H
|
List history.
When using this key combination, press and release the Ctrl and X keys together before pressing the H key.
|
Alt-P
|
History search backwards.
Note The difference between Tab completion and Alt- P or Alt-N is that Tab completes the current word while Alt- P and Alt-N completes a previously entered command.
|
Alt-N
|
History search forwards.
|
Ctrl-G
|
Exit.
|
Ctrl-Z
|
End.
|
Ctrl-L
|
Clear screen.
|
CLI Command Navigation
To redisplay a command you previously entered, press the Up Arrow key. You can continue to press the Up Arrow key to see more previously issued commands. Similarly, you can press the Down Arrow, Right Arrow, Left Arrow, and Delete keys to navigate through the command history and to modify an existing command string.
Getting Help
In any command mode, you can get a list of available commands by entering a question mark (?).
To obtain a list of commands that begin with a particular character sequence, type in those characters followed immediately by the question mark (?). Do not include a space.
To list keywords or arguments, enter a question mark in place of a keyword or argument. Include a space before the question mark. This form of help is called command syntax help, because it reminds you which keywords or arguments are applicable based on the commands, keywords, and arguments you have already entered.
terminal Configure the system from the terminal
Tip If you are having trouble entering a command, check the system prompt and enter the question mark (?) for a list of available commands. You might be in the wrong command mode or using incorrect syntax.
Command Completion
In any command mode, you can begin a particular command sequence and immediately press the Tab key to complete the rest of the command.
switch(config)# role <Tab>
switch(config)# role name
This form of help is called command completion, because it completes a word for you. If several options are available for the typed letters, all options that match those letters are presented:
fcanalyzer fcdroplatency fcns fctimer
switch(config)# fcd <Tab>
switch(config)# fcdo <Tab>
File System Completion
You can use the Tab key to complete schemes, servers, and file names available in the file system.
For example,
switch# cd bootflash:<Tab>
bootflash: bootflash://sup-1/ bootflash://sup-remote/
bootflash:/// bootflash://sup-2/ bootflash://sup-standby/
bootflash://module-5/ bootflash://sup-active/
bootflash://module-6/ bootflash://sup-local/
switch# bootflash://mo<Tab>
switch# bootflash://module-6/
The no and Default Forms of Commands
You can issue the no form of any command to perform the following actions:
•Undo a wrongly issued command.
If you issue the zone member command, you can undo the results:
switch(config)# zone name test vsan 1
switch(config-zone)# member pwwn 12:12:12:12:12:12:12:12
switch(config-zone)# no member pwwn 12:12:12:12:12:12:12:12
WARNING: Zone is empty. Deleting zone test. Exit the submode.
•Delete a created facility.
If you want to delete a zone that you created:
switch(config)# zone name test vsan 1
switch(config-zone)# exit
switch(config)# no zone name test vsan 1
You cannot delete a zone facility called test while residing in it. You must first exit the zone submode and return to configuration mode.
CLI Command Configuration Options
You can configure the software in one of two ways:
•You can create the configuration for the switch interactively by issuing commands at the CLI prompt.
•You can create an ASCII file containing a switch configuration and then load this file on the required system. You can then use the CLI to edit and activate the file (see the "Working with Configuration Files" section on page 7-1).
Displaying the Switch Configuration
You can view the ASCII form of the configuration file when required. To view the current configuration tree from the EXEC prompt, issue the show running-config command. If the running configuration is different from the startup configuration, issue the show startup-config command to view the ASCII version of the current startup configuration that was used to boot the switch if a copy run start command was not issued after the reboot. Use the show startup command to view the contents of the current startup configuration.
You can also gather specific information on the entire switch configuration by issuing the relevant show commands. Configurations are displayed based on a specified feature, interface, module, or VSAN. Available show commands for each feature are briefly described in this section and listed at the end of each chapter.
Examples 2-2 to 2-8 display a few show command examples.
Example 2-2 Displays Details on the Specified Interface
switch# show interface fc1/1
Hardware is Fibre Channel, 20:01:ac:16:5e:4a:00:00
0 frames input, 0 bytes, 0 discards
0 runts, 0 jabber, 0 too long, 0 too short
0 input errors, 0 CRC, 0 invalid transmission words
0 address id, 0 delimiter
0 EOF abort, 0 fragmented, 0 unknown class
0 frames output, 0 bytes, 0 discards
Received 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Transmitted 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Example 2-3 Displays the Software and Hardware Version
Cisco Storage Area Networking Operating System (SAN-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2003, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained herein are owned by
Cisco Systems, Inc. and/or other third parties and are used and
distributed under license. Some parts of this software are covered
under the GNU Public License. A copy of the license is available
at http://www.gnu.org/licenses/gpl.html.
kickstart: version 2.0(1) [build 2.0(0.6)] [gdb]
system: version 2.0(1) [build 2.0(0.6)] [gdb]
BIOS compile time: 08/07/03
kickstart image file is: bootflash:///m9500-sf1ek9-kickstart-mzg.2.0.0.6.bin
kickstart compile time: 10/25/2010 12:00:00
system image file is: bootflash:///m9500-sf1ek9-mzg.2.0.0.6.bin
system compile time: 10/25/2020 12:00:00
bootflash: 1000944 blocks (block size 512b)
slot0: 0 blocks (block size 512b)
172.22.92.181 uptime is 0 days 2 hours 18 minute(s) 1 second(s)
Last reset at 970069 usecs after Tue Sep 16 22:31:25 1980
Reason: Reset Requested by CLI command reload
Example 2-4 Displays the Running Configuration
Building Configuration ...
ip address 172.22.95.112 255.255.255.0
boot system bootflash:system-237; sup-1
boot kickstart bootflash:boot-237 sup-1
ip default-gateway 172.22.95.1
username admin password 5 /AFDAMD4B2xK2 role network-admin
Example 2-5 Displays the Difference Between the Running and Startup Configuration
switch# show running diff
Building Configuration ...
****************** 1,16 ****
ip default-gateway 172.22.91.1
iscsi authentication none
iscsi virtual-target name vt
pWWN 21:00:00:04:cf:4c:52:c1
+ aaa accounting logsize 500
ip default-gateway 172.22.91.1
iscsi authentication none
! iscsi initiator name junk
iscsi virtual-target name vt
pWWN 21:00:00:04:cf:4c:52:c1
Example 2-6 Displays the Configuration for a Specified Interface
switch# show running interface fc2/9
Note The show running interface command is different from the show interface command.
Example 2-7 Displays the Configuration for all Interfaces in a 16-Port Module
switch# show running interface fc2/10 - 12
Example 2-8 Displays the Configuration Per VSAN
switch# show runnning vsan 1
Building Configuration ...
member pwwn 21:00:00:20:37:60:42:5c
member pwwn 21:00:00:20:37:4b:00:a2
zoneset activate name m vsan 1
Saving a Configuration
Use the copy running-config startup-config command to save the new configuration into nonvolatile storage. Once this command is issued, the running and the startup copies of the configuration are identical.
See the "Copying Files" section on page 7-6 and the "Preserving Module Configuration" section on page 10-9.
Clearing a Configuration
Use the write erase command to clear a startup configuration. Once this command is issued, the switch's startup configuration reverts to factory defaults. The running configuration is not affected.
Caution The
write erase command erases the entire startup configuration with the exception of any configuration that affects the loader functionality.
The write erase boot command only erases the configuration that affects the loader functionality. The loader functionality configuration includes the boot variables and the mgmt0 IP configuration information (IP address, netmask, and default gateway).
This command will erase the boot variables and the ip configuration of interface mgmt 0
Displaying Users
Use the show users command to display all users currently accessing the switch.
admin pts/7 Jan 12 20:56 (10.77.202.149)
admin pts/9 Jan 12 23:29 (modena.cisco.com)
admin pts/11 Jan 13 01:53 (dhcp-171-71-49-49.cisco.com)
Sending Messages to Users
Use the send command to send a message to all active CLI users currently using the switch. This message is restricted to 80 alphanumeric characters with spaces.
This example sends a warning message to all active users about the switch being shut down.
switch# send Shutting down the system in 2 minutes. Please log off.
Broadcast Message from admin@excal-112
(/dev/pts/3) at 16:50 ...
Shutting down the system in 2 minutes. Please log off.
Using the ping Command
Use the ping command to verify the connectivity of a remote host or server by sending echo messages.
The syntax for this command is ping <host or ip address>.
switch# ping 198.133.219.25
PING 198.133.219.25 (198.133.219.25) 56(84) bytes of data.
64 bytes from 198.133.219.25: icmp_seq=1 ttl=245 time=0.856 ms
64 bytes from 198.133.219.25: icmp_seq=2 ttl=245 time=1.02 ms
--- 198.133.219.25 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.856/0.941/1.027/0.090 ms
To abnormally terminate a ping session, type the Ctrl-C escape sequence.
Using the Extended ping Command
The ping command provides additional options to verify the connectivity of a remote host or server. To specify these additional parameters, just type ping at the CLI switch prompt and press enter.
Table 2-3 summarizes the syntax and the defaults.
Table 2-3 Options and Defaults for the ping Command
Option
|
Description
|
Default
|
Target IP address
|
The IP address or host name of the destination node to ping.
|
Not applicable
|
Repeat count
|
The number of ping packets to be sent to the destination address.
|
5 packets
|
Datagram size
|
The size of each ping packet in bytes.
|
100 bytes
|
Timeout in seconds
|
The timeout interval before the ping command is terminated.
|
2 seconds
|
Extended commands
|
Specifies if a series of additional commands appear.
|
No
|
Sweep range of sizes
|
The sizes of the echo packets being sent. This option determines the minimum sizes of the MTUs configured on the nodes along the path to the destination address. You can then reduce packet fragmentation performance problems. (see the "Configuring the MTU Frame Size" section on page 37-6).
|
No
|
Source address or interface
|
The numeric IP address or the name of the source interface.
|
Not applicable
|
Type of service
|
The Quality of Service (QoS) in Internet Control Message Protocol (ICMP) datagrams (see the "QoS" section on page 47-3).
|
0
|
Set DF bit in IP header
|
The Path MTU Discovery strategy (see the "Configuring the MTU Frame Size" section on page 37-6).
|
No
|
Data pattern
|
You may specify up to 16 bytes to pad the outgoing packet. This padding is useful when diagnosing data-dependent problems in a network. For example, ff fills the outgoing packet with all ones.
|
0xABCD
|
The syntax for this command is as follows:
Target IP address: 198.133.219.25
Target IP address: 198.133.219.25
Source address or interface:
Set DF bit in IP header [n]:
Sweep range of sizes [n]:
PING 198.133.219.25 (198.133.219.25) 100(128) bytes of data.
108 bytes from 198.133.219.25: icmp_seq=1 ttl=245 time=0.600 ms
108 bytes from 198.133.219.25: icmp_seq=2 ttl=245 time=0.614 ms
108 bytes from 198.133.219.25: icmp_seq=3 ttl=245 time=0.872 ms
108 bytes from 198.133.219.25: icmp_seq=4 ttl=245 time=0.558 ms
108 bytes from 198.133.219.25: icmp_seq=5 ttl=245 time=0.570 ms
--- 198.133.219.25 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 7996ms
rtt min/avg/max/mdev = 0.558/0.642/0.872/0.120 ms
To abnormally terminate a ping session, type the Ctrl-C escape sequence.
Using traceroute
Use the traceroute command to prints the routes taken by a specified host or IP address.
The syntax for this command is traceroute <host or ip address>.
switch# traceroute www.cisco.com
Tracing route to www.cisco.com [198.133.219.25] 30 hops max, 38 byte packets
1 bras3-l0.pltnca.sbcglobal.net [151.164.184.79] 30 ms 30 ms 20 ms
2 dist2-vlan50.pltn13.pbi.net [64.164.97.67] 20 ms 20 ms 30 ms
3 bb2-g1-1.pltn13.pbi.net [67.116.251.194] 20 ms 20 ms 20 ms
4 bb1-p12-0.pltn13.pbi.net [151.164.40.17] 20 ms 21 ms 20 ms
5 bb2-p13-0.sntc01.pbi.net [151.164.191.65] 20 ms 20 ms 30 ms
6 ex1-p3-0.eqsjca.sbcglobal.net [64.161.1.54] 20 ms 20 ms 30 ms
7 sl-st20-sj-0-0.sprintlink.net [144.223.242.81] 20 ms 20 ms 30 ms
8 sl-bb25-sj-10-0.sprintlink.net [144.232.20.62] 20 ms 30 ms 20 ms
9 sl-gw11-sj-10-0.sprintlink.net [144.232.3.134] 70 ms 30 ms 30 ms
10 sl-ciscopsn2-11-0-0.sprintlink.net [144.228.44.14] 20 ms 30 ms 20 ms
11 sjce-dmzbb-gw1.cisco.com [128.107.239.89] 20 ms 30 ms 30 ms
12 sjck-dmzdc-gw1.cisco.com [128.107.224.69] 20 ms 30 ms 20 ms
13 www.cisco.com (198.133.219.25) 2.496 ms * 2.135 ms
To abnormally terminate a traceroute session, enter Ctrl-C.
Setting the Shell Timeout
Use the exec-timeout command in configuration mode to configure the lifetime of all terminal sessions on that switch. When the time limit configured by this command is exceeded, the shell exits and closes that session. The syntax for this command is exec-timeout minutes.
The default is 30 minutes. You can configure different timeout values for a console or a virtual terminal line (VTY) session. You can set the exec-timeout value to 0 to disable this feature so the session remains active until you exit the switch. This change is saved in the configuration file.
•From the console:
switch(config)# line console
switch(config-console)# exec-timeout 60
Specifies the current console shell timeout to be 60 minutes.
•From a VTY session (Telnet or SSH):
switch(config-line)# exec-timeout 60
Specifies the current console shell timeout to be 60 minutes.
Displaying VTY Sessions
Use the show line command to display all configured VTY sessions:
Databits: 8 bits per byte
default : ATE0Q1&D2&C1S0=1\015
Statistics: tx:5558511 rx:5033958 Register Bits:RTS|CTS|DTR|DSR|CD|RI
Databits: 8 bits per byte
default : ATE0Q1&D2&C1S0=1\015
Statistics: tx:35 rx:0 Register Bits:RTS|DTR
Clearing VTY Sessions
Use the clear line command to close a specified VTY session:
Setting the Terminal Timeout
Use the terminal session-timeout command in EXEC mode to configure the automatic logout time for the current terminal session on that switch. When the time limit configured by this command is exceeded, the switch closes that session and exits.
The syntax for this command from is terminal session-timeout minutes.
The default is 30 minutes. You can set the terminal session-timeout value to 0 to disable this feature so the terminal remains active until you choose to exit the switch. This change is not saved in the configuration file.
switch# terminal session-timeout 600
Specifies the terminal timeout to be 600 minutes for the current session.
Setting the Terminal Type
Use the terminal terminal-type command in EXEC mode to specify the terminal type for a switch:
The syntax for this command is terminal terminal-type terminal-type.
switch# terminal terminal-type vt100
Specifies the terminal type. The terminal-type string is restricted to 80 characters and must be a valid type (for example vt100 or xterm). If a Telnet or SSH session specifies an unknown terminal type, the switch uses the vt100 terminal by default.
Setting the Terminal Length
Use the terminal length command in EXEC mode to set the terminal screen length for the current session. This command is specific to only the console port. Telnet and SSH sessions set the length automatically.
The syntax for this command is terminal length lines.
switch# terminal length 20
Sets the screen length for the current session to 20 lines for the current terminal session. The default is 24 lines.
Setting the Terminal Width
Use the terminal width command in EXEC mode to set the terminal screen width for the current session. This command is specific to only the console port. Telnet and SSH sessions set the width automatically.
The syntax for this command is terminal width columns.
switch# terminal width 86
Sets the screen length for the current session to 86 columns for the current terminal session. The default is 80 columns.
Displaying Terminal Settings
Use the show terminal command to display the terminal settings for the current session:
Length: 24 lines, Width: 80 columns
Session Timeout: 525600 minutes
Configuring the Switch Banner Message
You can issue the banner motd command in configuration mode to configure a message of the day (MOTD).
The syntax for this command from is banner motd [delimiting-character message delimiting-character]
The following example configures a banner message with the following text "Testing the MOTD Feature."
switch(config)# banner motd # Testing the MOTD Feature. #
The message is restricted to 40 lines with a maximum of 80 characters in each line.
Use the show banner motd command to display the configured banner message:
The following example displays the configured banner message.
The configured MOTD banner is displayed before the login prompt on the terminal whenever a user logs in to a Cisco MDS 9000 Family switch.
Follow these guidelines when choosing your delimiting character:
•Do not use the delimiting-character in the message string.
•Do not use " and % as delimiter s.
You can include tokens in the form $ (token) in the message text. Tokens will be replaced with the corresponding configuration variable. For example:
•$(hostname) displays the host name for the switch
•$(line) displays the vty or tty line or name
The following example spans multiple lines and uses tokens to configure the banner message:
switch(config)# banner motd #
Enter TEXT message. End with the character '#'.
Welcome to switch $(hostname).
Your tty line is $(line).
#
About Flash Devices
Every switch in the Cisco MDS 9000 Family contains one internal bootflash (see Figure 2-2). The Cisco MDS 9500 Series additionally contains one external CompactFlash called slot0 (see Figure 2-2 and Figure 2-3).
Figure 2-2 Flash Devices in the Cisco MDS 9000 Supervisor Module
Figure 2-3 External CompactFlash in the Cisco MDS 9000 Supervisor Module
Internal bootflash:
All switches in the Cisco MDS 9000 Family have one internal bootflash: that resides in the supervisor or switching module.You have access to two locations within the internal bootflash: file system.
•The volatile: file system provides temporary storage, and it is also the default location for file system commands. Files in temporary storage (volatile:) are erased when the switch reboots.
•The bootflash: (nonvolatile storage) file system provides permanent storage. The files in bootflash: are preserved through reboots and power outages.
External CompactFlash (Slot0:)
Cisco MDS 9500 Series directors contain an additional external CompactFlash referred to as the slot0: file system.
The external CompactFlash, an optional device for MDS 9500 Series directors, can be used for storing software images, logs, and core dumps.
Formatting Flash Devices and File Systems
By formatting a Flash devices or a file system, you are clearing out the contents of the device or the file system and restoring it to its factory-shipped state.
See the "About Flash Devices" section and the "Using the File System" section.
Initializing Internal bootflash:
When a switch is shipped, the init system command is already performed and you do not need to issue it again. Initializing the switch resets the entire internal Flash device and erases all data in the bootflash: file system. The internal Flash device is composed of several file systems with bootflash: being one of them. All files in bootflash: are erased and you must download the system and kickstart images again. After issuing an init system command, you do not have to format the bootflash: again because bootflash: is automatically formatted.
Note The init system command also installs a new loader from the existing (running) kickstart image. You can access this command from the switch(boot)# prompt (see Chapter 6, "Software Images").
Caution If your system has an active supervisor module currently running, you must issue the
system standby manual-boot command in EXEC mode on the active supervisor module before issuing the
init system command on the standby supervisor module to avoid corrupting the internal bootflash:. After the
init system command completes on the standby supervisor module, issue the
system no standby manual-boot command in EXEC mode on the active supervisor module.
If bootflash: is found corrupted during a boot sequence, you will see the following message:
ERROR:bootflash: has unrecoverable error; please do "format bootflash:"
Use the format bootflash: command to only format the bootflash: file system. You can issue the format bootflash: command from either the switch# or the switch(boot)# prompts.
If you issue the format bootflash: command, you must download the kickstart and system images again.
Formatting External CompactFlash
Be sure to format an external CompactFlash device before using it to save files or images.
You can verify if the external CompactFlash device is formatted by inserting it into slot0: and issuing the dir slot0: command.
•If the external CompactFlash device is already formatted, you can see file system usage information (along with any existing files).
•If the external CompactFlash device is unformatted (corrupted), you will see the following message:
In this case, you need to format the CompactFlash device using the format slot0: command.
Note The slot0: file system cannot be accessed from the standby loader> prompt or the switch(boot)# prompt, if the disk is inserted after booting the switch.
Caution The Cisco SAN-OS software only supports CompactFlash devices that are certified by Cisco Systems and formatted using Cisco MDS switches. Using uncertified CompactFlash devices may result in unpredictable consequences; formatting CompactFlash devices using other platforms may result in errors.
Using the File System
The switch provides the following useful functions to help you manage software image files and configuration files:
•Setting the Current Directory
•Displaying the Current Directory
•Listing the Files in a Directory
•Creating a Directory
•Deleting an Existing Directory
•Moving Files
•Copying Files
•Deleting Files
•Displaying File Contents
•Saving Command Output to a File
•Compressing and Uncompressing Files
•Displaying the Last Lines in a File
•Executing Commands Specified in a Script
•Setting the Delay Time
Setting the Current Directory
The cd command changes the current directory level to a specified directory level. CLI defaults to the volatile: file system. This command expects a directory name input.
Tip Any file saved in the volatile: file system is erased when the switch reboots.
The syntax for this command is cd directory name
This example changes the current directory to the mystorage directory that resides in the slot0 file system:
switch# cd slot0:mystorage
This example changes the current directory to the mystorage directory that resides in the current directory.
If the current directory is slot0:mydir, this command changes the current directory to
slot0:mydir/mystorage.
Displaying the Current Directory
The pwd command displays the current directory location. This example changes the directory and displays the current directory.
Note If you issue this command from the active supervisor module in a Cisco MDS 9500 Series (for example, module-5), then you cannot change the current working directory to the bootflash: of module-6. See the "Supervisor Modules" section on page 10-2.
Displaying File Checksums
The show file file md5sum command provides the MD5 checksum of file. MD5 is an electronic fingerprint for the file. MD5 is the latest implementation of the internet standards described in RFC 1321 and is useful for data security as well as integrity.
The show file file cksum command provides the checksum of file. The checksum values compute a cyclic redundancy check (CRC) for each named file. Use this command to verify that are not corrupted—compare the checksum output for the received file against the checksum output for the original file.
This example provides the output of the show file command when a file is specified.
switch# show file bootflash://sup-1/ultimate_file.tar cksum
switch# show file bootflash://sup-1/ultimate_file.tar md5sum
52479aae2dce1fd849b6f4916d750392
Listing the Files in a Directory
The dir command displays the contents of the current directory or the specified directory. The syntax for this command is dir directory or file name.
This example shows how to list the files on the default volatile: file system:
Usage for volatile: filesystem
Creating a Directory
The mkdir command creates a directory at the current directory level or at a specified directory level.
The syntax for this command is mkdir directory name.
This example creates a directory called test in the slot0 directory.
This example creates a directory called test at the current directory level.
If the current directory is slot0:mydir, this command creates a directory called slot0:mydir/test.
Deleting an Existing Directory
The rmdir command deletes an existing directory at the current directory level or at a specified directory level. The directory must be empty to be deleted.
The syntax for this command is rmdir directory name.
This example deletes the directory called test in the slot0 directory.
switch# rmdir slot0:test
This is a directory. Do you want to continue (y/n)? [y] y
The delete command is also capable of deleting empty and non-empty directories. When you issue this command a warning is displayed to confirm your intent to delete the directory
This example deletes the directory called test at the current directory level.
This is a directory. Do you want to continue (y/n)? [y] y
If the current directory is slot0:mydir, this command deletes the slot0:mydir/test directory.
Moving Files
The move command removes a file from the source directory and places it in the destination directory. If a file with the same name already exists in the destination directory, that file is overwritten by the moved file.
This example moves the file called samplefile from the root directory of the slot0: file system to the mystorage directory.
switch# move slot0:samplefile slot0:mystorage/samplefile
This example moves a file from the current directory level.
switch# move samplefile mystorage/samplefile
If the current directory is slot0:mydir, this command moves slot0:mydir/samplefile to
slot0:mydir/mystorage/samplefile.
Copying Files
The copy command copies a file.
This example copies the file called samplefile from the root directory of the slot0: file system to the mystorage directory.
switch# copy slot0:samplefile slot0:mystorage/samplefile
This example copies a file from the current directory level.
switch# copy samplefile mystorage/samplefile
If the current directory is slot0:mydir, this command copies slot0:mydir/samplefile to
slot0:mydir/mystorage/samplefile.
You can also use the copy command to upload and download files from the slot0: or bootflash: file
system to or from a FTP, TFTP, SFTP, or SCP server (see the "Copying Files" section on page 7-6).
Deleting Files
The delete command deletes a specified file or the specified directory and all its contents (see the "Deleting Files" section on page 7-9).
This example shows how to delete a file from the current working directory:
switch# delete dns_config.cfg
This example shows how to delete a file from an external CompactFlash (slot0):
switch# delete slot0:dns_config.cfg
This example deletes the entire my-dir directory and all its contents:
switch# delete bootflash:my-dir
Caution If you specify a directory, the
delete command deletes the entire directory and all its contents.
Displaying File Contents
The show file command displays the contents of a specified file in the file system.
The syntax for this command is show file file_name
This example displays the contents of the test file that resides in the slot0 directory.
switch# show file slot0:test
This example displays the contents of a file residing in the current directory.
Saving Command Output to a File
You can force all screen output to go to a file by appending > filename to any command. For example, enter show interface > samplefile at the EXEC mode switch prompt to save the interface configuration to samplefile—a file created at the same directory level. At the EXEC mode switch prompt, issue a dir command to view all files in this directory, including the recently saved samplefile.See Chapter 4, "Initial Configuration," for information on saving and copying configuration files, and Chapter 6, "Software Images," for information on saving and copying software images.
Note Redirection is allowed only if the current directory is on the volatile: (default) or slot0: file systems. Redirection is not allowed if the current directory is on the bootflash: file system. The current directory can be viewed using the pwd command and changed using the cd command.
Compressing and Uncompressing Files
The gzip command compresses (zips) the specified file using LZ77 coding.
This example directs the output of the show tech-support command to a file (Samplefile) and then zips the file and displays the difference in the space used up in the volatile: directory:
switch# show tech-support > Samplefile
Building Configuration ...
1525859 Jul 04 00:51:03 2003 Samplefile
switch# gzip volatile:Samplefile
266069 Jul 04 00:51:03 2003 Samplefile.gz
The gunzip command uncompresses (unzips) LZ77 coded files.
This example unzips the file that was compressed in the previous example:
switch# gunzip samplefile
1525859 Jul 04 00:51:03 2003 Samplefile
Displaying the Last Lines in a File
The tail command displays the last lines (tail end) of a specified file.
The syntax for this command is tail <file name> [<number of lines>]
You see the last 10 lines of the mylog file.
Executing Commands Specified in a Script
The run-script command executes the commands specified in a file. To use this command, be sure to create the file and specify commands in the required order.
Note You cannot create the script files at the switch prompt. You can create the script file on an external machine and copy it the bootflash: directory. This section assumes that the script file resides in the bootflash: directory.
The syntax for this command is run-script file_name
This example displays the CLI commands specified in the testfile that resides in the slot0 directory.
switch# show file slot0:testfile
This file output is in response to the run-script command executing the contents in the testfile file:
switch# run-script slot0:testfile
Enter configuration commands, one per line. End with CNTL/Z.
fc1/1 is down (Fcot not present)
Hardware is Fibre Channel
Port WWN is 20:01:00:05:30:00:48:9e
Admin port mode is auto, trunk mode is on
Counter Values (current):
0 frames input, 0 bytes, 0 discards
0 runts, 0 jabber, 0 too long, 0 too short
0 input errors, 0 CRC, 0 invalid transmission words
0 address id, 0 delimiter
0 EOF abort, 0 fragmented, 0 unknown class
0 frames output, 0 bytes, 0 discards
Received 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Transmitted 0 OLS, 0 LRR, 0 NOS, 0 loop inits
Counter Values (5 minute averages):
Setting the Delay Time
The sleep command delays an action by a specified number of seconds.
The syntax for this command is sleep <seconds>
You will see the switch prompt return after 30 seconds.
This command is useful within scripts. For example, if you create a script called test-script:
switch# show file slot0:test-script
discover scsi-target remote
switch# run-script slot0:test-script
When you execute the slot0:test-script, the switch software executes the discover scsi-target remote command, and then waits for 10 seconds before executing the show scsi-target disk command.