设置安全外壳(SSH)

文章目录
  1. 设置口令
  2. 设置安全外壳(SSH)
  3. 客户端连接
  4. 会话管理
  5. 发表评论

设置口令

命令模式 命令语句 用途描述
Router>
Router#
enable
config terminal
从用户模式进入特权模式
进入配置模式
R1(config)# hostname R1
no ip domain-lookup
enable password desen
enable secret desen301
service password-encryption
设置设备名称为R1
关闭动态域名解析
设置启用口令为desen
设置加密口令为desen301,替代启用口令
启用密码加密服务
R1(config)# line console 0 进入console 0口
R1(config-line)# no exec-timeout
logging synchronous
password cisco7200
login
关闭会话超时
启用日志同步,以免弹出不必要的日志信息
设置console登陆口令为cisco7200
启用认证功能,如果没有设置线路密码则该线路不使用
R1(config-line)#
R1(config)#
exit
line vty 0 1869
退出console 0配置模式
进入VTY线路0到1869
R1(config-line)# password telnet1869
login
no login
设置telnet密码为telnet1869
启用VTY认证功能
关闭VTY认证功能,可直接telnet
R1(config-line)# exit 退出vty线路配置模式

设置安全外壳(SSH)

命令模式 命令语句 用途描述
R1(config)#
R1(config-if)#
R1(config-if)#
R1(config-if)#
R1(config)#
R1(config)#
interface fastEthernet 0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
ip domain-name desenpast.com
username desen password cisco
设置域名(生成加密密码需要用到用户名和域名)
R1(config)# crypto key generate rsa general-keys modulus 2048 生成一个2048位rsa算法的密钥
R1(config)# ip ssh time-out 60
ip ssh authentication-retries 2
设置最大空闲时间为60秒
最大失败尝试次数为2
R1(config)#
R1(config-line)#
R1(config-line)#
line vty 0 1869
transport input ssh
login local
进入VTY线路0到1869
设置ssh为vty线路协议
使用本址认证(可以不设置vty线路密码)

客户端连接

命令模式 命令语句 用途描述
R2# ssh -l desen 192.168.1.1
Password: cisco
SSH登陆192.168.1.1,用户名为desen
R1# enable
Password: desen301
输入加密密码

会话管理

查看设备在线用户:show users
关闭vty线路0的会话:clear line vty 0
查看当前建立的远程会话:show sessions
断开远程会话ID为226的会话线路:disconnect 226

文章出自: 本站技术文章均为原创,版权归 "Desen往事 - 个人博客" 所有;部分图片来源于 Yandex ,转载本站文章请注明来源。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code

ˆ Top