九、Telnet/SSH登录cisco设备

个人学习笔记,若有侵权,请告知!

目录

前提条件:保证远程设备与cisco设备互相ping通

Telnet

R1#config t    
R1(config)#username cisco secret cisco   // 设置用户名和密码(密文加密)
R1(config)#enable secret cisco   //设置enbale密码
R1(config)#line vty 0 4    //进入VTY端口,0 4表示可以同时打开5个会话
R1(config-line)#session-timeout 2   //Telnet登录超时时间两分钟

R1(config-line)#login local    //远程登录时,使用用户名和密码登录
或
R1(config-line)#password cisco     //设置login登录密码
R1(config-line)#login    //远程登录时,使用密码登录
(login local与login二选其一使用)


R1(config-line)#access-class 10 in    //允许远程Telnet的ACL
R1(config-line)#transport input telnet     //vty下允许Telnet登录


测试
R2#telnet 12.12.12.1
Trying 12.12.12.1 ... Open


User Access Verification

Username: cisco
Password: 
R1>enable
Password: 
R1#
R1#show users 
    Line       User       Host(s)              Idle       Location
 226 vty 0     cisco      idle                 00:00:03 12.12.12.2

  Interface    User               Mode         Idle     Peer Address

SSH

R3(config)#ip domain-name CISCO   //设置域名
R3(config)#crypto key generate rsa   //加密
The name for the keys will be: R1.CISCO
Choose the size of the key modulus in the range of 360 to 2048 for your
  General Purpose Keys. Choosing a key modulus greater than 512 may take
  a few minutes.

How many bits in the modulus [512]: 2048       //设置加密位
% Generating 2048 bit RSA keys, keys will be non-exportable...[OK]

R3(config)#
*Mar  1 01:01:50.511: %SSH-5-ENABLED: SSH 1.99 has been enabled
R3(config)#username cisco secret cisco    //设置用户名和密码(密文加密)
R3(config)#enable secret cisco   //设置enbale密码
R3(config)#ip ssh time-out 120   //ssh超时时间120秒
R3(config)#ip ssh authentication-retries 3    //ssh尝试登录3次
R3(config)#line vty 0 4    //进入VTY端口,0 4表示可以同时打开5个会话
R3(config-line)#access-class 10 in    //允许远程Telnet的ACL
R3(config-line)#login local    //远程登录时,使用用户名和密码登录
R3(config-line)#transport input ssh   //vty下允许ssh登录


测试
Cisco设备是没有SSH客户端,所以验证SSH需要SSH客户端软件(CRT或Xshell等)

(SSH Client)#ssh 10.10.10.2
Trying 10.10.10.2 ... Open


User Access Verification

Username: cisco
Password: 
R3>enable
Password: 
R3#
R3#show users 
    Line       User       Host(s)              Idle       Location
*  2 vty 0     cisco      idle                 00:00:00 10.10.10.1

  Interface    User               Mode         Idle     Peer Address

你可能感兴趣的:(九、Telnet/SSH登录cisco设备)