switch>enable #用户模式
switch#configure terminal #特权模式
switch(config)# interface g0/0 #全局配置模式
switch(config-if)# no switchport #接口配置模式
switch(config-if)# ip address 192.168.202.10 255.255.255.0
switch(config-if)#end #回到特权模式
vIOS-L2-01(config)#ip domain-name cisco.com #设置主机域名
vIOS-L2-01(config)#crypto key generate rsa #使用RSA加密(输入长度或敲两下回车)
How many bits in the modulus [512]: 1024 #加密长度1024
vIOS-L2-01(config)#username python privilege 1 password 123 #配置登录用户名为
python,密码为123
vIOS-L2-01(config)#enable password 123 #配置特权模式密码为123
vIOS-L2-01(config)#ip ssh time-out 120 #配置超时时间为120秒(默认120秒,可选)
vIOS-L2-01(config)#ip ssh authentication-retries 5 #重试次数改成5次(默认3次,可选)
vIOS-L2-01(config)#ip ssh version 2 #只启用ssh v2版本,即禁用v1版本(默认是1.99,即同时使用v1和v2)
vIOS-L2-01(config)#line vty 0 4 #进入线路0-4
vIOS-L2-01(config-line)#transport input all #允许SSH和telenet登录
vIOS-L2-01(config-line)#login local #使用本地定义的用户名和密码登录
vIOS-L2-01(config-line)#end #结束退出
vIOS-L2-01#write #保存配置
注:
vIOS-L2-01(config)#username python privilege 15 password 123
#用户名(python)和密码(123),用于SSH远程登录;privilege15:该用户权限为15级
(级别最高),无需输入enable,可直接进入特权模式(默认级别为1,级别最低)
输入ssh -l username 192.168.202.10 进行ssh连接
输入 telnet 192.168.202.10 进行telnet连接
R2# ssh -v 2 -l cisco 192.168.10.11 #在另外一台思科设备上登录,-v 2:使用ssh v2;-l:
指定用户名登录
VIOS-L2# show crypto key mypubkey rsa #查看生成的密钥信息
VIOS-L2# show ip ssh #查看SSH信息
[root@localhost ~]#ssh -l python 192.168.202.10 (password:123)
查看接口信息:show ip int brief
《思科 - GNS3 - SSH 实验》
最新推荐文章于 2024-04-17 12:06:40 发布