交换机配置远程登录
一、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
二、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