实验拓扑
首先给R1接口配置IP地址
R1(config)#interface gigabitEthernet 0/0/0
R1(config-if)#ip address 192.168.0.1 255.255.255.0
PC1配置IP地址(用于验证)
配置特权EXEC密码
R1(config)#enable password cisco
配置明文密码cisco
R1(config)#enable secret cisco
配置加密密码cisco
R1#show running-config (查看配置信息)
可以看到secret密码是加密的,password显示的明文密码
补充:
R1(config)#security passwords min-length 6
设置最短密码长度为6
R1(config)#service password-encryption
加密所有明文密码
可以看到之前的cisco被加密了
线路安全配置
VTY安全设置
vty使用了两种登陆方式Telnet和ssh
telnet是不加密的远程登录方式,使用抓包软件可以抓到明文用户名和密码
ssh是一种加密的远程登录方式,使用抓包软件抓到的是加密的用户名密码
Telnet登陆
R1(config)#line vty 0 4 进入vty接口
R1(config-line)#password class 配置密码class
% Password too short - must be at least 6 characters. Password not configured 提示密码最短长度为6
R1(config-line)#password class123 重新配置了密码class123
R1(config-line)#login 启用密码验证
验证:
vty的默认登陆方式为Telnet
输入vty密码class123
进入特权模式输入密码cisco
注:密码在上面设置的
ssh登陆
第一步:
R1#show ip ssh
使用show ip ssh命令验证交换机是否支持 SSH
第二步:
R1(config)#ip domain-name cisco.com
使用全局配置命令ip domain-name domain-name 配置网络的 IP 域名
第三步:
R1(config)#crypto key generate rsa
The name for the keys will be: R1.cisco.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]
生成RSA密钥对
第四步:
R1(config)#username admin secret cisco123
创建用户名密码
第五步:
R1(config)#line vty 0 15
R1(config-line)#transport input ssh
R1(config-line)#login local
R1(config-line)#exit
R1(config)#
进入vty接口
启用ssh
使用本地数据库验证
退出vty
第六步:
R1(config)#ip ssh version 2
启用ssh版本2
验证:
ssh -l(这个是小写L)
console安全配置
R1(config)#line console 0
R1(config-line)#password ciscocon
R1(config-line)#login
R1(config-line)#exit
R1(config)#
验证:
先用console线将pc和R1连起来
点击ok就能通过console口访问R1了
在这里输入的密码是ciscocon
进入特权EXEC模式的密码是cisco
注:在packet tracer里面点击路由器交换机的CLI界面就是通过console口访问的。
交换机的配置和路由器基本一,下面是补充连接。
交换机配置管理访问
在后面还讲解了关于Cisco IOS登陆增强特性0基础学RS(六)配置登陆增强特性