CLI and SSH
SSH and CLI tips
Listing commands
When we wish to configure a router or switch, we obviously use commands but we may not know every command.
Connect to your router first in user mode.
At the command prompt hold down shift + ? You should now see a list of commands available in use mode
Router>?
Exec commands:
<1-99>
Session number to resume
connect
Open a terminal connection
disable
Turn off privileged commands
disconnect
Disconnect an existing network connection
enable
Turn on privileged commands
exit
Exit from the EXEC
logout
Exit from the EXEC
ping
Send echo messages
resume
Resume an active network connection
show
Show running system information
ssh
Open a secure shell client connection
telnet
Open a telnet connection
terminal
Set terminal line parameters
traceroute
Trace route to destination
Now type enable command for priviaged mode and now shift +?
Now you can see a lot more commands available to privilege mode
<1-99>
Session number to resume
Auto
Exec level Automation
clear
Reset functions
clock
Manage the system clock
configure
Enter configuration mode
connect
Open a terminal connection
copy
Copy from one file to another
debug
Debugging functions (see also ‘undebug’)
delete
Delete a file
dir
List files on a filesystem
disable
Turn off privileged commands
disconnect
Disconnect an existing network connection
enable
Turn on privileged commands
erase
Erase a filesystem
exit
Exit from the EXEC
logout
Exit from the EXEC
mkdir
Create new directory
more
Display the contents of a file
no
Disable debugging information
ping
Send echo messages
reload
Halt and perform a cold restart
reload
Halt and perform a cold restart
resume
Resume an active network connection
rmdir
Remove existing directory
send
Send a message to other tty lines
setup
Run the SETUP command facility
show
Show running system information
ssh
Open a secure shell client connection
telnet
Open a telnet connection
terminal
Set terminal line parameters
traceroute
Trace route to destination
undebug
Disable debugging functions (see also ‘debug’)
vlan
Configure VLAN parameters
write
Write running configuration to memory, network, or terminal
To list a command quicker if you know the first letter or part of the command name you simply need to type the following
Type in the command prompt c?
Now the terminal will show you all possible commands begging with “C”
Router#c?
clear clock configure connect copy
Now if we want to be a little more specific we just need to specify more letters. For example if we know the first 3 letters of a command we can do the following:
Type in the command prompt con? Now you will be listed commands that begin with con
Router#con?
configure connect
When you are in configuration mode and wish to run a command that only works with privileged mode you can issue the do command, for example if you are in configuration mod but wish to run the show running-config which only works in privileged mode, simply use the do command.
Type do show running-config or short do show run
Enabling SSH and disabling Telnet.
Logon to your router > enable (privileged mode)
Go to config mode config t
Give your router a name if not already configured ip domain name robertwelsh.local
Type User
Type username robert password cisco
Type Crypto
Type Crypto key
Type Crypto key genet
Type crypto key generate rsa general-keys modulus 1024
Type crypto key generate rsa ? to see crypto commands
Last enable SSH v2, use the following command ip ssh version 2
Now we need to disable telnet line line vty 0 4
Type transport input ssh, now telnet is shutdown and ssh is enabled
Exit exit
Now we need to save the configuration, copy running config startup-config
Now test
Open your Putty client and first test login with telnet, should not work
Now try with SSH, you should be able to login, you will be presented with a certificate