配置路由器和交换机上的安全Shell运行的Cisco IOS( 二 )



我们测 试是确保的non-SSH用户不能远程登录到路由器卡特 。
设置IOS 路由器或交换机作为SSH 客户端
有为启用SSH技术支持要求的四个步骤在IOS路由器 。
配置 hostname命令 。
配置DNS域 。
生成将使用的SSH键 。
启用SSH vtys的传输技术支持 。
假如我们想要有一次设备操作作为SSH 客户端对其 他,我们能添加SSH到第二个设备,Reed 。设备然后在客户端 服务器排列,用作为服务器和Reed的卡特作为客户端 。IOS SSH客户端配置在Reed是相同象为SSH 服务器配置需要 在卡特 。
!--- Step 1: Configure hostname if you have not previously done so.
hostname carter
!--- aaa new-model causes the local username/password on the router
!--- to be used in the absence of other AAA statements.
aaa new-model
username cisco password 0 cisco
!--- Step 2: Configure the router"s DNS domain.
ip domain-name rtp.cisco.com
!--- Step 3: Generate an SSH key to be used with SSH.
cry key generate rsa
ip ssh time-out 60
ip ssh authentication-retries 2
!--- Step 4: By default the vtys" transport is Telnet. In this case,
!--- Telnet has been disabled and only SSH is supported.
line vty 0 4
transport input SSH
!--- Instead of aaa new-model, the login local command may be used.
测试此,发出以下命令对 SSH从IOS SSH 客户端(Reed)到IOS SSH服务器(卡特):
ssh -l cisco -c 3des 10.13.1.99

添加SSH 终端线路接入
假如 我们需要出局SSH终端线路验证,我们能为出局反向Telnet配置和测 试SSH通过卡特,作为通用服务器对Philly 。
ip ssh port 2001 rotary 1
line 1 16
no exec
rotary 1
transport input ssh
exec-timeout 0 0
modem In Out
Stopbits 1
假如Philly附有Carter端口2,我们会SSH 对Philly 通过卡特从Reed用以下命令:
ssh -c 3des -p 2002 10.13.1.99

从 Solaris,我们会使用以下命令:
ssh -c 3des -p 2002 -x -v 10.13.1.99
debug及show命令
在发出如下 被描述和说明的debug命令 之前,请参阅 重要信息关于Debug命令 。输 出解释器工具支持 某些show命令 (注 册的用户),答应您查看show命令输出分析。
debug IP SSH - 显示调 试消息为SSH 。
show SSH - 显示SSH服 务器连接状态 。
carter#show ssh
ConnectionVersion EncryptionState Username
01.5 DESSession startedcisco
show ip ssh - 显示版 本和配置数据为SSH 。
carter#sho ip ssh
SSH Enabled - version 1.5
Authentication timeout: 60 secs; Authentication retries: 2
示例调试输出
注重一些此"好"调试输出包裹对多条线路由于间距注 意事项 。
路由器调试
00:23:20: SSH0: starting SSH control process
00:23:20: SSH0: sent protocol version id SSH-1.5-Cisco-1.25
00:23:20: SSH0: protocol version id is - SSH-1.5-1.2.26
00:23:20: SSH0: SSH_SMSG_PUBLIC_KEY msg
00:23:21: SSH0: SSH_CMSG_SESSION_KEY msg - length 112, type 0x03
00:23:21: SSH: RSA decrypt started
00:23:21: SSH: RSA decrypt finished
00:23:21: SSH: RSA decrypt started
00:23:21: SSH: RSA decrypt finished
00:23:21: SSH0: sending encryption confirmation
00:23:21: SSH0: keys exchanged and encryption on
00:23:21: SSH0: SSH_CMSG_USER message received
00:23:21: SSH0: authentication request for userid cisco
00:23:21: SSH0: SSH_SMSG_FAILURE message sent
00:23:23: SSH0: SSH_CMSG_AUTH_PASSWORD message received
00:23:23: SSH0: authentication sUCcessful for cisco
00:23:23: SSH0: requesting TTY
00:23:23: SSH0: setting TTY - requested: length 24, width 80; set:
length 24, width 80
00:23:23: SSH0: invalid request - 0x22
00:23:23: SSH0: SSH_CMSG_EXEC_SHELL message received

推荐阅读