Cisco交换机配置远程登录
交换机配置远程登录
一、telnet远程登录
Telnet协议是TCP/IP协议族中的一员,是Internet远程登录服务的标准协议和主要方式(基于 TCP 的 23 号端口)
思科设备配置:
#使用用户名、密码进行远程登录
Switch>enable
Switch#configure terminal#进入vlan 1,一般情况下vlan 1作为交换机的管理接
Switch(config)#int vlan 1#设置IP地址192.168.1.100
Switch(config-if)#ip add 192.168.1.100 255.255.255.0
Switch(config-if)#no shut
Switch(config-if)#exit
#telnet远程登录必须设置特权模式密码,如未设置,远程连接后无法进入特权模式D#设置特权模式密文密码
Switch(config)#enable secret cisco#创建登录用户名和密文密码
Switch(config)#username cisco secret cisco#进人0-4虚拟终端
Switch(config)#line vty 0 4#应用
Switch(config-line)#login local
华为设备:
-
交换机设置IP地址:
-
交换机的接口都是二层接口,二层接口不能配置IP地址,需要在交换机的三层虚接口上去配置IP地址。
-
默认的三层虚接口是vlan 1接口。
-
配置命令:
<Huawei>sys [Huawei]sysname telnetserver [telnetserver]int vlan 1 [telnetserver-Vlanif1]ip add 192.168.10.100 24
-
-
配置Telnet服务:
-
启用Telnet服务。
-
配置VTY用户界面,允许通过Telnet登录。
-
设置认证模式为AAA认证。
-
配置命令:
[telnetserver]telnet server enable [telnetserver]user-interface vty 0 4 [telnetserver-ui-vty0-4]authentication-mode aaa [telnetserver-ui-vty0-4]protocol inbound telnet
-
-
AAA配置:
-
配置AAA(Authentication, Authorization, and Accounting)认证。
-
创建本地用户zhangsan,并设置密码为加密形式的123456。
-
设置用户zhangsan的权限级别为15(最高权限)。
-
配置用户zhangsan的服务类型为Telnet。
-
配置命令:
[telnetserver]aaa [telnetserver-aaa]local-user zhangsan password cipher 123456 [telnetserver-aaa]local-user zhangsan privilege level 15 [telnetserver-aaa]local-user zhangsan service-type telnet
-
二、SSH远程登陆
SSH 为 Secure Shell 的缩写,由IETF 的网络小组 (Network Working Group) 所制定; SSH 为建立在应用层基础上的安全协议。SSH 是较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。 (基于 TCP 的 22 号端口)
Switch>enable
Switch#configure terminalSwitch(config)#interface vlan 1
Switch(config-if)#ip address 192.168.1.100 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit#配置交换机hostname
Switch(config)#hostname test#启用v2版的ssh服务
test(config)#ip ssh version 2#配置交换机domain-name
test(config)#ip domain-name test.com#生成密钥
test(config)#crypto key generate rsa
The name for the keys will be: test.test.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 //设置密钥位数
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]#配置特权模式密码(secret密码为加密的,password为明文的)
test(config)#enable password admin
#配置用户名和密码(secret密码为加密的,password为明文的)
test(config)#username admin secret admin#设置超时,单位秒
test(config)#ip ssh time-out 30
#设置认证次数
test(config)#ip ssh authentication-retries 32 3#进入虚拟终端管理线路vty 0 4
test(config)#line vty 0 4#只允许ssh登录
test(config-line)#transport input ssh#应用
test(config-line)#login local
华为设备:
-
交换机设置IP地址:
-
配置交换机的VLAN 1接口的IP地址。
-
配置命令:
[Huawei]int vlan 1 [Huawei-Vlanif1]ip add 192.168.10.50 24
-
-
配置VTY终端:
-
配置VTY(Virtual Terminal)用户界面,允许通过SSH登录。
-
设置认证模式为AAA认证。
-
配置命令:
[Huawei]user-interface vty 0 4 [Huawei-ui-vty0-4]authentication-mode aaa [Huawei-ui-vty0-4]protocol inbound ssh
-
-
AAA配置:
-
配置AAA(Authentication, Authorization, and Accounting)认证。
-
创建本地用户zhangsan,并设置密码为加密形式的woniu123。
-
设置用户zhangsan的权限级别为15(最高权限)。
-
配置用户zhangsan的服务类型为SSH。
-
配置命令:
[Huawei]aaa [Huawei-aaa]local-user zhangsan password cipher woniu123 [Huawei-aaa]local-user zhangsan privilege level 15 [Huawei-aaa]local-user zhangsan service-type ssh
-
-
SSH配置:
-
启用SSH服务。
-
创建SSH用户zhangsan,并设置认证类型为密码认证。
-
配置用户zhangsan的服务类型为Telnet。
-
配置命令:
[Huawei]stelnet server enable [Huawei]ssh user zhangsan [Huawei]ssh user zhangsan authentication-type password [Huawei]ssh user zhangsan service-type stelnet
-
更多推荐



所有评论(0)