Cisco Ios Ssh

The Cisco IOS implementation of SSH (which has been available for several years now), called Cisco IOS SSH (available in S, E, and T trains of Cisco IOS software), is a service feature that is available in the service provider Cisco IOS revision levels. Cisco IOS SSH is used to ensure that remote devices are managed securely; Telnet is a very insecure protocol, because all segments are sent in clear text. Cisco IOS SSH allows an administrator to remotely manage a Cisco IOS device, such as a router or Catalyst operating system (CatOS), securely. Cisco IOS SSH provides a secure link between a client and server.

SSH uses the Rivest, Shamir, and Adelman (RSA) public key cryptography, therefore allowing a secure communication channel between a client and router.

SSH was introduced into Cisco IOS platforms/images as follows:.

■ SSHv1 server support was introduced in some Cisco IOS platforms/images starting in 12.0.5.S.

■ SSH client support was introduced in some Cisco IOS platforms/images starting in 12.1.(5)T9.

■ SSH terminal-line access (also known as reverse-Telnet) was introduced in some Cisco IOS platforms/images starting in 12.2.2.T. It can be used to secure reverse-telnet connections from terminal servers.

■ SSHv2 support was introduced in some Cisco IOS platforms/images starting in 12.1(19)E6.

The following is an example of configuring a Cisco router as an SSH server and a client connection from another Cisco IOS router.

There are four steps required to enable SSH support on a Cisco IOS router:

1. Configure the hostname command.

2. Configure the DNS domain.

3. Generate the public (RSA) key to be used.

4. Enable SSH transport support for the vtys (optional step).

Example 2-12 displays a sample Cisco IOS SSH configuration. The exclamation points (!) identify comments that have been added to make the configuration more reader-friendly.

Example 2-12 Cisco IOS SSH Server

!Configure the hostname if not previously done so. hostname Massimo

! configure a local username and password to authenticate ! the remote SSH user, AAA can ! also be used username cisco password 0 cisco !Configure the router's DNS domain, ip domain-name Interface Ethernet0 ip address

! Generate RSA key, completed from the configuration mode in IOS. crypto key generate rsa

! Following are optional SSH commands that control parameters on your route ip ssh time-out 120

ip ssh authentication-retries 2

!By default the vtys1 transport is all available such as Telnet. ! In this case, only SSH will be used.

line vty 0 4 login local transport input SSH end

Example 2-12 configures a router named Massimo for Cisco IOS SSH. In particular, the command crypto key generate rsa generates the RSA public key, the ip ssh time-out 120 command sets the default idle time to 120, and the ip ssh authentication-retries 2 command sets a maximum retry limit of 2. The crypto key generate command builds both halves of the key pair. There is an optional write keyword that saves the key pair to NVRAM; otherwise, it is lost on reboot or a reload as the volatile RAM is refreshed.

To start an encrypted session with a remote networking device, use the ssh user EXEC command:

ssh [-l userid] [-c {des | 3des}] [-o numberofpasswordprompts n] [-p portnum] {ipaddr | hostname} [command]

Table 2-5 displays the options available with the ssh EXEC command. Table 2-5 ssh Command Summary*

-l userid

(Optional) Specifies the user ID to use when logging into the remote networking device running the SSH server. If no user ID is specified, one needs to be defined. Otherwise, the following error appears on the router's CLI:

% No user specified nor available for SSH client

-c { des | 3des }

(Optional) Specifies the crypto algorithm, DES or 3DES, to use for encrypting data. To use SSH, you must have an encryption image running on the router. Cisco software images that include encryption have the designators "k8" (DES) or "k9" (3DES).

-o numberofpasswdprompts n

(Optional) Specifies the number of password prompts that the software generates before ending the session. The SSH server may also apply a limit to the number of attempts. If the limit set by the server is less than the value specified by the -o numberofpasswdprompts keyword, the limit set by the server takes precedence. The default is 3 attempts, which is also the Cisco IOS SSH server default. The range of values is from 1 to 5.

-p portnum

(Optional) Indicates the desired port number for the remote host. The default port number is 22.

ipaddr | hostname

Specifies the IP address or host name of the remote networking device.


(Optional) Specifies the Cisco IOS command that you want to run on the remote networking device. If the remote host is not running Cisco IOS software, this may be any command recognized by the remote host. If the command includes spaces, you must enclose the command in quotation marks.

*From srfssh.htm#wp1024082.

*From srfssh.htm#wp1024082.

The following is sample output from the show ip ssh command: Router# show ip ssh

Connection Version Encryption State Username 0 2.0 3DES 4 guest

The connection is labeled 0 (vty number), is running version 2.0, is using 3DES encryption, and the username is guest.

Example 2-13 displays a session connection from a router named Simon to the SSH server-enabled router named Massimo.

Example 2-13 SSH Connection Example

Simon#ssh -c 3des -l cisco Trying Password:cisco Massimo>

The username is defined with the -l option; in Example 2-13, it is set to cisco.

To display the version and configuration data for SSH, use the show ip ssh privileged EXEC command.

For more detailed information on SSH and on the Cisco IOS functional matrix, visit http:// and, respectively.

Was this article helpful?

0 0

Post a comment