cisco交换机配置ssh远程登陆

前言:

最近整理一些以前的学习笔记(有部分缺失,会有些乱,日后再补)。
过去都是存储在本地,此次传到网络留待备用。


 

cisco SSH远程登陆配置

0.配置ip,启动端口

Switch>enable						            //进入特权模式
Switch#configure terminal				        //进入全局模式
Switch(config)#interface vlan 1                 //进入端口vlan1
Switch(config-if)#ip address 设置ip 子网掩码	//设置ip
Switch(config-if)#no shutdown			        //启动端口

1.配置hostname和domain-name

· rsa的秘钥是用hostname和domain-name产生的
  Switch> enable
  Switch# configure terminal
  Switch(config)# hostname Switch-ssh             //修改设备名,配置ssh的时候不能为router
  Switch-ssh(config)# ip domain-name test.com     //修改域名,配置ssh必须
  Switch-ssh(config)# aaa new-model               //开启3a认证(部分已开启)

2.生成RSA秘钥

· 生成RSA秘钥后ssh服务会自动开启,反之会自动关闭
Switch-ssh(config)# crypto key generate rsa         //生成RSA秘钥
    How many bits in the modulus [512]: 768         //设置秘钥长度,指定ssh2版本要求至少768
    %SSH-5-ENABLED: SSH 1.5 has been enabled        //ssh自动开启
Switch-ssh(config)# crypto key zeroize rsa          //删除RSA秘钥

3.创建新用户和密码

Switch-ssh(config)# username 用户名 privilege 0 secret 密码    //0,ssh时不会自动进入特权模式

4.配置enable特权密码

Switch-ssh(config)# enable secret 密码

5.配置vty(虚拟终端)

Switch-ssh(config)# line vty 0 4                    //4,最大并行连接数
Switch-ssh(config-line)# transport input ssh        //只允许用ssh登陆
Switch-ssh(config-line)# exec-timeout 10 0          //超时时间
Switch-ssh(config-line)# logging synchronous        //光标跟随,同步信息输出
Switch-ssh(config-line)# login local                //本地密码检测

6.ssh的其他设置

Switch-ssh(config)# ip ssh authentication-retries 2    //ssh认证失败的次数
Switch-ssh(config)# ip ssh time-out 120                //ssh超时时间,单位秒
Switch-ssh(config)# ip ssh version 2                   //指定ssh的协议版本
Switch-ssh(config)# ip ssh source-interface f0/0       //指定ssh的接口(vlan也可以)

7.保存配置

# write

8.测试登陆

  • 在cisco设备上使用ssh命令需要指定用户(若本地未配置username)
    # ssh -l 交换机用户名 交换机ip地址
        Password:用户密码
    # sw_ssh>enable
        Password: 特权密码
    

转载于:https://my.oschina.net/xinsui1314x/blog/3078047

  • 33
    点赞
  • 235
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值