Cisco MDS 9000 Family CLI Configuration Guide
Before You Begin
Downloads: This chapterpdf (PDF - 487.0KB) The complete bookPDF (PDF - 26.33MB) | Feedback

Before You Begin

Table Of Contents

Before You Begin

About the Switch Prompt

Default Switch Roles

Using the CLI

CLI Command Modes

CLI Command Hierarchy

EXEC Mode Options

Configuration Mode

CLI Command Navigation

Command Completion

File System Completion

The no and Default Forms of Commands

CLI Command Configuration Options

Using Multiple Commands in One Line

Getting Help

Managing the Switch Configuration

Displaying the Switch Configuration

Saving a Configuration

Clearing a Configuration

Displaying Users

Sending Messages to Users

Using the ping and ping ipv6 Commands

Using the Extended ping and ping ipv6 Commands

Using traceroute and traceroute ipv6 Commands

Configuring Terminal Parameters

Setting the Terminal Session Timeout

Displaying Terminal Sessions

Clearing Terminal Sessions

Setting the Terminal Timeout

Setting the Terminal Type

Setting the Terminal Screen Length

Setting the Terminal Screen Width

Displaying Terminal Settings

Configuring the Switch Banner Message

Directing show Command Output to a File

Using CLI Variables

User-Defined CLI Persistent Variables

System-Defined Variables

Using Command Aliases

Defining Command Aliases

About Flash Devices

Internal bootflash

External CompactFlash (Slot0)

Formatting Flash Devices and File Systems

Initializing Internal bootflash

Formatting External CompactFlash

Using Switch File Systems

Specifying File Systems

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

Command Scripts

Executing Commands Specified in a Script

Using CLI Variables in Scripts

Setting the Delay Time


Before You Begin


This chapter prepares you to configure switches from the CLI. It also describes the CLI command modes and how to use the switch file systems.

This chapter includes the following sections:

About the Switch Prompt

Default Switch Roles

Using the CLI

Getting Help

Managing the Switch Configuration

Displaying Users

Sending Messages to Users

Using the ping and ping ipv6 Commands

Using the Extended ping and ping ipv6 Commands

Using traceroute and traceroute ipv6 Commands

Configuring Terminal Parameters

Configuring the Switch Banner Message

Directing show Command Output to a File

Using CLI Variables

Using Command Aliases

About Flash Devices

Formatting Flash Devices and File Systems

Using Switch File Systems

Command Scripts

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

This example shows the switch bootup message on the MDS 9506, 9509, and 9513 Directors:

Booting bootflash:/m9500-sf2ek9-kickstart-mz.4.1.1a.upg.bin.S11 ...
.....................
Automatic boot of image at addr 0x00000000 ...
Starting kernel...
INIT: version 2.85 booting
Checking all filesystems..r.r.r.r. done.
Setting the System Clock using the Hardware Clock as reference...System Clock set. Local 
time: Thu Sep 18 17:48:38 UTC 2008
Loading system software
Uncompressing system image: bootflash:/m9500-sf2ek9-mz.4.1.1a.upg.bin.S8
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
INIT: Entering runlevel: 3
---- System Admin Account Setup ----
Do you want to enforce secure password standard (yes/no):
...

This example shows the switch bootup message on the MDS 9124, 9134, 9216i, 9222i Switches:

Booting bootflash:m9100-s2ek9-kickstart-mz.4.1.1a.upg.bin.S11 ...
.................
Automatic boot of image at addr 0x00000000 ...
arch: exit
openpic: enter
openpic: timer
openpic: external
openpic: spurious
openpic: exit
Starting kernel...
Entered kgdb_console_init:1960
INIT: version 2.85 booting
Checking all filesystems..r.r.r. done.
/etc/rc.d/rcS.d/S30procps: line 22: /lib/lsb/init-functions: No such file or directory
Setting the System Clock using the Hardware Clock as reference...System Clock set. Local 
time: Thu Sep 18 17:45:14 UTC 2008
Loading system software
Uncompressing system image: bootflash:///m9100-s2ek9-mz.4.1.1a.upg.bin.S8
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
INIT: Entering runlevel: 3
Starting NFS servers: nfsd mountd.
2008 Sep 18 17:45:44  %KERN-2-SYSTEM_MSG: Starting kernel... - kernel
2008 Sep 18 17:45:44  %KERN-1-SYSTEM_MSG:  Entered kgdb_console_init:1960 - kernel
---- System Admin Account Setup ----
Do you want to enforce secure password standard (yes/no): 
...
switch login:admin101
Password:*******
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2008, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under
license. Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or the GNU
Lesser General Public License (LGPL) Version 2.1. A copy of each
such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://www.opensource.org/licenses/lgpl-2.1.php
switch#

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 32, "Configuring Users and Common Roles."

Using the CLI

This section includes the following topics:

CLI Command Modes

CLI Command Hierarchy

CLI Command Hierarchy

CLI Command Navigation

Command Completion

File System Completion

The no and Default Forms of Commands

CLI Command Configuration Options

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, so you know 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.

switch#

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.

switch(config)#

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 NX-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 start executing commands, enter the command at the top level of the hierarchy (EXEC mode). 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 configuration submode, you can query the available commands there.

The following example shows how to query the available commands in the interface submode:

switch# config t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)# interface fc1/1
switch(config-if)# ?
Interface configuration commands:
  channel-group  Add to/remove from a port-channel
  do             EXEC command
  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 32-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:

switch# ?
Exec commands:
  attach        Connect to a specific linecard
  callhome      Callhome commands
  cd            Change current directory
  clear         Reset functions
  cli           CLI commands
  clock         Manage the system clock
  config        Enter configuration mode
  copy          Copy from one file to another
  debug         Debugging functions
  delete        Delete a file
  dir           List files in a directory
  discover      Discover information
  exit          Exit from the EXEC
  fcping        Ping an N-Port
  fctrace       Trace the route for an N-Port.
  find          Find a file below the current directory
  format        Format disks
  gunzip        Uncompresses LZ77 coded files
  gzip          Compresses file using LZ77 coding
  install       Upgrade software
  ips           Various sibyte module related commands
  isns          Re-registers specified interface with isns server
  mkdir         Create new directory
  modem         Modem commands
  move          Move files
  nasb          NASB control functionality
  no            Disable debugging functions
  ping          Send echo messages
  port-channel  Port-Channel related commands
  purge         Deletes unused data
  pwd           View current directory
  reload        Reboot the entire box
  rmdir         Delete a directory
  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
  test          Test command
  traceroute    Trace route to destination
  undebug       Disable Debugging functions (See also debug)
  update        Update license
  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 submode, zone configuration submode, and a variety of feature-specific submodes. 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:

switch# config terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)# 

Configuration Mode Commands and Submodes

Here is a list of configuration mode commands:

switch# config t
Enter configuration commands, one per line.  End with CNTL/Z.
switch(config)# ?
  aaa                   Configure aaa functions
  arp                   [no] remove an entry from the ARP cache
  banner                Configure banner message
  boot                  Configure boot variables
  callhome              Enter the callhome configuration mode
  cdp                   Configure CDP parameters
  cfs                   CFS configuration commands
  cimserver             Modify cimserver configuration
  cli                   Configure CLI commands
  clock                 Configure time-of-day clock
  crypto                Set crypto settings
  device-alias          Device-alias configuration commands
  dpvm                  Configure Dynamic Port Vsan Membership
  end                   Go to exec mode
  event                 Event Manager commands
  exit                  Exit from command interpreter
  fabric-binding        Fabric Binding configuration
  fc-redirect           FC-Redirect configuration commands
  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
  fcflow                Configure fcflow
  fcid-allocation       Add/remove company id(or OUIs) from auto area list
  fcinterop             Interop commands
  fcip                  Enable/Disable FCIP
  fcns                  Name server configuration
  fcroute               Configure FC routes
  fcs                   Configure Fabric Config Server
  fctimer               Configure fibre channel timers
  fdmi                  Config commands for FDMI
  feature               Command to enable/disable features
  ficon                 Configure ficon information
  fips                  Enable/Disable FIPS mode
  fspf                  Configure fspf
  hw-module             Enable/Disable OBFL information
  in-order-guarantee    Set in-order delivery guarantee
  interface             Configure interfaces
  ip                    Configure IP features
  ips                   Various sibyte module related commands
  ipv6                  Configure IPv6 features
  license               Modify license features
  line                  Configure a terminal line
  logging               Modify message logging facilities
  mcast                 Configure multicast
  no                    Negate a command or set its defaults
  ntp                   NTP Configuration
  password              Password for the user
  port-monitor          Configure port monitor
  power                 Configure power supply
  poweroff              Poweroff a module in the switch
  qos                   QoS Configuration commands
  radius                Configure RADIUS configuration
  radius-server         Configure RADIUS related parameters
  rate-mode             Configure rate mode oversubscription limit
  rib                   Configure RIB parameters
  rlir                  Config commands for RLIR
  rmon                  Remote Monitoring
  role                  Configure roles
  rscn                  Config commands for RSCN
  scsi-flow             SCSI Flow configuration
  scsi-target           Scsi-target configuration
  sdv                   Config commands for SAN Device Virtualization
  snmp-server           Configure snmp server
  span                  Enter SPAN configuration mode
  ssh                   Configure SSH parameters
  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
  xml                   Xml agent
  zone                  Zone configuration commands
  zone-attribute-group  Zone attribute group commands
  zoneset               Zoneset configuration commands
switch(config)# feature ?
  cimserver       Enable/Disable cimserver
  cluster         Enable/Disable Cluster
  crypto          Set crypto settings
  dpvm            Enable/Disable Dynamic Port Vsan Membership
  fabric-binding  Enable/Disable Fabric Binding
  fcip            Enable/Disable FCIP
  fcrxbbcredit    Enable/Disable extended rx b2b credit configuration
  fcsp            Enable/Disable FC-SP
  ficon           Enable/Disable ficon
  iscsi           Enable/Disable iSCSI
  ivr             Config commands for IVR
  npiv            Nx port Id Virtualization (NPIV) feature enable
  port-security   Enable/Disable port-security
  port-track      Enable/Disable port track feature
  san-ext-tuner   Enable/Disable SAN Extension Tuner Tool
  scheduler       Enable/Disable scheduler
  sdv             Enable/Disable SAN Device Virtualization
  sme             Enable/Disable Storage Media Encryption
  ssh             Enable/Disable ssh
  tacacs+         Enable/Disable tacacs+
  telnet          Enable/Disable telnet
switch(config)# feature crypto ? 
  ike    Enable/Disable IKE
  ipsec  Enable/Disable IPSec

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.


As of MDS NX-OS Release 4.1(1a), if a command is not available in the current configuration submode, the command is checked for availability in the higher submodes until the EXEC mode, and then the command is executed. For example, you can enter the following command without the do keyword.

switch(config)# terminal session-timeout 0

Before the MDS NX-OS Release 4.1(1a), 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
switch(config)#

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 key combinations that can be used in both EXEC and configuration modes.

Table 2-2 Useful Command Key Combination Descriptions 

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

Refresh the screen.

Ctrl-O

Clear screen.


Displaying the Present Working Context

Some features have configuration submode hierarchy nested more than one level deep. In these cases, you can display the commands you used to reach your present working context (PWC). To display the command used to reach the current PWC, issue the pwc command at any command mode prompt.

switch(config-if)# pwc
(config t) -> (int mgmt 0)
 
   

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.

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)# ro<Tab> 
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:

switch(config)# fc<Tab>
fc-tunnel        fcalias          fcanalyzer       fcc
fcdomain         fcdroplatency    fcflow           fcid-allocation
fcinterop        fcip             fcns             fcroute
fcrxbbcredit     fcs              fcsp             fctimer

switch(config)# fcd <Tab>
fcdomain       fcdroplatency  
switch(config)# fcdo<Tab>
switch(config)# fcdomain 

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# cd bootflash://mo<Tab> 
bootflash://module-5/  bootflash://module-6/
cvswitch# cd bootflash://module-

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 member command in zone configuration submode, 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.
switch(config-zone)# 

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
switch(config)# 

You cannot delete a zone facility called test while residing in it. You must first exit the zone configuration submode and return to configuration mode.

Revert to the default value.

If you issue the zone merge-control restrict vsan command, you can undo the results:

switch(config)# zone zone merge-control restrict vsan 10
switch(config)# no zone merge-control restrict vsan 10
switch(config)#

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 9-1).

Using Multiple Commands in One Line

The following example shows how to include multiple commands in one line for a noninteractive ssh session to a switch from a host:

host% ssh -l joe switch-name "conf t ; interface fc 1/1 ; shut ; no shut ; end"

Note The spaces around the ";" are important in this example. You can also use this multicommand syntax in the scheduler where the spaces around the ";" are not important.


Getting Help

In any command mode, you can get a list of available commands by entering a question mark (?).

switch# ?

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.

switch# co?
configure copy

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.

switch# config ?
 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.


Managing the Switch Configuration

This section includes the following topics:

Displaying the Switch Configuration

Saving a Configuration

Clearing a Configuration

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-config 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
fc1/1 is up
    Hardware is Fibre Channel, 20:01:ac:16:5e:4a:00:00
    vsan is 1
    Port mode is E
    Speed is 1 Gbps
    Beacon is turned off
    FCID is 0x0b0100
      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

switch# show version
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2008, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained herein are owned by
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.

Software
  BIOS:      version 1.0.6
  loader:    version N/A
  kickstart: version 4.1(1) [build 4.1(0.161)] [gdb]
  system:    version 4.1(1) [build 4.1(0.161)] [gdb]
  BIOS compile time:       06/14/07
  kickstart image file is: bootflash:///iboot-4-1-0-161-S4
  kickstart compile time:  10/12/2020 25:00:00 [07/29/2008 06:33:37]
  system image file is:    bootflash:///iisan-4-1-0-161-S4
  system compile time:     12/25/2010 12:00:00 [07/29/2008 08:40:03]


Hardware
  cisco MDS 9513 (13 Slot) Chassis ("Supervisor/Fabric-2")
  Motorola, 7447A, altivec  with 1032680 kB of memory.
  Processor Board ID JAE1211B7WU

  Device name: sw-dc4-i-141
  bootflash:    1000440 kB
  slot0:         500472 kB (expansion flash)

Kernel uptime is 1 day(s), 14 hour(s), 39 minute(s), 48 second(s)

Last reset at 188171 usecs after  Mon Oct 27 14:09:16 1980

  Reason: Reset Requested by CLI command reload
  System version: 4.1(0.151)
  Service: 

Example 2-4 Displays the Running Configuration

switch# show running-config
Building Configuration ...
 interface fc1/1
 interface fc1/2
 interface fc1/3
 interface fc1/4
 interface mgmt0
ip address 172.22.95.112 255.255.255.0
no shutdown
vsan database
boot system bootflash:system-237; sup-1
boot kickstart bootflash:boot-237 sup-1
callhome
ip default-gateway 172.22.95.1
switchname switch
trunk protocol enable
username admin password 5 /AFDAMD4B2xK2  role network-admin


Note The interface configuration information can be display in multiple entries in the running configuration. See the "Displaying Interface Information" section on page 13-26.


Example 2-5 Displays the Difference Between the Running and Startup Configurations

switch# show running-config diff
Building Configuration ...
*** Startup-config
--- Running-config
****************** 1,16 ****
  feature fcip
  ip default-gateway 172.22.91.1
  iscsi authentication none
  feature iscsi
! iscsi import target fc
  iscsi virtual-target name vt
    pWWN 21:00:00:04:cf:4c:52:c1
  all-initiator-permit
--- 1,20 ----
  feature fcip
+ aaa accounting logsize 500
+
+
+
  ip default-gateway 172.22.91.1
  iscsi authentication none
  feature iscsi
! iscsi initiator name junk
  iscsi virtual-target name vt
    pWWN 21:00:00:04:cf:4c:52:c1
  all-initiator-permit

Example 2-6 Displays the Configuration for a Specified Interface

switch# show running-config interface fc2/9
interface fc2/9
switchport mode E
no shutdown

Note The show running-config 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-config interface fc2/10 - 12
interface fc2/10
switchport mode E
no shutdown

interface fc2/11
switchport mode E
no shutdown

interface fc2/12
switchport mode FL
no shutdown

Example 2-8 Displays the Configuration Per VSAN

switch# show runnning vsan 1 
Building Configuration ...
zone name m vsan 1
  member pwwn 21:00:00:20:37:60:42:5c
  member pwwn 21:00:00:20:37:4b:00:a2
zoneset name m vsan 1
  member m
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 Configuration Files" section on page 9-5 and the "Preserving the Module Configuration" section on page 12-7.

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).

switch# write erase boot
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.

switch# show users 
admin    pts/7        Jan 12 20:56 (10.77.202.149)
admin    pts/9        Jan 12 23:29 (user1.example.com)
admin    pts/11       Jan 13 01:53 (dhcp-10-10-1-1.example.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 command 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 and ping ipv6 Commands

Use the ping command to verify the connectivity of a remote host or server by sending echo messages.

The IPv4 syntax for this command is ping host or ping ipv4-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

The IPv6 syntax for this command is ping ipv6 host or ping ipv6 ipv6-address. The following example pings an IPv6 link-local address configured on a specific address:

shellfish# ping ipv6 fe80::205:30ff:fe01:a4fa interface gigabitethernet 1/1
PING fe80::205:30ff:fe01:a4fa(fe80::205:30ff:fe01:a4fa) from ::1 gige1-1: 56 data bytes 
64 bytes from fe80::205:30ff:fe01:a4fa: icmp_seq=1 ttl=64 time=0.091 ms
64 bytes from fe80::205:30ff:fe01:a4fa: icmp_seq=2 ttl=64 time=0.077 ms
64 bytes from fe80::205:30ff:fe01:a4fa: icmp_seq=3 ttl=64 time=0.080 ms
64 bytes from fe80::205:30ff:fe01:a4fa: icmp_seq=4 ttl=64 time=0.075 ms
64 bytes from fe80::205:30ff:fe01:a4fa: icmp_seq=5 ttl=64 time=0.076 ms

To abnormally terminate a ping session, type the Ctrl-C escape sequence.

Using the Extended ping and ping ipv6 Commands

The ping and ping ipv6 commands provide 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 and ping ipv6 Commands 

Option
Description
Default

Target IP address

The IPv4 address, IPv6 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 or ping ipv6 command is terminated.

2 seconds

Extended commands

Specifies if a series of additional commands appear.

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 56-3).

0

Set DF bit in IP header

The Path MTU Discovery strategy (see the "Configuring the MTU Frame Size" section on page 46-3).

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:

switch# ping
Target IP address: 198.133.219.25
Target IP address: 198.133.219.25
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header [n]:
Data pattern [0xABCD]:
Sweep range of sizes [n]:
PATTERN: 0xabcd
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 and traceroute ipv6 Commands

Use the traceroute command to print the routes taken to reach a specified host or IP address.

The IPv4 syntax for this command is traceroute host or traceroute ipv4-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

The IPv6 syntax for this command is traceroute ipv6 host or traceroute ipv6 ipv6-address.

switch# traceroute ipv6
Target IPv6 address: 2001:0DB8::3/64
Datagram size [40]:
Extended commands [n]: y
Maximum time-to-live [30]:
Source address:
Port number [33434]:

To cancel a traceroute or traceroute ipv6 command before it completes, enter Ctrl-C.

Configuring Terminal Parameters

This section includes the following topics:

Setting the Terminal Session Timeout

Setting the Terminal Timeout

Setting the Terminal Type

Setting the Terminal Screen Length

Setting the Terminal Screen Width

Displaying Terminal Settings

Setting the Terminal Session 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 vty
switch(config-line)# exec-timeout 60 

Specifies the current console shell timeout to be 60 minutes.

Displaying Terminal Sessions

Use the show line command to display all configured terminal sessions:

switch# show line
line Console:
    Speed:        9600 bauds
    Databits:     8 bits per byte
    Stopbits:     1 bit(s)
    Parity:       none
    Modem In: Disable
    Modem Init-String -
        default : ATE0Q1&D2&C1S0=1\015
    Statistics:  tx:5558511     rx:5033958     Register Bits:RTS|CTS|DTR|DSR|CD|RI
line Aux:
    Speed:        9600 bauds
    Databits:     8 bits per byte
    Stopbits:     1 bit(s)
    Parity:       none
    Modem In: Disable
    Modem Init-String -
        default : ATE0Q1&D2&C1S0=1\015
    Hardware Flowcontrol: ON
    Statistics:  tx:35     rx:0     Register Bits:RTS|DTR

Clearing Terminal Sessions

Use the clear line command to clear a specified terminal session:

switch# clear line Aux

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 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 Screen 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 Screen 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:

switch# show terminal 
TTY: Type: "vt100"
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 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 t
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.

switch# show banner motd
 Testing the MOTD Feature

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.

 Testing the MOTD Feature
switch login: 

Follow these guidelines when choosing your delimiting character:

Do not use the delimiting-character in the message string.

Do not use " and % as delimiters.

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 t
switch(config)# banner motd #
Enter TEXT message. End with the character '#'.
Welcome to switch $(hostname).
Your tty line is $(line).
#

Directing show Command Output to a File

You can direct show command output to a file, either on the volatile file system, on slot0 CompactFlash memory, or on a remote server.

The following example shows how to direct the show running-config output to a file on the volatile file system.

switch1# show running-config > volatile:switch1-run.cfg

The following example shows how to direct the show running-config output to a file on slot0 CompactFlash memory.

switch2# show running-config > slot0:switch2-run.cfg

The following example shows how to direct the show running-config output to a file on a TFTP server.

switch3# show running-config > tftp://10.10.1.1/home/configs/switch3-run.cfg
Preparing to copy...done

Using CLI Variables

The NX-OS CLI parser supports the definition and use of variables in CLI commands. CLI variables can be used as follows: ï

Entered directly on the command line in configuration mode.

Passed to the child script initiated using the run-script command. The variables defined in the parent shell are available for use in the child run-script command process (see the "Executing Commands Specified in a Script" section).

CLI variables have the following characteristics: ï

You cannot reference a variable through another variable using nested references.

You can define persistent variables that are available across switch reloads.

You can reference two predefined system variables, the TIMESTAMP variable, and the SWITCHNAME variable. The system defined variables cannot be modified.

User-Defined CLI Persistent Variables

You can define CLI variables that persist across CLI sessions and switch reloads using the cli var name command in configuration mode. These CLI persistent variables are configured in configuration mode and are saved in the running configuration file.


Note As of MDS NX-OS Release 4.1(1a), CLI session variables are not supported.


The following example shows how to create a user-defined CLI persistent variable:

switch# config t
switch(config)# cli var name mgmtport mgmt 0
switch(config)# exit
switch#

You can reference a variable using the syntax $(variable).

The following example shows how to reference a user-defined CLI persistent variable:

switch# show interface $(mgmtport)
mgmt0 is up
    Hardware is FastEthernet
    Address is 000e.38c6.2c6c
    Internet address is 10.10.10.1/24
    MTU 1500 bytes, BW 100 Mbps full Duplex
    288996 packets input, 97746406 bytes
      0 multicast frames, 0 compressed
      0 input errors, 0 frame, 0 overrun 0 fifo
    9089 packets output, 1234786 bytes, 0 underruns
      0 output errors, 0 collisions, 0 fifo
      0 carrier errors

Use the show cli variables command to display user-defined CLI persistent variables.

The following example displays user-defined CLI persistent variables:

switch# show cli variables
VSH Variable List
-----------------
TIMESTAMP="2005-10-24-21.37.13"
mgmtport="mgmt 0"

Use the no cli var name command in configuration mode to remove user-defined CLI persistent variables.

The following example removes a user-defined CLI persistent variable:

switch# config t
switch(config)# no cli var name mgmtport

System-Defined Variables

Cisco MDS NX-OS supports two predefined variables: TIMESTAMP. This variable refers to the time of execution of the command in the format YYYY-MM-DD-HH.MM.SS. SWITCHNAME. This variable refers to the name of the switch consisting of any string.


Note The TIMESTAMP and SWITCHNAME variable names are case sensitive. All letters must be uppercase.


The following example uses $(TIMESTAMP) when periodically gathering statistics into files using the command scheduler:

switch# config t l
switch(config)# feature scheduler
switch(config)# scheduler logfile size 16
switch(config)# scheduler job name j1
switch(config-job)# show interface mgmt0 | include mgmt > file
switch(config-job)# copy volatile:file bootflash:file.$(TIMESTAMP)
switch(config-job)# end
switch(config)#

The following example uses $(TIMESTAMP) when redirecting show command output to a file:

switch# show running-config > rcfg.$(TIMESTAMP)
Preparing to copy....done
switch# dir volatile:
       7231     Oct 03 20:20:42 2005  rcfg.2005-10-03-20.20.42

Usage for volatile://sup-local
8192 bytes used
20963328 bytes free
20971520 bytes total

The following example shows the two system cli variables supported from MDS NX-OS Release 4.1(x):

m9513-2# show cli variable
 VSH Variable List
 -----------------
 SWITCHNAME="m9513-2"
 TIMESTAMP="2010-04-16-16.23.48"

Using Command Aliases

Command alias support has the following characteristics:

Command aliases are global for all user sessions.

Command aliases are persist across reboots.

Commands being aliased must be typed in full without abbreviation.

Command alias translation always takes precedence over any keyword in any configuration mode or submode.

Command alias support is only available on the supervisor module, not the switching modules.

Command alias configuration takes effect for other user sessions immediately.

You cannot override the default command alias alias, which aliases the show cli alias.

Nesting of command aliases is permitted to a maximum depth of 1. One command alias can refer to another command alias that must refer to a valid command, not to another command alias.

A command alias always replaces the first command keyword on the command line.

You can define command aliases for commands in any configuration submode or the EXEC mode.

Defining Command Aliases

You can define command aliases using the cli alias name command in configuration mode.

This following example shows how to define command aliases:

switch# config t
switch(config)# cli alias name gigint interface gigabitethernet
switch(config)# cli alias name shintbr show interface brief 
switch(config)# cli alias name shfcintup shintbr| include up | include fc

You can display the command aliases defined on the switch using the alias default command alias.

The following example shows how to display the command aliases defined on the switch:

switch# alias
CLI alias commands
==================
alias      :show cli alias
gigint     :interface gigabitethernet
shintbr    :show interface brief
shfcintup  :shintbr | include up | include fc

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 device 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 Switch File Systems" 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 8, "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 that 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) or not inserted, you will see the following message:

Compact flash is either not present or not formatted

In this case, you need to format the CompactFlash device using the format slot0: command.


Note The slot0: file system cannot be accessed from either the standby loader> prompt or the switch(boot)# prompt if the disk is inserted after booting the switch.



Caution The Cisco NX-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 Switch File Systems

The switch provides the following useful functions to help you manage software image files and configuration files:

Specifying File Systems

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

Specifying File Systems

The syntax for specifying a file system is scheme:[//server/]. Table 2-4 describes the file system syntax components.

Table 2-4 File System Syntax Components 

Scheme
Server
Description

bootflash

sup-active
sup-local
sup-1

Internal CompactFlash memory located on the active supervisor used for storing system images, configuration files, and other miscellaneous files.

sup-standby
sup-remote
sup-2

Internal CompactFlash memory located on the standby supervisor used for storing system images, configuration files, and other miscellaneous files.

module-5
module-6

Internal CompactFlash memory located on slot0 or usb1 or usb2 of the active or standby supervisor in Cisco MDS 9506 and Cisco MDS 9509 switches.

module-7
module-8

Internal CompactFlash memory located on slot0 or usb1 or usb2 of the active or standby supervisor in Cisco MDS 9513 Directors.

slot0

External CompactFlash installed in a supervisor module used for storing system images, configuration files, and other miscellaneous files

usb1

External CompactFlash installed in the usb1 slot.

usb2

External CompactFlash installed in the usb2 slot.

volatile

Volatile random-access memory (VRAM) located on a supervisor module used for temporary or pending changes

nvram

Nonvolatile random-access memory (NVRAM) located on a supervisor module used for storing the startup-config file

log

Memory on the active supervisor that stores logging file statistics

system

Memory on a supervisor module used for storing the running-config file

modflash

slot-slot

CompactFlash located on a Storage Services Module (SSM) used for storing the SSI boot image


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 root directory on the bootflash: file system:

switch# cd bootflash: 

This example changes the current directory to the mydir directory that resides in the slot0: file system:

switch# cd slot0:mydir 

This example changes the current directory to the mystorage directory that resides in the current directory:

switch# cd mystorage

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:

switch# cd bootflash:
switch# pwd
bootflash:


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 12-2.


Displaying File Checksums

The show file file md5sum command provides the MD5 checksum of the 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 the file. The checksum values compute a cyclic redundancy check (CRC) for each named file. Use this command to verify that the files 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
2569913991

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 dir filename.

This example shows how to list the files on the default volatile: file system.

switch# dir 
           Usage for volatile: filesystem
                          0 bytes total used
                   20971520 bytes free
                   20971520 bytes available

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:

switch# mkdir slot0:test 

This example creates a directory called test at the current directory level:

switch# mkdir test

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 intention to delete the directory.

This example deletes the directory called test at the current directory level:

switch# rmdir test
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.


Caution 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/sample file to slot0:mydir/mystorage/sample file.

Copying Files

The copy command copies a file between file systems within a switch.


Note Use the dir command to ensure that enough space is available in the target file system. If enough space is not available, use the delete command to remove unneeded files.


The syntax for the copy command follows and is explained in Table 2-5:

switch# copy scheme:[//module/]filename scheme:[//module/]filename

Table 2-5 copy Command Syntax 

Scheme
Module
File Name

bootflash

sup-active
sup-standby
sup-1, module-51 , or module-72
sup-2, module-61, or module-82
sup-local
sup-remote

User-specified

slot0

User-specified

usb1

User-specified

usb2

User-specified

volatile

User-specified

nvram

startup-config or snapshot-config

system

running-config

1 Cisco MDS 9506 and Cisco MDS 9509 switches

2 Cisco MDS 9513 Directors


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.

This example shows how to copy a file from the active supervisor module's (sup-1 in slot 5 on the Cisco MDS 9506 and Cisco MDS 9509 switches or slot 7 on the Cisco MDS 9513 switch) bootflash to the standby supervisor module's (sup-2 in slot 6 on the Cisco MDS 9506 and Cisco MDS 9509 switches or slot 7 on the Cisco MDS 9513 switch) bootflash.

switch# copy bootflash:system_image bootflash://sup-2/system_image

This example shows how to overwrite the contents of an existing configuration in NVRAM:

switch# copy nvram:snapshot-config nvram:startup-config
Warning: this command is going to overwrite your current startup-config.
Do you wish to continue? {y/n} [y] y

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 Configuration Files" section on page 9-5).

Deleting Files

The delete command deletes a specified file or the specified directory and all its contents (see the "Deleting Configuration Files" section on page 9-8).

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 filename.

This example displays the contents of the test file that resides in the slot0 directory:

switch# show file slot0:test
config t
Int fc1/1
no shut
end
show int fc1/1

This example displays the contents of a file residing in the current directory:

switch# show file myfile

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 a samplefile 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 5, "Initial Configuration," for information on saving and copying configuration files, and Chapter 8, "Software Images," for information on saving and copying software images.


Note As of MDS NX-OS Release 4.1(1a), redirection is allowed regardless of the current directory.
In the earlier releases, redirection is allowed only if the current directory is on the volatile: (default) or slot0: file systems, and 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 ...
switch# dir
    1525859     Jul 04 00:51:03 2003 Samplefile
Usage for volatile://
    1527808 bytes used
   19443712 bytes free
   20971520 bytes total
switch# gzip volatile:Samplefile
switch# dir
     266069     Jul 04 00:51:03 2003 Samplefile.gz
Usage for volatile://
     266240 bytes used
   20705280 bytes free
   20971520 bytes total

The gunzip command uncompresses (unzips) LZ77 coded files.

This example unzips the file that was compressed in the previous example:

switch# gunzip samplefile
switch# dir
    1525859     Jul 04 00:51:03 2003 Samplefile
Usage for volatile://
    1527808 bytes used
   19443712 bytes free
   20971520 bytes total

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 filename [number-of-lines].

switch# tail mylog 10

You see the last 10 lines of the mylog file.

Command Scripts

This section includes the following sections:

Executing Commands Specified in a Script

Using CLI Variables in Scripts

Setting the Delay Time

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 filename.

This example displays the CLI commands specified in the testfile that resides in the slot0 directory:

switch# show file slot0:testfile
conf t
interface fc 1/1
no shutdown
end
sh interface fc1/1

This file output is in response to the run-script command executing the contents in the testfile file:

switch# run-script slot0:testfile
'conf t'
Enter configuration commands, one per line. End with CNTL/Z.
'interface fc1/1'
'no shutdown'
'end'
'sh interface fc1/1'
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
    vsan is 1
    Beacon is turned off
    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):
...

Using CLI Variables in Scripts

You can use CLI variables defined by the cli var command (see the "Using CLI Variables" section) or passed as arguments in the run-script command.

The following example shows how to use CLI variables in a script file used by the run-script command:

switch# conf t
switch(config)# cli var name testinterface fc 1/1
switch(config)# exit

switch# show file bootflash:test1.vsh
show interface $(testinterface)

switch# run-script bootflash:test1.vsh
`show interface $(testinterface)`
fc1/1 is down (SFP not present)
Hardware is Fibre Channel
Port WWN is 20:01:00:05:30:00:8e:1e
Admin port mode is auto, trunk mode is on
Port vsan is 1
Receive data field Size is 2112
Beacon is turned off
5 minutes input rate 0 bits/sec, 0 bytes/sec, 0 frames/sec
5 minutes output rate 0 bits/sec, 0 bytes/sec, 0 frames/sec
1 frames input, 128 bytes
0 discards, 0 errors
0 CRC, 0 unknown class
0 too long, 0 too short
1 frames output, 128 bytes
0 discards, 0 errors
0 input OLS, 0 LRR, 0 NOS, 0 loop inits
0 output OLS, 0 LRR, 0 NOS, 0 loop inits
0 receive B2B credit remaining
0 transmit B2B credit remaining

Setting the Delay Time

The sleep command delays an action by a specified number of seconds.

The syntax for this command is sleep seconds.

switch# sleep 30

You will see the switch prompt return after 30 seconds.

This command is useful within scripts. For example, if you create a command script called test-script.

switch# show file slot0:test-script
discover scsi-target remote
sleep 10
show scsi-target disk
switch# run-script slot0:test-script

When you execute the slot0:test-script command 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.