实验目的
掌握Cisco IOS命令行的基本操作
掌握设备的常用基本命令
设备Console信息抓取和识别
拓扑与需求
拓扑:
需求:
1.配置设备主机名,设置时区及系统时间
2.配置“新手三条”:关闭域名解析、Console永不超时、Console权限
3.创建MOTD
4.设置和取消密码:Console密码、enable密码、VTY线路密码
5.配置接口IP地址,查看接口状态
6.直连连通性测试
7.配置Telnet实现远程管理设备
8.查看配置并保存
9.删除配置至初始化状态
配置与实现
- 配置设备主机名,设置时区及系统时间
R1
Router>enable
Router#configure terminal
Router(config)#hostname R1
R1(config)#clock timezone GMT +8
!!修改当前系统的时区为: GMT +8 (北京)
R1(config)#exit
R1#clock set hh:mm:ss day mouth year
!!修改当前设置的时间,如:clock set 12:15:30 5 Apr 2018
R2
Router>enable
Router#configure terminal
Router(config)#hostname R2
R2(config)#clock timezone GMT +8
R2(config)#exit
R2#clock set 12:15:30 5 Apr 2018
Tips:
路由器三模式:
“Router>” 表示用户模式
“Router#” 表示特权模式
“Router(config)#” 表示全局配置模式
- 配置“新手三条”:关闭域名解析、Console永不超时、Console权限
R1和R2
Router(config)#no ip domain lookup
!!关闭域名解析
Router(config)#line console 0
Router(config-line)#no exec-time
或
Router(config-line)#exec-time 0 0
!!配置 console 永不超时(常用于实验环境)
Router(config-line)#privilege level 15
!!配置当console 时直接进入特权模式(常用于实验环境)
- 创建MOTD
R1和R2
Router(config)#banner motd # This is My First Lab! #
!!配置提示横幅,即为登录路由器时显示的信息
- 设置和取消密码:Console密码、enable密码、VTY线路密码
R1和R2
Console密码
Router(config)#line console 0
Router(config-line)#password word
!!配置 console 口密码,’word’ 为自己指定的密码,例如:password spoto
Router(config-line)#login
!! 使密码在 console 线路生效
Router(config-line)#no password word
!! 删除密码
enable密码
Router(config)#enable password word
!! 设置 enable 明文密码,可通过 show run 查看密码
Router(config)#no enable password
!! 取消 enable 明文密码
Router(config)#enable secret word
!! 设置 enable 密文密码,show run 只能查看到字母、数字等的组合,安全级别高于明文密码,与明文同时设置时,密文密码优先生效
Router(config)#no enable secret
!! 取消 enable 密文密码
VTY线路密码
Router(config)#line vty 0 4
!! 进入 VTY 0-4 线路
Router(config-line)#password word
!! 设置 VTY 线路密码,即用户通过 telnet 登入路由器时输入的密码
Router(config-line)#login
!! 使密码在线路上生效
Router(config-line)#no password
Router(config-line)#no login
!! 取消 VTY 线路密码
Router(config-line)#exit
- 配置接口IP地址,查看接口状态
R1
R1(config)#interface Ethernet 0/0
R1(config-if)#ip address 12.1.1.1 255.255.255.252
R1(config-if)#no shutdown
R2
R2(config)#interface Ethernet 0/0
R2(config-if)#ip address 12.1.1.2 255.255.255.252
R2(config-if)#no shutdown
查看接口状态
使用命令 show ip interface brief 查看
6. 直连连通性测试
7. 配置Telnet实现远程管理设备
R1
R1(config)#line vty 0 4
R1(config-line)#password spoto
R1(config-line)#login
R1(config-line)#transport input telnet
!!允许使用 telnet 管理
R2
R2(config)#line vty 0 4
R2(config-line)#password spoto
R2(config-line)#login
R2(config-line)#transport input telnet
8. 查看配置并保存
查看设备配置
Router#show running-config
!! 显示设备当前配置(配置信息保存于 RAM 中)
Router#show start-config
!! 显示设备开机配置(配置信息保存于 NVRAM 中)
9. 删除配置至初始化状态
Router#erase start-config
或
Router#write erase