思科ssh链接交换机配置
拓扑图
配置教程
一.添加pc0的ip为192.168.1.2
交换机配置
Switch>ena
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#ip domain-name cnblogs.com //绑定域名为cnblogs.com
Switch(config)#ho s1 //命名交换机为s1
s1(config)#cr key generate rsa //生成RSA 秘钥
The name for the keys will be: s1.cnblogs.com
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]: 1024 //最大2048位
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
s1(config)#enable password s1 //设置特权模式密码为s1
s1(config)#username s1 secret s1 //设置交换机用户名为s1 密码为s1
s1(config)#line vty 0 15 创建vty线路
s1(config-line)#transport input ssh
s1(config-line)#login local
s1(config-line)#int vlan 1 //因为所有通道在端口未被配置ip的情况下默认使用VLAN1
s1(config-if)#ip ad 192.168.1.1 255.255.255.0
s1(config-if)#no sh
s1(config-if)#
%LINK-5-CHANGED: Interface Vlan1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to up
s1(config-if)#
配置完成
使用pc0 ping 交换机刚刚配置的ip:192.168.1.1
使用pc0 ssh链接交换机
使用命令:
ssh -l s1(刚刚的用户名)192.168.1.1(配置的ip)
注意:输入密码时通常不会显示明文密码,是需要输入刚刚设置的密码:s1
成功用ssh进入交换机
为了交换机的安全通常会将特权模式设置一个密码,当设备退出特权模式或使用ssh链接使用特权模式时会要求输入特权模式的密码
这里也一样,不会显示明文密码
输入刚刚设置的密码后进入特权模式
配置完成
注:两层交换机和三层交换机配置一样
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通