使用Telnet/SSH去管理远程设备
2015-03-19 14:34
661 查看
一、案例拓扑图
二、为什么我们需要远程登陆?
很多情况下,你也许不能在设备前使用console线来管理,这时就需要通过telnet或SSH访问其CLI远程管理它,为了能够远程访问,必须先设置虚拟类型终端(VTY);
三、telnet和ssh
Telnet:基于TCP协议,端口号23,是一组提供远程登录方法的程序,所有传输的信息(包括用户名和密码)都是明文的;
SSH:基于TCP协议,端口号22,使用RSA算法对所有传输的信息(包括用户名和密码)进行加密,另一个优点是其传输的数据是经过压缩的,所以可以加快传输的速度,目前SSH存在两种版本(版本1和版本2),版本1有一些加密算法存在漏洞,并且已经被破解,攻击者可以插入数据,版本2修复了这些漏洞,并且版本2可以兼容版本1;
四、实战目的:
配置sw1,使之能够通过telnet/SSH访问,并且限制只有PC1的IP地址才能够管理。
五、实验步骤
1.首先确保管理客户端能够ping通交换机;
2.先在交换机上配置telnet,并配置密码,使PC能够通过telnet去管理交换机;
3.在交换机上配置,使客户端需要输入用户和密码才能访问到设备;
4.配置ACL,并在vty中调用,限制只有某个IP地址可以访问该设备;
5.在设备上启用SSH协议,并配置客户端通过SSH访问并管理设备;
六、配置命令
1.Telnet配置规则(只需密码)
在PC上(把router当做PC)配置
Router>enable
Router#configure terminal
Router(config)#hostname PC
PC(config)#interface fastEthernet 0/0
PC(config-if)#ip address 10.10.10.1 255.255.255.0
PC(config-if)#no shutdown
PC(config-if)#end
PC#write memory
在交换机SW1上配置
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#enable secret cisco
SW1(config)#enable password cisco
SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.10.10.254 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#line vty 0 4
SW1(config-line)#password cisco
SW1(config-line)#login 打开远程登录
SW1(config-line)#end
SW1#write memory
在PC上测试
PC#telnet 10.10.10.254
Trying 10.10.10.254 ...Open
User Access Verification
Password:
SW1>enable
Password:
SW1#
2.Telnet配置规则(需要用户名和密码)
在交换机SW1上配置
SW1#erase startup-config
SW1#reload
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#enable secret cisco
SW1(config)#enable password cisco
SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.10.10.254 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#username cisco password cisco
SW1(config)#line vty 0 4
SW1(config-line)#login local 配置登录时,使用本地用户名和密码进行验证
SW1(config-line)#access-class 101 in
SW1(config-line)#exit
SW1(config)#access-list 101 permit ip host 10.10.10.1 any
在PC上测试
PC#telnet 10.10.10.254
Trying 10.10.10.254 ...Open
User Access Verification
Username: cisco
Password:
SW1>en
SW1>enable
Password:
SW1#
3.SSH配置规则
交换机SW1上的配置
SW1#erase startup-config
SW1#reload
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#enable secret cisco
SW1(config)#enable password cisco
SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.10.10.254 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#ip domain-name cisco.com
SW1(config)#crypto key generate rsa
SW1(config)#ip ssh version 1
SW1(config)#username cisco password cisco 配置本地用户名和密码
SW1(config)#line vty 0 4
SW1(config-line)#login local
SW1(config-line)#transport input none
SW1(config-line)#transport input ssh 允许ssh 访问进入
SW1(config-line)#transport output telnet 允许用telnet去访问其他设备
SW1(config-line)#end
SW1#write memory
在PC上测试
PC#ssh -l cisco -v 1 10.10.10.254
Open
Password:
SW1>enable
Password:
SW1#
七、总结
在远程管理设备上配置telnet可以限制只有某个ip能登陆,ssh则没有此功能。
二、为什么我们需要远程登陆?
很多情况下,你也许不能在设备前使用console线来管理,这时就需要通过telnet或SSH访问其CLI远程管理它,为了能够远程访问,必须先设置虚拟类型终端(VTY);
三、telnet和ssh
Telnet:基于TCP协议,端口号23,是一组提供远程登录方法的程序,所有传输的信息(包括用户名和密码)都是明文的;
SSH:基于TCP协议,端口号22,使用RSA算法对所有传输的信息(包括用户名和密码)进行加密,另一个优点是其传输的数据是经过压缩的,所以可以加快传输的速度,目前SSH存在两种版本(版本1和版本2),版本1有一些加密算法存在漏洞,并且已经被破解,攻击者可以插入数据,版本2修复了这些漏洞,并且版本2可以兼容版本1;
四、实战目的:
配置sw1,使之能够通过telnet/SSH访问,并且限制只有PC1的IP地址才能够管理。
五、实验步骤
1.首先确保管理客户端能够ping通交换机;
2.先在交换机上配置telnet,并配置密码,使PC能够通过telnet去管理交换机;
3.在交换机上配置,使客户端需要输入用户和密码才能访问到设备;
4.配置ACL,并在vty中调用,限制只有某个IP地址可以访问该设备;
5.在设备上启用SSH协议,并配置客户端通过SSH访问并管理设备;
六、配置命令
1.Telnet配置规则(只需密码)
在PC上(把router当做PC)配置
Router>enable
Router#configure terminal
Router(config)#hostname PC
PC(config)#interface fastEthernet 0/0
PC(config-if)#ip address 10.10.10.1 255.255.255.0
PC(config-if)#no shutdown
PC(config-if)#end
PC#write memory
在交换机SW1上配置
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#enable secret cisco
SW1(config)#enable password cisco
SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.10.10.254 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#line vty 0 4
SW1(config-line)#password cisco
SW1(config-line)#login 打开远程登录
SW1(config-line)#end
SW1#write memory
在PC上测试
PC#telnet 10.10.10.254
Trying 10.10.10.254 ...Open
User Access Verification
Password:
SW1>enable
Password:
SW1#
2.Telnet配置规则(需要用户名和密码)
在交换机SW1上配置
SW1#erase startup-config
SW1#reload
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#enable secret cisco
SW1(config)#enable password cisco
SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.10.10.254 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#username cisco password cisco
SW1(config)#line vty 0 4
SW1(config-line)#login local 配置登录时,使用本地用户名和密码进行验证
SW1(config-line)#access-class 101 in
SW1(config-line)#exit
SW1(config)#access-list 101 permit ip host 10.10.10.1 any
在PC上测试
PC#telnet 10.10.10.254
Trying 10.10.10.254 ...Open
User Access Verification
Username: cisco
Password:
SW1>en
SW1>enable
Password:
SW1#
3.SSH配置规则
交换机SW1上的配置
SW1#erase startup-config
SW1#reload
Switch>enable
Switch#configure terminal
Switch(config)#hostname SW1
SW1(config)#enable secret cisco
SW1(config)#enable password cisco
SW1(config)#interface vlan 1
SW1(config-if)#ip address 10.10.10.254 255.255.255.0
SW1(config-if)#no shutdown
SW1(config-if)#exit
SW1(config)#line console 0
SW1(config-line)#password cisco
SW1(config-line)#login
SW1(config-line)#exit
SW1(config)#ip domain-name cisco.com
SW1(config)#crypto key generate rsa
SW1(config)#ip ssh version 1
SW1(config)#username cisco password cisco 配置本地用户名和密码
SW1(config)#line vty 0 4
SW1(config-line)#login local
SW1(config-line)#transport input none
SW1(config-line)#transport input ssh 允许ssh 访问进入
SW1(config-line)#transport output telnet 允许用telnet去访问其他设备
SW1(config-line)#end
SW1#write memory
在PC上测试
PC#ssh -l cisco -v 1 10.10.10.254
Open
Password:
SW1>enable
Password:
SW1#
七、总结
在远程管理设备上配置telnet可以限制只有某个ip能登陆,ssh则没有此功能。
相关文章推荐
- 解决在ssh或telnet等方式进行远程管理遇到的乱码问题
- Linux服务器教程之路2--使用SSH来进行远程管理
- cisco 设备远程管理之Telnet配置
- SSH远程会话管理工具 - screen使用教程
- linux平台远程管理工具 ssh 与 vnc的使用 wireshark tcpdump
- 不用密码使用ssh管理远程linux服务器
- VPS入门-使用putty远程管理工具登陆SSH
- Linux 下使用expect自动telnet/ssh cisco设备执行ping测试
- 使用USB远程ssh登陆iOS设备,进行越狱开发
- SSH远程会话管理工具 - screen使用教程
- 远程管理交换机两种方法:telnet 和 ssh
- SSH远程会话管理工具 - screen使用教程
- Linux全攻略--远程登录管理-Telnet与SSH
- 使用python来玩转ensp~系列1-telnet方式登录管理设备
- RHCE课程-RH131Linux管理笔记五-Linux远程登陆telnet及ssh服务 推荐
- 使用Putty远程(SSH)管理Linux VPS的图文教程
- SSH远程会话管理工具 - screen使用教程。
- ASA远程系统管理(Telnet&SSH)
- 如何使用Putty远程(SSH)管理Linux VPS
- VPS侦探 SSH远程会话管理工具 - screen使用教程