Using the Command-Line Interface

Using the Command-Line Interface
Using the Command-Line Interface
This chapter contains the following sections:
• Information About the CLI Prompt, page 1
• Command Modes, page 2
• Saving CLI Configuration Changes, page 4
• Special Characters, page 5
• Keystroke Shortcuts, page 5
• Abbreviating Commands, page 7
• Using the no Form of a Command, page 8
• Using Help, page 8
Information About the CLI Prompt
To access VSG, you can SSH into the management IP. After you have successfully accessed the system, the
CLI prompt displays in the terminal window of remote workstation, as follows:
vsg#
Note
Use show host name command to display the existing hostname of the switch.
From the CLI prompt, you can do the following:
• Use CLI commands for configuring features.
• Access the command history.
• Use command parsing functions.
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
1
Using the Command-Line Interface
Command Modes
Command Modes
Information About Command Modes
The CLI is divided into command modes that define the actions available to the user. Command modes are
“nested” and are accessed in sequence. When you first log in, you are placed in CLI EXEC mode.
As you navigate from EXEC mode to global configuration mode, a larger set of commands is available to
you. To transition to global configuration mode, enter the following command:
configure terminal
The following table shows how command access builds from user EXEC to global configuration mode.
Table 1: Accessing the Global Configuration Mode
Command Mode
Prompt
EXEC
firewall#
Description
• Connect to remote devices.
• Temporarily change terminal
line settings.
• Perform basic tests.
• List system information
(show).
Global configuration
firewall(config)#
Includes access to EXEC
commands.
• Connect to remote devices.
• Temporarily change terminal
line settings.
• Perform basic tests.
• List system information
(show).
EXEC Command Mode
When you first log in, you are placed into EXEC mode. The commands available in EXEC mode include the
show commands that display device status and configuration information, the clear commands, and other
commands that perform actions that you do not save in the device configuration.
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
2
Using the Command-Line Interface
Global Configuration Command Mode
Global Configuration Command Mode
Global configuration mode provides access to the widest range of commands, including those commands used
to make configuration changes that are saved by the device and can be stored and applied when the device is
rebooted.
Commands entered in global configuration mode update the running configuration file as soon as they are
entered but must also be saved into the startup configuration file by using the following command:
copy running-config startup-config
In global configuration mode, you can access protocol-specific, platform-specific, and feature-specific
configuration modes.
Exiting a Configuration Mode
To exit from any configuration mode, use one of the following commands:
Command
Purpose
Example
exit
Exits from the current
configuration command mode
and returns to the previous
configuration command
mode.
vsg(config-rule)# exitvsg(config)#
end
Exits from the configuration
command mode and returns
to EXEC mode.
vsg(config)# endvsg#
Ctrl-Z
Exits the current
configuration command mode
and returns to EXEC mode.
vsg(config)# ^z
Caution
vsg#
If you press Ctrl-Z
at the end of a
command line in
which a valid
command has been
typed, the CLI
adds the command
to the running
configuration file.
We recommend
that you exit a
configuration
mode using the
exit or end
command.
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
3
Using the Command-Line Interface
Command Mode Summary
Command Mode Summary
Table 2: Command Mode Summary
Mode
Access Method
EXEC
From the login prompt, enter VSG#
your username and password.
To exit to the login prompt, use the
exit command.
Global
configuration
From EXEC mode, enter the
configure command.
VSG (config)#
To exit to EXEC mode, use the end
or exit command or press Ctrl-Z.
Zone
configuration
From global configuration
mode, enter the zone
zone-name command.
VSG
(config-zone)#
To exit to global configuration
mode, use the exit command.
From global configuration
mode, enter the interface
data0 command.
VSG (config-if)# To exit to global configuration
mode, use the exit command.
data0 interface
configuration
Prompt
Exit Method
To exit to EXEC mode, use the end
command or press Ctrl-Z.
To exit to EXEC mode, use the end
command or press Ctrl-Z.
Saving CLI Configuration Changes
Running Configuration
The running configuration is the configuration that is currently running on the device. It includes configuration
changes from commands entered since the last time the device was restarted. If the device is restarted, the
running configuration is replaced with a copy of the startup configuration. Any changes that were made to
the running configuration but were not copied to the startup configuration are discarded.
Startup Configuration
The startup configuration is the configuration that is saved and that will be used by the device when you restart
it. When you make configuration changes to the device, they are automatically saved in the running
configuration. If you want configuration changes saved permanently, you must copy them to the startup
configuration so that they are preserved when the device is rebooted or restarted.
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
4
Using the Command-Line Interface
Copying the Running Configuration to the Startup Configuration
Copying the Running Configuration to the Startup Configuration
To copy changes you have made to the running configuration into the startup configuration so that they are
saved persistently through reboots and restarts, use the following command:
vsg(config)#copy running-config startup-config
Special Characters
The following table lists the characters that have special meaning in text strings and should be used only in
regular expressions or other special contexts.
Table 3: Special Characters
Character
Description
|
Vertical bar
<>
Less than or greater than
Keystroke Shortcuts
The following lists command key combinations that can be used in both EXEC and configuration modes.
Key(s)
Description
Ctrl-A
Moves the cursor to the beginning of the line.
Ctrl-B
Moves the cursor one character to the left. When you
enter a command that extends beyond a single line,
you can press the Left Arrow or Ctrl-B keys
repeatedly to scroll back toward the system prompt
and verify the beginning of the command entry, or
you can press the Ctrl-A key combination.
Ctrl-C
Cancels the command and returns to the command
prompt.
Ctrl-D
Deletes the character at the cursor.
Ctrl-E
Moves the cursor to the end of the line.
Ctrl-F
Moves the cursor one character to the right.
Ctrl-G
Exits to the previous command mode without
removing the command string.
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
5
Using the Command-Line Interface
Keystroke Shortcuts
Key(s)
Description
Ctrl-K
Deletes all characters from the cursor to the end of
the command line.
Ctrl-L
Redisplays the current command line.
Ctrl-R
Redisplays the current command line.
Ctrl-T
Transposes the character to the left of the cursor with
the character located to the right of the cursor.
Ctrl-U
Deletes all characters from the cursor to the beginning
of the command line.
Ctrl-W
Deletes the word to the left of the cursor.
Ctrl-X, H
Lists history.
When using this key combination, press and release
the Ctrl and X keys together before pressing H.
Ctrl-Y
Recalls the most recent entry in the buffer (press keys
simultaneously).
Ctrl-Z
Ends a configuration session, and returns you to
EXEC mode.
When used at the end of a command line in which a
valid command has been typed, the resulting
configuration is first added to the running
configuration file.
UP arrow key
Displays the previous command in the command
history.
Down arrow key
Displays the next command in the command history.
Right arrow key and Left arrow key
Moves your cursor through the command history
directionally to locate a command string.
?
Displays a list of available commands.
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
6
Using the Command-Line Interface
Abbreviating Commands
Key(s)
Description
Tab
Completes the word for you after you enter the first
characters of the word and then press the Tab key.
All options that match are presented.
Used to complete:
• Command names
• Scheme names in the file system
• Server names in the file system
• File names in the file system
This example shows how to use the tab keystroke:
firewall(config)# xm<Tab>
firewall(config)# xml <Tab>
firewall(config)# xml server
This example shows how to use the tab keystroke:
firewall(config)# ns<Tab>
nsc-policy-agent vns-binding
firewall(config)# security-pr<Tab>
firewall(config)# security-profile
Abbreviating Commands
You can abbreviate commands and keywords by entering the first few characters of a command. The
abbreviation must include enough characters to make it unique from other commands or keywords. 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.
The following table lists examples of command abbreviations.
Table 4: Examples of Command Abbreviations
Command
Abbreviation
configure
conf
show running-config
sho run
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
7
Using the Command-Line Interface
Using the no Form of a Command
Using the no Form of a Command
Almost every configuration command has a no form that can be used to disable a feature or function. For
example, to remove a VLAN, use the no vlan command. To reenable it, use the vlan command form.
For example, if you use the boot command in global configuration mode, you can then use the no boot command
to undo the results:
vsg(config)# boot system bootflash: svs1.bin
vsg(config)# no boot system bootflash: svs1.bin
Using Help
The CLI provides the following help features.
Table 5: CLI Help Features
Feature
Description
?
Type the question mark (?) to list the valid input
options.
^
The CLI prints the caret (^) symbol below a line of
syntax to point to an input error in the command
string, keyword, or argument.
UP arrow key
Use the UP arrow to have the CLI display the
previous command you entered so that you can correct
an error.
Syntax Error Isolation and Context-Sensitive Help
The following table describes the commands for syntax error isolation and context-sensitive help.
Command
Purpose
show interface ?
Displays the optional parameters used with the show
interface command in EXEC mode.
show interface module ?
Displays an invalid command error message and
points (^) to the syntax error.
Ctrl-P or the Up Arrow
Displays the previous command you entered so that
you can correct the error.
show interface data ?
Displays the syntax for showing a data interface
(data0).
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
8
Using the Command-Line Interface
Syntax Error Isolation and Context-Sensitive Help
Command
Purpose
show interface data0
Displays the data interface (data0).
This example shows how to use syntax error isolation and context-sensitive help.
firewall-40# show interface data 0
data0 Link encap:Ethernet HWaddr 3a:00:02:00:00:0a
inet addr:70.10.10.10 Bcast:70.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1352 Metric:1
RX packets:2258 errors:0 dropped:0 overruns:0 frame:0
TX packets:2255 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:165730 (165.7 KB) TX bytes:211984 (211.9 KB)
firewall-40#
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
9
Using the Command-Line Interface
Syntax Error Isolation and Context-Sensitive Help
Cisco Virtual Security Gateway for VMware vSphere Configuration Guide, Release 4.2(1)VSG2(1.1)
10
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising