实验一 Cisco IOS 操作实验学时:2 实验类型:验证一、实验目的⑴ 掌握路由器基本配置命令;⑵ 掌握TFTP的安装与配置,掌握路由器IOS备份、升级方法;⑶ 掌握路由器口令恢复的方法二、实验条件Cisco2621 Router、PacketTrace仿真软件、具备Windows操作系统的PC机三、实验原理及相关知识Packet Trace路由仿真软件的使用,路由器组成及启动顺序,配置寄存器和口令恢复,备份及恢复IOS和配置文件,升级路由器IOSTFTP(trivial file transfer protocol)即简单文件传输协议,是允许文件在网络中从一台主机传输到另一台主机的简化的FTP 版本,大多数网络设备的软件升级均采用TFTP 方式四、实验步骤1. 路由器基本配置⑴ 配置路由器ARouter>en //进入特权模式Router#config t //进入全局模式Router(config)#hostname LabA //设置主机名Lab_A(config)#enable secret x203 //设置加密口令,由用户模式进入特权模式起作用。
Lab_A(config)#interface fa0/0 //进入Fastethernet 0/0子接口模式Lab_A(config-if)#ip address 192.168.0.1 255.255.255.0 //配置Fa0/0接口的IP地址Lab_A(config-if)#description Lab_A LAN Connection //配置Fa0/0接口的描述字符Lab_A(config-if)#no shutdown //激活Fa0/0接口激活Fa0/0接口后,再查看路由器与交换机连接线两端的状态状态变化Lab_A(config-if)#interface s1/0 //进入serial 1/0子接口模式Lab_A(config-if)#ip address 192.168.1.1 255.255.255.0 //配置serial 0/0接口IP地址Lab_A(config-if)#description WAN Connection to Lab_B //配置serial 0/0接口的描述字符Lab_A(config-if)#no shut //激活serial 0/0接口Lab_A(config-if)#exit //退出子接口模式,返回全局模式Lab_A(config)#line console 0 //进入Console子接口模式Lab_A(config-line)#password x203 //配置Console登陆密码Lab_A(config-line)#loginLab_A(config-line)#line vty 0 4 //进入Vty子接口模式Lab_A(config-line)#password x203 //配置Vty登陆密码,可以有五个TelnetLab_A(config-line)#loginLab_A(config-line)#exit //退出子接口模式,返回全局模式Lab_A(config)#banner motd #[Enter] //设置Banner信息,以字符“#”结束输入This is the Lab_A router!#Lab_A(config)#^z //即Ctrl+Z的组合键,可直接返回特权模式Lab_A#copy running-config startup-config //保存上面所做的所有配置Destination filename [startup-config]? [Enter]Lab_A# //特权模式⑵ 配置路由器BRouter>en //进入特权模式Router#config t //进入全局模式Router(config)#hostname Lab_B //设置主机名Lab_B(config-if)#interface s1/0 //进入serial 1/0子接口模式Lab_B(config-if)#ip address 192.168.1.2 255.255.255.0 //配置serial 0/0接口IP地址Lab_B(config-if)#description WAN Connection to Lab_A //配置serial 0/0接口的描述字符Lab_B(config-if)#clock rate 9600Lab_B(config-if)#no shut //激活serial 0/0接口⑶ 查看当前路由器配置Lab_A#show running-config //查看路由器当前的配置信息。
Lab_A#show startup-config //查看nvram 中的路由器配置信息Lab_A#show version //查看IOS版本号,已启动时间,flash中的IOS的文件名,router里面共有什么的端口,寄存器的值等等Lab_A#show flash //查看flash中的内容,IOS的长度,文件名,剩余空间,总空间2. TFTP软件安装⑴ 配置环境配置PC0的IP地址,并测试其与路由器的连通性⑵ TFTP软件安装与设置在PC0上安装TFTP软件,并设置其文件目录为D盘根目录具体设置为“查看”-“选项”-“TFTP 服务器根目录”,选择D盘即可本实验在Packet Tracer中模拟实现,因为PC0不能安装TFTP软件,所以选用默认有TFTP功能的Server-TP终端进行验证实验3. IOS备份与升级⑴ 查看操作系统的名称LabA#sh flashSystem flash directory:File Length Name/status 3 50938004 c2800nm-advipservicesk9-mz.124-15.T1.bin //不同的路由器操作系统的名称不同 2 28282 sigdef-category.xml 1 227537 sigdef-default.xml[51193823 bytes used, 12822561 available, 64016384 total]63488K bytes of processor board System flash (Read/Write)⑵ 备份操作系统LabA#copy flash: tftpSource filename []? c2800nm-advipservicesk9-mz.124-15.T1.bin//此处询问你要求备份的flash的文件名,输入Cisco IOS的名称即可,然后press ENTER。
Address or name of remote host []? 192.168.0.2 //此处询问你要求存放你的flash的服务器的地址是什么,这里我们输入TFTP Server的地址,然后press ENTERDestination filename [c2800nm-advipservicesk9-mz.124-15.T1.bin]? //此处询问在目的地保存该flash的文件名?我们在此输入Cisco IOS的名称即可Writing c2800nm-advipservicesk9-mz.124-15.T1.bin....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![OK - 50938004 bytes]50938004 bytes copied in 10.739 secs (4743000 bytes/sec)LabA#以上的信息说明你的保存已经成功完成了,copy flash tftp已经成功完成了,一旦这个复制命令完成了,路由器会告诉我们,复制过去的文件占用了TFTP Server多少空间,一共耗时多少。
备份完成后,查看PC0 D盘是否有操作系统⑶ 升级IOSLabA#cop tftp: flash: Address or name of remote host []? 192.168.0.2 //TFTP服务器地址Source filename []? c2800nm-advipservicesk9-mz.124-15.T1 //需升级的新IOS映象文件名Destination filename [c2800nm-advipservicesk9-mz.124-15.T1.bin]? c2800nm-advipservicesk9-mz.124-15.T1.bin%Warning:There is a file already existing with this nameDo you want to over write? [confirm]Erase flash: before copying? [confirm]Erasing the flash filesystem will remove all files! Continue? [confirm]Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased Erase of flash: completeAccessing tftp://192.168.0.3/c2800nm-advipservicesk9-mz.124-15.T1.bin...Loading c2800nm-advipservicesk9-mz.124-15.T1.bin from 192.168.0.3: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [OK - 50938004 bytes]50938004 bytes copied in 59.179 secs (62410 bytes/sec)至此,新的IOS文件已传至路由器,重启后IOS升级成功。
4. 口令恢复⑴ 连接设备重新连接设备,将PC0通过Console线连接到路由器的Console口,如图所示⑵ 查看寄存器值当路由器启动时,在PC0超级终端界面HyperTerminal(超级终端)同时按下Ctrl和Break 组合键来执行一个中断系统出现rommon提示,rommon 1 >在此模式下使用?,查看监控模式下可用的哪些命令也可使用查看Flash:中的内容rommon 1 >dir flash:program load complete, entry point: 0x8000f000, size: 0xcb80Directory of flash:2 20267528 -rw- c2800nm-advsecurityk9-mz.124-3i.bin4951 1823 -rw- sdmconfig-2811.cfg4952 6036480 -rw- sdm.tar6426 861696 -rw- es.tar6637 1164288 -rw- common.tar6922 1038 -rw- home.shtml6923 113152 -rw- home.tar6951 527849 -rw- 128MB.sdf7080 1697952 -rw- securedesktop-ios-3.1.1.45-k9.pkg7495 416354 -rw- sslclient-win-1.1.3.173.pkg7597 1189 -rw- pre_autosec.cfg7598 1272 -rw- startupc_⑶ 修改配置寄存器的值不同的路由器修改的方法不同,Cisco 2800系列方法如下:rommon 2 > confreg 0x2142 You must reset or power cycle for new config to take effect//下次引导时不要配置文件,考虑通常配置寄存器的值是什么,为什么现在是这样的值。
⑷ 重启设备使用命令reset重新启动路由器:rommon 2 >reset由于进行的是不带配置文件的启动,所以系统进入“setup”模式,选择“no” System Configuration Dialog ---Continue with configuration dialog? [yes/no]: no⑸ 导入配置将NVRAM中的配置文件导入到running-config文件中LabA#copy startup-config running-config在这一步中,分别是用show run和show star命令查看配置文件,你会发现在Start中的F0/0以及F0/1端口是no shutdown的而虽然已经将Start 内容复制到run中,并没有改变run中的F0/0以及F0/1的状态这就是这条命令的局限⑹ 修改并保存修改各类口令:LabA(config)#enable secret testLabA(config)#line vty 0 4LabA(config-line)#password testLabA(config-line)#line console 0LabA(config-line)#password test修改回配置寄存器的值:LabA(config)#config-register 0x2102保存修改后的口令LabA#copy running-config startup-config五、思考题及其它⑴ 理解路由器口令恢复的基本原理以及寄存器值的修改作用。
⑵ 交换机及其他厂家设备口令恢复的方法?⑶ 理解startup-config和running-config的区别,以及copy startup-config running-config的局限性。